reorg buttons

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-07 13:04:25 -06:00
parent a0147a9f4f
commit 3d4e297db9
4 changed files with 129 additions and 63 deletions

View File

@ -8,6 +8,7 @@ import (
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/lib/debugger" "go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/logsettings" "go.wit.com/lib/gui/logsettings"
"go.wit.com/log" "go.wit.com/log"
// "go.wit.com/gui/gadgets" // "go.wit.com/gui/gadgets"
@ -102,45 +103,25 @@ func globalDisplayOptions(box *gui.Node) {
fmt.Fprintln(f, ")") fmt.Fprintln(f, ")")
}) })
group1.NewButton("list all tags", func() { var tagsW *tagWindow
me.autotypistWindow.Disable() group1.NewButton("tag Window", func() {
defer me.autotypistWindow.Enable() if tagsW == nil {
for _, repo := range me.allrepos { tagsW = makeTagWindow()
tagsW := repo.status.TagsW } else {
if tagsW == nil { tagsW.win.Toggle()
repo.status.TagWindow()
tagsW = repo.status.TagsW
// tagsW.Prune()
continue
}
allTags := tagsW.ListAll()
for _, t := range allTags {
log.Info("found tag:", t.TagString(), "from", repo.status.String())
}
} }
}) })
group1.NewButton("delete all dup tags", func() { var listallB *gui.Node
me.autotypistWindow.Disable() var listW *gadgets.BasicWindow
defer me.autotypistWindow.Enable() listallB = group1.NewButton("go.wit.com Window", func() {
for _, repo := range me.allrepos { listallB.Disable()
tagsW := repo.status.TagsW if listW == nil {
if tagsW == nil { listW = listWindow()
repo.status.TagWindow() } else {
tagsW = repo.status.TagsW listW.Toggle()
tagsW.PruneSmart()
continue
}
deleteTags := tagsW.List()
for _, t := range deleteTags {
if me.autoDryRun.Checked() {
log.Info("delete tag --dry-run:", t.TagString(), "from", repo.status.String())
} else {
log.Info("Deleting tag:", t.TagString(), "from", repo.status.String())
// tagsW.Delete(t)
}
}
} }
listallB.Enable()
}) })
group2 := vbox.NewGroup("Debugger") group2 := vbox.NewGroup("Debugger")

View File

@ -10,7 +10,22 @@ import (
func globalResetOptions(box *gui.Node) { func globalResetOptions(box *gui.Node) {
group2 := box.NewGroup("Global Destructive Options") group2 := box.NewGroup("Global Destructive Options")
globalTestingOptions(group2)
me.autoRebuildButton = group2.NewButton("rebuild autotypist", func() {
me.autoRebuildButton.Disable()
me.autoRebuildButton.SetLabel("running....")
attemptAutoRebuild()
me.autoRebuildButton.Enable()
me.autoRebuildButton.SetLabel("rebuild autotypist")
})
me.stopOnErrors = group2.NewCheckbox("Stop on errors")
me.stopOnErrors.SetChecked(true)
me.autoDryRun = group2.NewCheckbox("autotypist --dry-run")
me.autoDryRun.SetChecked(true)
buildOptions := group2.NewGrid("buildOptions", 2, 1) buildOptions := group2.NewGrid("buildOptions", 2, 1)
buildOptions.NewLabel("start over") buildOptions.NewLabel("start over")
@ -38,31 +53,6 @@ func globalResetOptions(box *gui.Node) {
}) })
} }
// things being testing
func globalTestingOptions(box *gui.Node) {
var listallB *gui.Node
listallB = box.NewButton("go.wit.com/list", func() {
listallB.Disable()
listWindow()
listallB.Enable()
})
me.autoRebuildButton = box.NewButton("rebuild autotypist", func() {
me.autoRebuildButton.Disable()
me.autoRebuildButton.SetLabel("running....")
attemptAutoRebuild()
me.autoRebuildButton.Enable()
me.autoRebuildButton.SetLabel("rebuild autotypist")
})
me.stopOnErrors = box.NewCheckbox("Stop on errors")
me.stopOnErrors.SetChecked(true)
me.autoDryRun = box.NewCheckbox("autotypist --dry-run")
me.autoDryRun.SetChecked(true)
}
func attemptAutoRebuild() { func attemptAutoRebuild() {
os.Setenv("GO111MODULE", "off") os.Setenv("GO111MODULE", "off")

View File

@ -41,10 +41,10 @@ type section struct {
witRepos []*witRepo witRepos []*witRepo
} }
func listWindow() { func listWindow() *gadgets.BasicWindow {
if lw != nil { if lw != nil {
lw.Toggle() lw.Toggle()
return return lw
} }
lw = gadgets.NewBasicWindow(me.myGui, "go.wit.com repositories") lw = gadgets.NewBasicWindow(me.myGui, "go.wit.com repositories")
lw.Custom = func() { lw.Custom = func() {
@ -89,6 +89,7 @@ func listWindow() {
} }
} }
// lw.Toggle() // lw.Toggle()
return lw
} }
func downloadRepo(path string) bool { func downloadRepo(path string) bool {

94
tagWindow.go Normal file
View File

@ -0,0 +1,94 @@
// This is a simple example
package main
import (
"go.wit.com/gui"
"go.wit.com/log"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repostatus"
)
var tagW *tagWindow
type tagWindow struct {
win *gadgets.BasicWindow
box *gui.Node
grid *gui.Node
group *gui.Node
allTags []*gitTag
}
type gitTag struct {
rs *repostatus.RepoStatus
hidden bool
}
func makeTagWindow() *tagWindow {
if tagW != nil {
tagW.win.Toggle()
return tagW
}
tagW = new(tagWindow)
tagW.win = gadgets.NewBasicWindow(me.myGui, "git tag tasks")
tagW.win.Custom = func() {
log.Warn("got to close")
}
tagW.win.Make()
tagW.win.StandardClose()
tagW.win.Draw()
tagW.box = tagW.win.Box()
tagW.group = tagW.box.NewGroup("tags")
tagW.group.NewButton("list tags", func() {
// dumpVersions()
})
tagW.group.NewButton("list all tags", func() {
me.autotypistWindow.Disable()
defer me.autotypistWindow.Enable()
for _, repo := range me.allrepos {
tagsW := repo.status.TagsW
if tagsW == nil {
repo.status.TagWindow()
tagsW = repo.status.TagsW
// tagsW.Prune()
continue
}
allTags := tagsW.ListAll()
for _, t := range allTags {
log.Info("found tag:", t.TagString(), "from", repo.status.String())
}
}
})
tagW.group.NewButton("delete all dup tags", func() {
me.autotypistWindow.Disable()
defer me.autotypistWindow.Enable()
for _, repo := range me.allrepos {
tagsW := repo.status.TagsW
if tagsW == nil {
repo.status.TagWindow()
tagsW = repo.status.TagsW
tagsW.PruneSmart()
continue
}
deleteTags := tagsW.List()
for _, t := range deleteTags {
if me.autoDryRun.Checked() {
log.Info("delete tag --dry-run:", t.TagString(), "from", repo.status.String())
} else {
log.Info("Deleting tag:", t.TagString(), "from", repo.status.String())
// tagsW.Delete(t)
}
}
}
})
return tagW
}
func (t *gitTag) Hide() {
t.hidden = true
}