start cleaning up the buttons

This commit is contained in:
Jeff Carr 2024-02-19 19:42:14 -06:00
parent 84115c2712
commit 8df9f47a23
4 changed files with 70 additions and 45 deletions

View File

@ -68,7 +68,9 @@ func globalDisplayOptions(box *gui.Node) {
group1 := vbox.NewGroup("Global Display Options")
group1.NewButton("Show Repository Window", func() {
hidegrid := group1.NewGrid("hidecfg", 0, 0)
hidegrid.NewButton("Show Repository Window", func() {
if me.repos.Hidden() {
me.repos.Show()
} else {
@ -83,8 +85,9 @@ func globalDisplayOptions(box *gui.Node) {
// double check the found next repo
// fullDoubleCheckFix()
})
hidegrid.NextRow()
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() {
if me.autoHideReadOnly.Checked() {
showHideRepos()
@ -92,8 +95,9 @@ func globalDisplayOptions(box *gui.Node) {
globalDisplayShow()
}
}
hidegrid.NextRow()
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect = hidegrid.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() {
showHideRepos()
@ -101,8 +105,9 @@ func globalDisplayOptions(box *gui.Node) {
globalDisplayShow()
}
}
hidegrid.NextRow()
me.autoReleased = group1.NewCheckbox("Hide RELEASED repos").SetChecked(false)
me.autoReleased = hidegrid.NewCheckbox("Hide RELEASED repos").SetChecked(false)
me.autoReleased.Custom = func() {
if me.autoReleased.Checked() {
for _, repo := range me.repos.View.AllRepos() {
@ -116,12 +121,28 @@ func globalDisplayOptions(box *gui.Node) {
}
}
}
hidegrid.NextRow()
me.ignoreWhitelist = group1.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
me.ignoreWhitelist = hidegrid.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
hidegrid.NextRow()
me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false)
me.scanEveryMinute = hidegrid.NewCheckbox("Scan every minute").SetChecked(false)
hidegrid.NewButton("scan now", func() {
log.Info("re-scanning repos now")
i, s := me.repos.View.ScanRepositories()
log.Info("re-scanning repos done", i, s)
me.duration.SetText(s)
})
me.duration = hidegrid.NewLabel("")
hidegrid.NextRow()
me.setBranchesToMasterB = group1.NewButton("set all branches to master", func() {
grid := group1.NewGrid("test", 0, 0)
grid.NewButton("git checkout master", func() {
setBranchToMaster()
})
me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
me.Disable()
for _, repo := range me.repos.View.AllRepos() {
if repo.Status.ReadOnly() {
@ -145,7 +166,7 @@ func globalDisplayOptions(box *gui.Node) {
})
var longB *gui.Node
longB = group1.NewButton("redo go.sum", func() {
longB = grid.NewButton("redo go.sum", func() {
os.Unsetenv("GO111MODULE")
longB.Disable()
me.Disable()
@ -170,7 +191,12 @@ func globalDisplayOptions(box *gui.Node) {
longB.Enable()
})
group1.NewButton("rm -f go.mod go.sum", func() {
grid.NewButton("set target version", func() {
setTargetVersion()
})
grid.NextRow()
grid.NewButton("rm -f go.mod go.sum", func() {
me.Disable()
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
@ -184,7 +210,7 @@ func globalDisplayOptions(box *gui.Node) {
me.Enable()
})
group1.NewButton("git reset --hard", func() {
grid.NewButton("git reset --hard", func() {
me.Disable()
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
@ -197,7 +223,7 @@ func globalDisplayOptions(box *gui.Node) {
me.Enable()
})
group1.NewButton("git ls-files |grep go.mod", func() {
grid.NewButton("git ls-files |grep go.mod", func() {
// var all []string
for _, repo := range me.repos.View.AllRepos() {
log.Info("repo:", repo.Name())
@ -239,29 +265,20 @@ func globalDisplayOptions(box *gui.Node) {
}
log.Info("All repos seem okay")
})
grid.NextRow()
group1.NewButton("git checkout master", func() {
setBranchToMaster()
})
group1.NewButton("set target version", func() {
setTargetVersion()
})
group1.NewButton("re-scan all repos", func() {
me.repos.View.ScanRepositories()
})
group1.NewButton("scanForReady()", func() {
grid.NewButton("scanForReady()", func() {
scanForReady()
})
group2 := vbox.NewGroup("Debugger")
group2.NewButton("logging Window", func() {
dbggrid := group2.NewGrid("gdb", 0, 0)
dbggrid.NewButton("logging Window", func() {
logsettings.LogWindow()
})
dbggrid.NextRow()
group2.NewButton("Debugger Window", func() {
dbggrid.NewButton("Debugger Window", func() {
debugger.DebugWindow()
})
}

13
main.go
View File

@ -104,12 +104,15 @@ func main() {
// to the master branch
func setBranchToMaster() {
for _, repo := range me.repos.View.AllRepos() {
if whitelist(repo.GoPath()) {
continue
}
if repo.Status.CheckoutMaster() {
log.Warn("git checkout master branch worked", repo.Name())
} else {
log.Warn("git checkout master branch failed", repo.Name())
}
repo.NewScan()
// repo.NewScan()
}
}
@ -122,13 +125,13 @@ func setTargetVersion() {
// set the version for a path, it's set in stone forever. (smart system!)
// we could rename go.wit.com/widget to go.wit.com/newwidget and restart the versioning
// system, but that's rediculous and this servers to always remind me to never make this mistake again
var count int
for i, repo := range me.repos.View.AllRepos() {
if repo == nil {
log.Info("initial scan i = nil", i)
log.Info("initial scan repo = nil", i)
continue
}
log.Info("initial scan repo", repo.Name())
if repo.Status == nil {
log.Info("repo.status == nil", repo.Name())
continue
@ -143,6 +146,8 @@ func setTargetVersion() {
lasttag := repo.Status.GetLastTagVersion()
repo.Status.SetTargetVersion(lasttag)
}
repo.NewScan()
// repo.NewScan()
count += 1
}
log.Info("target versions set for", count, "repos")
}

View File

@ -76,17 +76,18 @@ func createReleaseBox(box *gui.Node) {
me.Enable()
})
release.grid.NewButton("findNextDirty()", func() {
me.Disable()
defer me.Enable()
if findNextDirty("PRIMATIVE") {
log.Info("findNextDirty() found a repo")
return
}
if findNextDirty("") {
log.Info("findNextDirty() found a repo")
return
}
me.Disable()
defer me.Enable()
if findNextDirty("PRIMATIVE") {
log.Info("findNextDirty() found a repo")
return
}
if findNextDirty("") {
log.Info("findNextDirty() found a repo")
return
}
})
release.grid.NextRow()
release.releaseVersionB = release.grid.NewButton("release version", func() {
buttonDisable()
@ -97,14 +98,13 @@ func createReleaseBox(box *gui.Node) {
log.Info("doRelease() failed")
}
})
release.openrepo = release.grid.NewButton("open repo", func() {
release.current.Status.Toggle()
})
release.openrepo.Disable()
release.grid.NextRow()
release.repo = gadgets.NewOneLiner(release.grid, "repo")
release.openrepo = release.grid.NewButton("Configure", func() {
release.current.Status.Toggle()
})
release.openrepo.Disable()
release.grid.NextRow()
release.status = gadgets.NewOneLiner(release.grid, "status")
release.grid.NextRow()

View File

@ -76,6 +76,9 @@ type autoType struct {
// button to set all repo branches to master
setBranchesToMasterB *gui.Node
// show the time it took to do a scan
duration *gui.Node
}
func (my *autoType) GoSrcPath() string {