add Global Display Options

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-16 11:14:30 -06:00
parent a85b161d64
commit 0dd8cd9dea
5 changed files with 96 additions and 37 deletions

View File

@ -52,7 +52,6 @@ func globalBuildOptions(box *gui.Node) {
setCurrentBranch.Set("set all branches to " + me.toMoveToBranch)
me.mainBranch.Disable()
}
setCurrentBranch = groupvbox.NewButton("set all branches to", func () {
for _, repo := range allrepos {
var changeBranch [][]string
@ -106,39 +105,4 @@ func globalBuildOptions(box *gui.Node) {
})
groupvbox.NewButton("build all apps", func () {
})
groupvbox.NewButton("status.Update() all", func () {
for _, repo := range allrepos {
repo.status.Update()
}
})
groupvbox.NewButton("rescan all", func () {
for _, repo := range allrepos {
repo.newScan()
}
})
groupvbox.NewButton("hide perfect", func () {
for _, repo := range allrepos {
if repo.dirtyLabel.GetText() == "PERFECT" {
repo.hide()
}
return
}
})
}
func (r *repo) hide() {
r.pLabel.Hide()
r.lastTag.Hide()
r.vLabel.Hide()
r.masterName.Hide()
r.masterVersion.Hide()
r.develName.Hide()
r.develVersion.Hide()
r.userName.Hide()
r.userVersion.Hide()
r.dirtyLabel.Hide()
}

88
globalDisplayOptions.go Normal file
View File

@ -0,0 +1,88 @@
// This is a simple example
package main
import (
// "go.wit.com/log"
"go.wit.com/gui/gui"
// "go.wit.com/gui/gadgets"
)
func globalDisplayOptions(box *gui.Node) {
group1 := box.NewGroup("Global Display Options")
groupvbox := group1.NewBox("bw vbox", false)
// grouphbox := groupvbox.NewBox("bw hbox", true)
groupvbox.NewLabel("Display Perfectly clean repos")
me.autoHidePerfect = groupvbox.NewCheckbox("Hide repos")
groupvbox.NewButton("show all", func () {
for _, repo := range allrepos {
if repo.dirtyLabel.GetText() == "PERFECT" {
if repo.hidden {
repo.show()
}
// return
}
}
})
groupvbox.NewButton("hide perfect", func () {
hidePerfect()
})
groupvbox.NewButton("status.Update() all", func () {
for _, repo := range allrepos {
repo.status.Update()
}
})
groupvbox.NewButton("rescan all", func () {
for _, repo := range allrepos {
repo.newScan()
}
})
}
func hidePerfect() {
for _, repo := range allrepos {
if repo.dirtyLabel.GetText() == "PERFECT" {
if repo.hidden {
continue
}
repo.hide()
// return
}
}
}
func (r *repo) hide() {
r.pLabel.Hide()
r.lastTag.Hide()
r.vLabel.Hide()
r.masterName.Hide()
r.masterVersion.Hide()
r.develName.Hide()
r.develVersion.Hide()
r.userName.Hide()
r.userVersion.Hide()
r.dirtyLabel.Hide()
r.showButton.Hide()
r.hidden = true
}
func (r *repo) show() {
r.pLabel.Show()
r.lastTag.Show()
r.vLabel.Show()
r.masterName.Show()
r.masterVersion.Show()
r.develName.Show()
r.develVersion.Show()
r.userName.Show()
r.userVersion.Show()
r.dirtyLabel.Show()
r.showButton.Show()
r.hidden = false
}

View File

@ -21,6 +21,8 @@ func main() {
myGui.Default()
repoworld()
log.Sleep(.3)
hidePerfect()
gui.Watchdog()
}
@ -47,7 +49,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
newRepo.dirtyLabel = grid.NewLabel("")
grid.NewButton("Show()", func () {
newRepo.showButton = grid.NewButton("Show()", func () {
if newRepo.status == nil {
log.Warn("status window doesn't exist")
return
@ -64,6 +66,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
newRepo.status.SetMasterName(master)
newRepo.status.SetDevelName(devel)
newRepo.status.SetUserName(user)
newRepo.hidden = false
newRepo.status.Update()
newRepo.newScan()
allrepos = append(allrepos, newRepo)
@ -104,6 +107,7 @@ func repoworld() {
box2 := reposwin.Box().NewBox("bw vbox", false)
globalDisplayOptions(box2)
globalBuildOptions(box2)
globalResetOptions(box2)

View File

@ -19,6 +19,7 @@ var me repoType
type repoType struct {
script [][]string
toMoveToBranch string // what the current working branch name is
autoHidePerfect *gui.Node
mainBranch *gadgets.BasicCombobox
develBranch *gadgets.BasicCombobox
@ -32,6 +33,7 @@ var dryrun *gui.Node
var allrepos []*repo
type repo struct {
hidden bool
path string
lasttagrev string
lasttag string
@ -53,6 +55,7 @@ type repo struct {
cButton *gui.Node // commit button
pButton *gui.Node // push button
showButton *gui.Node // the button!
status *repostatus.RepoStatus
}