autotypist/globalDisplayOptions.go

98 lines
2.2 KiB
Go

package main
import (
"os"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/gowit"
"go.wit.com/lib/gui/logsettings"
"go.wit.com/log"
)
func globalDisplayOptions(vbox *gui.Node) {
group1 := vbox.NewGroup("Global Display Options")
group1.NewButton("Show Repository Window", func() {
// globalDisplaySetRepoState()
if me.repos.Hidden() {
me.repos.Show()
} else {
me.repos.Hide()
}
})
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() {
if me.autoHideReadOnly.Checked() {
os.Setenv("AUTOTYPIST_READONLY", "hide")
} else {
os.Unsetenv("AUTOTYPIST_READONLY")
}
}
os.Setenv("AUTOTYPIST_READONLY", "hide")
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() {
if me.autoHideReadOnly.Checked() {
os.Setenv("AUTOTYPIST_CLEAN", "hide")
} else {
os.Unsetenv("AUTOTYPIST_CLEAN")
}
}
os.Setenv("AUTOTYPIST_CLEAN", "hide")
scanbox := group1.Box().Horizontal()
me.autoScanReposCB = scanbox.NewCheckbox("auto scan").SetChecked(true)
me.autoScanReposCB.Custom = func() {
if me.autoScanReposCB.Checked() {
os.Setenv("REPO_AUTO_SCAN", "true")
log.Info("env REPO_AUTO_SCAN=", os.Getenv("REPO_AUTO_SCAN"))
} else {
os.Unsetenv("REPO_AUTO_SCAN")
log.Info("env REPO_AUTO_SCAN=", os.Getenv("REPO_AUTO_SCAN"))
}
}
os.Setenv("REPO_AUTO_SCAN", "true")
scanbox.NewButton("scan now", func() {
log.Info("re-scanning now")
i, s := me.repos.View.ScanRepositories()
log.Info("re-scanning done", i, "repos in", s)
})
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("Download Apps", func() {
listallB.Disable()
if me.lw == nil {
me.lw = gowit.ListWindow(me.repos.View)
}
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()
})
}