autotypist/globalDisplayOptions.go

111 lines
2.1 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.NewButton("Show Repository Window", func () {
reposwin.Draw()
})
me.autoHidePerfect = groupvbox.NewCheckbox("Hide repos")
me.autoHidePerfect.Custom = func() {
me.autoHidePerfect.SetText("Hide Perfectly clean repos")
if me.autoHidePerfect.Bool() {
log.Warn("Should hide here")
} else {
log.Warn("Should show here")
}
}
me.autoHidePerfect.Set(true)
groupvbox.NewButton("hide perfect", func () {
me.autoHidePerfect.SetText("Hide Perfectly clean repos")
hidePerfect()
})
groupvbox.NewButton("show all", func () {
for _, repo := range allrepos {
if repo.dirtyLabel.String() == "PERFECT" {
if repo.hidden {
repo.show()
}
// return
}
}
})
groupvbox.NewButton("reposwin.Hide()", func () {
reposwin.Hide()
})
groupvbox.NewButton("reposwin.Show()", func () {
reposwin.Show()
})
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("repoworld()", func () {
repoworld()
})
}
func hidePerfect() {
for _, repo := range allrepos {
if repo.dirtyLabel.String() == "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
}