guireleaser/globalDisplayOptions.go

109 lines
2.1 KiB
Go

// This is a simple example
package main
import (
"go.wit.com/log"
"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.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 me.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 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 (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
}