133 lines
2.5 KiB
Go
133 lines
2.5 KiB
Go
package main
|
|
|
|
import (
|
|
"go.wit.com/gui"
|
|
"go.wit.com/lib/debugger"
|
|
"go.wit.com/lib/gui/gowit"
|
|
"go.wit.com/lib/gui/logsettings"
|
|
"go.wit.com/lib/gui/repolist"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
func globalDisplaySetRepoState() {
|
|
for _, repo := range repolist.AllRepos() {
|
|
if repo.IsDirty() {
|
|
repo.Show()
|
|
continue
|
|
}
|
|
if me.autoHideReadOnly.Checked() {
|
|
if repo.ReadOnly() {
|
|
repo.Hide()
|
|
continue
|
|
}
|
|
}
|
|
if me.autoHidePerfect.Checked() {
|
|
if repo.IsPerfect() {
|
|
repo.Hide()
|
|
continue
|
|
}
|
|
}
|
|
repo.Show()
|
|
}
|
|
}
|
|
|
|
func globalDisplayShow() {
|
|
for _, repo := range repolist.AllRepos() {
|
|
if me.autoHideReadOnly.Checked() {
|
|
if repo.ReadOnly() {
|
|
continue
|
|
}
|
|
}
|
|
if me.autoHidePerfect.Checked() {
|
|
if repo.IsPerfect() {
|
|
continue
|
|
}
|
|
}
|
|
repo.Show()
|
|
}
|
|
}
|
|
|
|
func globalDisplayOptions(vbox *gui.Node) {
|
|
group1 := vbox.NewGroup("Global Display Options")
|
|
|
|
group1.NewButton("Show Repository Window", func() {
|
|
globalDisplaySetRepoState()
|
|
if me.repoView.Hidden() {
|
|
me.repoView.Show()
|
|
} else {
|
|
me.repoView.Hide()
|
|
}
|
|
})
|
|
|
|
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
|
|
me.autoHideReadOnly.Custom = func() {
|
|
if me.autoHideReadOnly.Checked() {
|
|
globalDisplaySetRepoState()
|
|
} else {
|
|
globalDisplayShow()
|
|
}
|
|
}
|
|
|
|
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
|
|
me.autoHidePerfect.Custom = func() {
|
|
if me.autoHidePerfect.Checked() {
|
|
globalDisplaySetRepoState()
|
|
} else {
|
|
globalDisplayShow()
|
|
}
|
|
}
|
|
scanbox := group1.Box().Horizontal()
|
|
me.autoScanReposCB = scanbox.NewCheckbox("auto scan").SetChecked(true)
|
|
scanbox.NewButton("scan now", func() {
|
|
log.Info("re-scanning repos now")
|
|
repolist.ScanRepositories()
|
|
})
|
|
me.duration = scanbox.NewLabel("")
|
|
|
|
var tagsW *tagWindow
|
|
group1.NewButton("git tags Window", func() {
|
|
if tagsW == nil {
|
|
tagsW = makeTagWindow()
|
|
} else {
|
|
tagsW.win.Toggle()
|
|
}
|
|
})
|
|
|
|
var listallB *gui.Node
|
|
listallB = group1.NewButton("go.wit.com", func() {
|
|
listallB.Disable()
|
|
if me.lw == nil {
|
|
me.lw = gowit.ListWindow()
|
|
}
|
|
if me.lw.Hidden() {
|
|
me.lw.Show()
|
|
} else {
|
|
me.lw.Hide()
|
|
}
|
|
listallB.Enable()
|
|
})
|
|
}
|
|
|
|
func debuggerBox(vbox *gui.Node) {
|
|
group2 := vbox.NewGroup("Debugger")
|
|
group2.NewButton("logging Window", func() {
|
|
logsettings.LogWindow()
|
|
})
|
|
|
|
group2.NewButton("Debugger Window", func() {
|
|
debugger.DebugWindow()
|
|
})
|
|
}
|
|
|
|
func hidePerfect() {
|
|
for _, repo := range repolist.AllRepos() {
|
|
if repo.IsPerfect() {
|
|
if repo.Hidden() {
|
|
continue
|
|
}
|
|
repo.Hide()
|
|
// return
|
|
}
|
|
}
|
|
}
|