summaryrefslogtreecommitdiff
path: root/doGui.go
diff options
context:
space:
mode:
Diffstat (limited to 'doGui.go')
-rw-r--r--doGui.go89
1 files changed, 85 insertions, 4 deletions
diff --git a/doGui.go b/doGui.go
index 6d0dcc9..d80e53c 100644
--- a/doGui.go
+++ b/doGui.go
@@ -4,6 +4,8 @@ package main
import (
"os"
+ "os/user"
+ "path/filepath"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
@@ -51,13 +53,13 @@ func doGui() {
vbox2 := me.mainbox.NewVerticalBox("BOX2")
globalBuildOptions(vbox2)
- me.summary = submitPatchesBox(vbox2)
+ // me.summary = submitPatchesBox(vbox2)
me.repos = makeRepoView()
// processing is done. update the repo summary box
- me.summary.Update()
- me.summary.submitB.Disable()
+ // me.summary.Update()
+ // me.summary.submitB.Disable()
me.Enable()
@@ -65,6 +67,85 @@ func doGui() {
me.repos.View.Watchdog(func() {
log.Info("Watchdog in doGui()")
// processing is done. update the repo summary box
- me.summary.Update()
+ // me.summary.Update()
+ })
+}
+
+func globalBuildOptions(vbox *gui.Node) {
+ group1 := vbox.NewGroup("Forge Settings")
+ grid := group1.NewGrid("buildOptions", 0, 0)
+
+ // me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
+ me.userHomePwd = gadgets.NewOneLiner(grid, "user home")
+ grid.NextRow()
+ me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home")
+ grid.NextRow()
+
+ usr, _ := user.Current()
+ homeDir, err := os.UserHomeDir()
+ if err != nil {
+ log.Warn("Error getting home directory:", err)
+ homeDir = "/home/autotypist"
+ }
+ me.userHomePwd.SetText(homeDir)
+ srcDir := filepath.Join(homeDir, "go/src")
+ me.goSrcPwd.SetText(srcDir)
+
+ // use ENV GIT_AUTHOR
+ me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author")
+ grid.NextRow()
+
+ if os.Getenv("GIT_AUTHOR_NAME") == "" {
+ me.gitAuthor.SetText("ENV GIT_AUTHOR_NAME is unset")
+ } else {
+ author := os.Getenv("GIT_AUTHOR_NAME")
+ author += " <" + os.Getenv("GIT_AUTHOR_EMAIL") + ">"
+ me.gitAuthor.SetText(author)
+ }
+
+ // select the branch you want to test, build and develop against
+ // this lets you select your user branch, but, when you are happy
+ // you can merge everything into the devel branch and make sure it actually
+ // works. Then, when that is good, merge and version everything in master
+ me.setBranchB = grid.NewButton("set current branch to:", func() {
+ targetName := me.newBranch.String()
+ log.Warn("setting all branches to", targetName)
+ if targetName == "devel" {
+ if err := doAllCheckoutDevel(); err != nil {
+ log.Info("switching to devel branches failed")
+ }
+ return
+ }
+ if targetName == "master" {
+ if err := doAllCheckoutMaster(); err != nil {
+ log.Info("switching to master branches failed")
+ }
+ return
+ }
+ // just assume user
+ if err := doAllCheckoutUser(); err != nil {
+ log.Info("switching to user branches failed")
+ }
+ })
+ me.newBranch = grid.NewCombobox()
+ me.newBranch.AddText("master")
+ me.newBranch.AddText("devel")
+ me.newBranch.AddText(usr.Username)
+ me.newBranch.SetText(usr.Username)
+
+ // checking this will automatically make the branches off of devel
+ me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
+ grid.NextRow()
+
+ grid.NewButton("Repo Window", func() {
+ if me.repos.Hidden() {
+ me.repos.Show()
+ } else {
+ me.repos.Hide()
+ }
+ })
+ grid.NewButton("Patches Window", func() {
+ me.patchWin.once.Do(me.patchWin.initWindow)
+ me.patchWin.Toggle()
})
}