autotypist/globalDisplayOptions.go

89 lines
1.6 KiB
Go
Raw Normal View History

// 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
}