more button cleanups
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
d67ace479a
commit
5f382cd5e3
|
@ -3,12 +3,10 @@ package main
|
|||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
)
|
||||
|
@ -56,12 +54,9 @@ func quickCmd(fullpath string, cmd []string) bool {
|
|||
}
|
||||
|
||||
func globalBuildOptions(box *gui.Node) {
|
||||
var setCurrentBranch *gui.Node
|
||||
group1 := box.NewGroup("Global Build Options")
|
||||
groupvbox := group1.NewBox("bw vbox", false)
|
||||
// grouphbox := groupvbox.NewBox("bw hbox", true)
|
||||
|
||||
grid := groupvbox.NewGrid("buildOptions", 2, 1)
|
||||
vbox := box.NewVerticalBox("DISPLAYVBOX")
|
||||
group1 := vbox.NewGroup("Global Build Options")
|
||||
grid := group1.NewGrid("buildOptions", 2, 1)
|
||||
|
||||
me.mainBranch = gadgets.NewBasicCombobox(grid, "default main branch")
|
||||
me.mainBranch.AddText("guimain")
|
||||
|
@ -78,17 +73,23 @@ func globalBuildOptions(box *gui.Node) {
|
|||
// 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
|
||||
guiBranch := gadgets.NewBasicCombobox(grid, "Set Current Working Branch")
|
||||
guiBranch.AddText("guimaster")
|
||||
guiBranch.AddText("guidevel")
|
||||
guiBranch.AddText("jcarr")
|
||||
guiBranch.Custom = func() {
|
||||
me.toMoveToBranch = guiBranch.String()
|
||||
setCurrentBranch.SetLabel("set all branches to " + me.toMoveToBranch)
|
||||
me.mainBranch.Disable()
|
||||
}
|
||||
var newBranch *gui.Node
|
||||
grid.NewButton("set all branches to", func() {
|
||||
log.Warn("set all branches to:", newBranch.String())
|
||||
/*
|
||||
me.toMoveToBranch = guiBranch.String()
|
||||
setCurrentBranch.SetLabel("set all branches to " + me.toMoveToBranch)
|
||||
me.mainBranch.Disable()
|
||||
*/
|
||||
})
|
||||
newBranch = grid.NewCombobox()
|
||||
newBranch.AddText("guimaster")
|
||||
newBranch.AddText("guidevel")
|
||||
newBranch.AddText("jcarr")
|
||||
newBranch.SetText("jcarr")
|
||||
|
||||
groupvbox.NewButton("git status", func() {
|
||||
group2 := vbox.NewGroup("Run in every git repository")
|
||||
group2.NewButton("git status", func() {
|
||||
quickCmdDoNotRun = false
|
||||
quickCmdLastPath = "~/go/src"
|
||||
quickCmds = [][]string{}
|
||||
|
@ -99,105 +100,17 @@ func globalBuildOptions(box *gui.Node) {
|
|||
}
|
||||
})
|
||||
|
||||
groupvbox.NewButton("rebuild autotypist", func() {
|
||||
os.Setenv("GO111MODULE", "off")
|
||||
quickCmdDoNotRun = true
|
||||
quickCmdLastPath = "~/go/src"
|
||||
quickCmds = [][]string{}
|
||||
log.Warn("scanning allrepos")
|
||||
fullpath := "/home/jcarr/"
|
||||
quickCmd(fullpath, []string{"mkdir", "-p", "/home/jcarr/go/src/go.wit.com/apps/"})
|
||||
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/apps/"
|
||||
quickCmd(fullpath, []string{"go", "get", "go.wit.com/apps/autotypist"})
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist"
|
||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/debian"})
|
||||
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/debian"
|
||||
quickCmd(fullpath, []string{"make", "download"})
|
||||
quickCmd(fullpath, []string{"make"})
|
||||
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist"
|
||||
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
||||
quickCmd(fullpath, []string{"go", "build", "-v", "-x"})
|
||||
me.script = quickCmds
|
||||
setGitCommands()
|
||||
me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() {
|
||||
log.Info("TODO: remove them")
|
||||
})
|
||||
|
||||
me.rerunGoMod = groupvbox.NewButton("remove all go.mod and go.sum", func() {
|
||||
quickCmdDoNotRun = false
|
||||
log.Warn("scanning allrepos")
|
||||
for _, path := range me.allrepos {
|
||||
fullpath := "/home/jcarr/go/src/" + path
|
||||
quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"})
|
||||
}
|
||||
})
|
||||
|
||||
me.rerunGoMod = groupvbox.NewButton("re-run go mod & go tidy", func() {
|
||||
me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() {
|
||||
quickCmdDoNotRun = false
|
||||
os.Unsetenv("GO111MODULE")
|
||||
log.Warn("scanning allrepos")
|
||||
for _, path := range me.allrepos {
|
||||
fullpath := "/home/jcarr/go/src/" + path
|
||||
quickCmd(fullpath, []string{"go", "mod", "init"})
|
||||
quickCmd(fullpath, []string{"go", "mod", "tidy"})
|
||||
}
|
||||
})
|
||||
|
||||
setCurrentBranch = groupvbox.NewButton("set all branches to", func() {
|
||||
log.Warn("scanning allrepos")
|
||||
for repo, path := range me.allrepos {
|
||||
log.Warn("found repo", repo.String())
|
||||
var changeBranch [][]string
|
||||
changeBranch = append(changeBranch, []string{"cd", "go/src/" + path})
|
||||
changeBranch = append(changeBranch, []string{"git", "checkout", me.toMoveToBranch})
|
||||
me.script = changeBranch
|
||||
setGitCommands()
|
||||
// goMake("--doit")
|
||||
}
|
||||
})
|
||||
var everything *gui.Node
|
||||
everything = groupvbox.NewButton("go get everything on go.wit.com", func() {
|
||||
quickCmdDoNotRun = false
|
||||
quickCmds = [][]string{}
|
||||
var perfect bool = true
|
||||
repos := myrepolist()
|
||||
for _, line := range repos {
|
||||
log.Warn("repo =", line)
|
||||
path, _, _, _ := splitLine(line)
|
||||
path = strings.TrimSpace(path)
|
||||
if path == "#" {
|
||||
// skip comment lines
|
||||
continue
|
||||
}
|
||||
if doesExist("/home/jcarr/go/src/" + path) {
|
||||
continue
|
||||
}
|
||||
// attempt to download it
|
||||
quickCmd("/home/jcarr/go/src/go.wit.com", []string{"go", "get", "-v", path})
|
||||
perfect = false
|
||||
}
|
||||
|
||||
if perfect {
|
||||
var notes [][]string
|
||||
notes = append(notes, []string{"you have already downloaded"})
|
||||
notes = append(notes, []string{"everything on go.wit.com"})
|
||||
me.script = notes
|
||||
setGitCommands()
|
||||
doit.Disable()
|
||||
everything.Disable()
|
||||
return
|
||||
}
|
||||
|
||||
me.script = quickCmds
|
||||
doit.Enable()
|
||||
setGitCommands()
|
||||
})
|
||||
groupvbox.NewButton("build all apps", func() {
|
||||
listWindow()
|
||||
})
|
||||
|
||||
groupvbox.NewButton("Debugger", func() {
|
||||
debugger.DebugWindow()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -3,31 +3,33 @@ package main
|
|||
|
||||
import (
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/lib/gui/logsettings"
|
||||
// "go.wit.com/gui/gadgets"
|
||||
)
|
||||
|
||||
func globalDisplayOptions(box *gui.Node) {
|
||||
group1 := box.NewGroup("Global Display Options")
|
||||
groupvbox := group1.NewBox("bw vbox", false)
|
||||
vbox := box.NewVerticalBox("DISPLAYVBOX")
|
||||
|
||||
groupvbox.NewButton("Show Repository Window", func() {
|
||||
group1 := vbox.NewGroup("Global Display Options")
|
||||
|
||||
group1.NewButton("Show Repository Window", func() {
|
||||
reposwin.Toggle()
|
||||
})
|
||||
/*
|
||||
groupvbox.NewButton("hide all", func() {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.Hide()
|
||||
}
|
||||
})
|
||||
groupvbox.NewButton("show all", func() {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.Show()
|
||||
}
|
||||
})
|
||||
group1.NewButton("hide all", func() {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.Hide()
|
||||
}
|
||||
})
|
||||
group1.NewButton("show all", func() {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.Show()
|
||||
}
|
||||
})
|
||||
*/
|
||||
|
||||
me.autoHidePerfect = groupvbox.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
|
||||
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
|
||||
me.autoHidePerfect.Custom = func() {
|
||||
if me.autoHidePerfect.Checked() {
|
||||
for repo, _ := range me.allrepos {
|
||||
|
@ -42,21 +44,26 @@ func globalDisplayOptions(box *gui.Node) {
|
|||
}
|
||||
}
|
||||
|
||||
groupvbox.NewButton("status.Update() all", func() {
|
||||
group1.NewButton("status.Update() all", func() {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.status.Update()
|
||||
}
|
||||
})
|
||||
|
||||
groupvbox.NewButton("rescan all", func() {
|
||||
group1.NewButton("rescan all", func() {
|
||||
for repo, _ := range me.allrepos {
|
||||
repo.newScan()
|
||||
}
|
||||
})
|
||||
|
||||
groupvbox.NewButton("logging enable/disable", func() {
|
||||
group2 := vbox.NewGroup("Debugger")
|
||||
group2.NewButton("logging Window", func() {
|
||||
logsettings.LogWindow()
|
||||
})
|
||||
|
||||
group2.NewButton("Debugger Window", func() {
|
||||
debugger.DebugWindow()
|
||||
})
|
||||
}
|
||||
|
||||
func hidePerfect() {
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
)
|
||||
|
||||
// things being testing
|
||||
func globalTestingOptions(box *gui.Node) {
|
||||
test1 := box.NewGroup("testing build")
|
||||
test1.NewButton("rebuild autotypist", func() {
|
||||
os.Setenv("GO111MODULE", "off")
|
||||
quickCmdDoNotRun = true
|
||||
quickCmdLastPath = "~/go/src"
|
||||
quickCmds = [][]string{}
|
||||
log.Warn("scanning allrepos")
|
||||
fullpath := "/home/jcarr/"
|
||||
quickCmd(fullpath, []string{"mkdir", "-p", "/home/jcarr/go/src/go.wit.com/apps/"})
|
||||
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/apps/"
|
||||
quickCmd(fullpath, []string{"go", "get", "go.wit.com/apps/autotypist"})
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist"
|
||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/debian"})
|
||||
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/debian"
|
||||
quickCmd(fullpath, []string{"make", "download"})
|
||||
quickCmd(fullpath, []string{"make"})
|
||||
|
||||
fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist"
|
||||
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
||||
quickCmd(fullpath, []string{"go", "build", "-v", "-x"})
|
||||
me.script = quickCmds
|
||||
setGitCommands()
|
||||
})
|
||||
|
||||
var everything *gui.Node
|
||||
everything = test1.NewButton("go get everything on go.wit.com", func() {
|
||||
quickCmdDoNotRun = false
|
||||
quickCmds = [][]string{}
|
||||
var perfect bool = true
|
||||
repos := myrepolist()
|
||||
for _, line := range repos {
|
||||
log.Warn("repo =", line)
|
||||
path, _, _, _ := splitLine(line)
|
||||
path = strings.TrimSpace(path)
|
||||
if path == "#" {
|
||||
// skip comment lines
|
||||
continue
|
||||
}
|
||||
if doesExist("/home/jcarr/go/src/" + path) {
|
||||
continue
|
||||
}
|
||||
// attempt to download it
|
||||
quickCmd("/home/jcarr/go/src/go.wit.com", []string{"go", "get", "-v", path})
|
||||
perfect = false
|
||||
}
|
||||
|
||||
if perfect {
|
||||
var notes [][]string
|
||||
notes = append(notes, []string{"you have already downloaded"})
|
||||
notes = append(notes, []string{"everything on go.wit.com"})
|
||||
me.script = notes
|
||||
setGitCommands()
|
||||
doit.Disable()
|
||||
everything.Disable()
|
||||
return
|
||||
}
|
||||
|
||||
me.script = quickCmds
|
||||
doit.Enable()
|
||||
setGitCommands()
|
||||
})
|
||||
test1.NewButton("build all apps", func() {
|
||||
listWindow()
|
||||
})
|
||||
}
|
15
main.go
15
main.go
|
@ -26,8 +26,9 @@ func main() {
|
|||
|
||||
autotypistWindow()
|
||||
repoworld()
|
||||
log.Sleep(.3)
|
||||
// hidePerfect()
|
||||
|
||||
// keeps the app alive
|
||||
// TODO: rescan the status of the repos every so often?
|
||||
gui.Watchdog()
|
||||
}
|
||||
|
||||
|
@ -78,18 +79,12 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
|||
}
|
||||
|
||||
func autotypistWindow() {
|
||||
/*
|
||||
me.autotypistWindow = gadgets.NewBasicWindow(me.myGui, "autotypist for GO & git. it types faster than you can.")
|
||||
me.autotypistWindow.Make()
|
||||
me.autotypistWindow.StandardExit()
|
||||
|
||||
box := me.autotypistWindow.Box()
|
||||
me.autotypistWindow.Draw()
|
||||
*/
|
||||
win := me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.")
|
||||
box := win.NewBox("bw hbox", true)
|
||||
|
||||
globalDisplayOptions(box)
|
||||
globalBuildOptions(box)
|
||||
globalTestingOptions(box)
|
||||
globalResetOptions(box)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue