summaryrefslogtreecommitdiff
path: root/draw.go
diff options
context:
space:
mode:
Diffstat (limited to 'draw.go')
-rw-r--r--draw.go71
1 files changed, 36 insertions, 35 deletions
diff --git a/draw.go b/draw.go
index c6f2c17..9047808 100644
--- a/draw.go
+++ b/draw.go
@@ -6,6 +6,7 @@ import (
"go.wit.com/log"
"go.wit.com/gui/gui"
+ "go.wit.com/gui/widget"
"go.wit.com/gui/gadgets"
)
@@ -38,9 +39,9 @@ func (rs *RepoStatus) drawGitBranches() {
all := rs.getBranches()
for _, branch := range all {
log.Warn("getBranches()", branch)
- rs.masterDrop.Add(branch)
- rs.develDrop.Add(branch)
- rs.userDrop.Add(branch)
+ rs.masterDrop.AddText(branch)
+ rs.develDrop.AddText(branch)
+ rs.userDrop.AddText(branch)
if branch == "master" {
master = "master"
}
@@ -99,10 +100,10 @@ func (rs *RepoStatus) drawGitCommands() {
rs.Update()
})
- label := "merge devel to " + rs.masterDrop.Get()
+ label := "merge devel to " + rs.masterDrop.String()
rs.develMerge = newgrid.NewButton(label, func() {
rs.develMerge.Disable()
- master := rs.masterDrop.Get()
+ master := rs.masterDrop.String()
rs.checkoutBranch("master", master)
if rs.getCurrentBranchName() != master {
log.Warn("something went wrong switching to the master branch. full stop!")
@@ -159,7 +160,7 @@ func (rs *RepoStatus) drawGitCommands() {
}
func (rs *RepoStatus) setTag() bool {
- lasttag := rs.lasttag.Get()
+ lasttag := rs.lasttag.String()
var major, minor, revision string
major, minor, revision = splitVersion(lasttag)
@@ -170,7 +171,7 @@ func (rs *RepoStatus) setTag() bool {
log.Warn("current version here", lasttag)
log.Warn("current release a,b,c =", major, minor, revision)
- newa, _ := strconv.Atoi(rs.major.Get())
+ newa, _ := strconv.Atoi(rs.major.String())
newver := strconv.Itoa(newa)
if newa < olda {
@@ -181,12 +182,12 @@ func (rs *RepoStatus) setTag() bool {
if newa > olda {
log.Warn("new version ok", newver, "vs old version", lasttag)
rs.newversion.Set(newver)
- rs.minor.Set("")
- rs.revision.Set("")
+ rs.minor.SetText("")
+ rs.revision.SetText("")
return true
}
- newb, _ := strconv.Atoi(rs.minor.Get())
+ newb, _ := strconv.Atoi(rs.minor.String())
newver = strconv.Itoa(newa) + "." + strconv.Itoa(newb)
if newb < oldb {
log.Warn("new version bad", newver, "vs old version", lasttag, "newb =", newb, "oldb =", oldb)
@@ -197,11 +198,11 @@ func (rs *RepoStatus) setTag() bool {
if newb > oldb {
log.Warn("new version ok", newver, "vs old version", lasttag)
rs.newversion.Set(newver)
- rs.revision.Set("")
+ rs.revision.SetText("")
return true
}
- newc, _ := strconv.Atoi(rs.revision.Get())
+ newc, _ := strconv.Atoi(rs.revision.String())
newver = strconv.Itoa(newa) + "." + strconv.Itoa(newb) + "." + strconv.Itoa(newc)
if newc <= oldc {
log.Warn("new version bad", newver, "vs old version", lasttag)
@@ -214,7 +215,7 @@ func (rs *RepoStatus) setTag() bool {
}
func (rs *RepoStatus) incrementVersion() {
- lasttag := rs.lasttag.Get()
+ lasttag := rs.lasttag.String()
var major, minor, revision string
major, minor, revision = splitVersion(lasttag)
log.Warn("Should release version here", lasttag)
@@ -224,27 +225,27 @@ func (rs *RepoStatus) incrementVersion() {
b, _ := strconv.Atoi(minor)
c, _ := strconv.Atoi(revision)
- rs.major.Add(a)
- rs.major.Add(a + 1)
- rs.major.Set(a)
+ rs.major.AddText(widget.GetString(a))
+ rs.major.AddText(widget.GetString(a + 1))
+ rs.major.SetText(widget.GetString(a))
- rs.minor.Add(b)
- rs.minor.Add(b + 1)
- rs.minor.Set(b)
+ rs.minor.AddText(widget.GetString(b))
+ rs.minor.AddText(widget.GetString(b + 1))
+ rs.minor.SetText(widget.GetString(b))
// rs.c := strconv.Atoi(revision)
- rs.revision.Add(c + 1)
- rs.revision.Add(c + 2)
- rs.revision.Set(c + 1)
+ rs.revision.AddText(widget.GetString(c + 1))
+ rs.revision.AddText(widget.GetString(c + 2))
+ rs.revision.SetText(widget.GetString(c + 1))
}
func (rs *RepoStatus) recommend() {
- log.Warn("Is repo dirty?", rs.dirtyLabel.Get())
+ log.Warn("Is repo dirty?", rs.dirtyLabel.String())
log.Warn("list the known tags")
rs.DisableEverything()
rs.populateTags()
- log.Warn("Does devel == user?", rs.develBranchVersion.Get(), rs.userBranchVersion.Get())
- if rs.develBranchVersion.Get() != rs.userBranchVersion.Get() {
+ log.Warn("Does devel == user?", rs.develBranchVersion.String(), rs.userBranchVersion.String())
+ if rs.develBranchVersion.String() != rs.userBranchVersion.String() {
log.Warn("devel does not equal user")
log.Warn("merge or squash?")
rs.EnableMergeDevel()
@@ -253,8 +254,8 @@ func (rs *RepoStatus) recommend() {
rs.develMerge.SetText(label)
return
}
- log.Warn("Does master == devel? ", rs.masterBranchVersion.Get(), rs.develBranchVersion.Get())
- if rs.masterBranchVersion.Get() != rs.develBranchVersion.Get() {
+ log.Warn("Does master == devel? ", rs.masterBranchVersion.String(), rs.develBranchVersion.String())
+ if rs.masterBranchVersion.String() != rs.develBranchVersion.String() {
log.Warn("master does not equal devel. merge devel into master")
rs.EnableMergeDevel()
rs.setMergeDevelCommands()
@@ -263,7 +264,7 @@ func (rs *RepoStatus) recommend() {
return
}
rs.getLastTagVersion()
- if rs.lasttag.Get() != rs.masterBranchVersion.Get() {
+ if rs.lasttag.String() != rs.masterBranchVersion.String() {
log.Warn("master does not equal last tag")
rs.incrementVersion()
rs.EnableSelectTag()
@@ -289,12 +290,12 @@ func (rs *RepoStatus) generateCmd() bool {
log.Warn("tag is valid!!!!")
rs.setGitCommands()
- if rs.versionMessage.Get() == "" {
+ if rs.versionMessage.String() == "" {
log.Warn("tag message is empty!!!!")
rs.releaseVersion.Disable()
return false
}
- if len(rs.versionMessage.Get()) > 24 {
+ if len(rs.versionMessage.String()) > 24 {
rs.versionMessage.SetLabel("tag message (too long)")
} else {
rs.versionMessage.SetLabel("tag message")
@@ -326,8 +327,8 @@ func (rs *RepoStatus) setGitCommands() {
var line1, line2, line3 []string
var all [][]string
- newTag := rs.newversion.GetText()
- line1 = append(line1, "git", "tag", "v" + newTag, "-m", rs.versionMessage.Get())
+ newTag := rs.newversion.String()
+ line1 = append(line1, "git", "tag", "v" + newTag, "-m", rs.versionMessage.String())
all = append(all, line1)
line2 = append(line2, "git", "push", "--tags")
all = append(all, line2)
@@ -344,7 +345,7 @@ func (rs *RepoStatus) setGitCommands() {
tmp = append(tmp, s)
}
- rs.versionCmdOutput.Set(strings.Join(tmp, "\n"))
+ rs.versionCmdOutput.SetText(strings.Join(tmp, "\n"))
}
func (rs *RepoStatus) setMergeDevelCommands() {
@@ -371,7 +372,7 @@ func (rs *RepoStatus) setMergeDevelCommands() {
tmp = append(tmp, s)
}
- rs.versionCmdOutput.Set(strings.Join(tmp, "\n"))
+ rs.versionCmdOutput.SetText(strings.Join(tmp, "\n"))
}
func (rs *RepoStatus) setMergeUserCommands() {
@@ -398,5 +399,5 @@ func (rs *RepoStatus) setMergeUserCommands() {
tmp = append(tmp, s)
}
- rs.versionCmdOutput.Set(strings.Join(tmp, "\n"))
+ rs.versionCmdOutput.SetText(strings.Join(tmp, "\n"))
}