autotypist/globalDisplayOptions.go

95 lines
2.1 KiB
Go
Raw Normal View History

package main
import (
2024-02-25 13:09:56 -06:00
"os"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/gowit"
"go.wit.com/lib/gui/logsettings"
2024-02-16 17:55:53 -06:00
"go.wit.com/log"
)
func globalDisplayOptions(vbox *gui.Node) {
group1 := vbox.NewGroup("Global Display Options")
group1.NewButton("Show Repository Window", func() {
2024-02-19 19:41:48 -06:00
// globalDisplaySetRepoState()
2024-02-17 14:20:37 -06:00
if me.repos.Hidden() {
me.repos.Show()
2024-02-17 08:38:44 -06:00
} else {
2024-02-17 14:20:37 -06:00
me.repos.Hide()
2024-02-17 08:38:44 -06:00
}
})
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() {
2024-02-25 13:09:56 -06:00
if me.autoHideReadOnly.Checked() {
os.Setenv("AUTOTYPIST_READONLY", "hide")
} else {
os.Unsetenv("AUTOTYPIST_READONLY")
}
}
2024-02-25 18:37:03 -06:00
os.Setenv("AUTOTYPIST_READONLY", "hide")
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() {
2024-02-25 13:09:56 -06:00
if me.autoHideReadOnly.Checked() {
os.Setenv("AUTOTYPIST_CLEAN", "hide")
} else {
os.Unsetenv("AUTOTYPIST_CLEAN")
}
}
2024-02-25 18:37:03 -06:00
os.Setenv("AUTOTYPIST_CLEAN", "hide")
2024-02-16 17:55:53 -06:00
scanbox := group1.Box().Horizontal()
me.autoScanReposCB = scanbox.NewCheckbox("auto scan").SetChecked(true)
2024-02-17 14:20:37 -06:00
me.autoScanReposCB.Custom = func() {
2024-02-25 13:09:56 -06:00
if me.autoScanReposCB.Checked() {
os.Setenv("REPO_AUTO_SCAN", "true")
} else {
os.Unsetenv("REPO_AUTO_SCAN")
}
2024-02-17 14:20:37 -06:00
}
2024-02-25 13:09:56 -06:00
os.Setenv("REPO_AUTO_SCAN", "true")
2024-02-16 17:55:53 -06:00
scanbox.NewButton("scan now", func() {
log.Info("re-scanning repos now")
2024-02-18 07:24:56 -06:00
i, s := me.repos.View.ScanRepositories()
log.Info("re-scanning repos done", i, s)
2024-02-16 17:55:53 -06:00
})
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 {
2024-02-18 15:08:49 -06:00
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()
})
}