autotypist/globalDisplayOptions.go

71 lines
1.3 KiB
Go

// This is a simple example
package main
import (
"go.wit.com/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.NewButton("Show Repository Window", func() {
// repoworld()
reposwin.Toggle()
})
me.autoHidePerfect = groupvbox.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() {
hidePerfect()
} else {
showAll()
}
}
groupvbox.NewButton("show all", func() {
for repo, _ := range me.allrepos {
if repo.dirtyLabel.String() == "PERFECT" {
if repo.hidden {
repo.Show()
}
// return
}
}
})
groupvbox.NewButton("status.Update() all", func() {
for repo, _ := range me.allrepos {
repo.status.Update()
}
})
groupvbox.NewButton("rescan all", func() {
for repo, _ := range me.allrepos {
repo.newScan()
}
})
}
func hidePerfect() {
for repo, _ := range me.allrepos {
if repo.dirtyLabel.String() == "PERFECT" {
if repo.hidden {
continue
}
repo.Hide()
// return
}
}
}
func showAll() {
for repo, _ := range me.allrepos {
if repo.hidden {
repo.Show()
repo.hidden = false
}
}
}