2024-01-16 11:14:30 -06:00
|
|
|
package main
|
|
|
|
|
2024-01-18 00:58:14 -06:00
|
|
|
import (
|
2024-01-18 05:03:04 -06:00
|
|
|
"go.wit.com/gui"
|
2024-01-20 17:17:48 -06:00
|
|
|
"go.wit.com/lib/debugger"
|
2024-02-13 09:18:04 -06:00
|
|
|
"go.wit.com/lib/gui/gowit"
|
2024-01-20 16:09:15 -06:00
|
|
|
"go.wit.com/lib/gui/logsettings"
|
2024-02-17 08:38:44 -06:00
|
|
|
"go.wit.com/lib/gui/repolist"
|
2024-02-16 17:55:53 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-16 11:14:30 -06:00
|
|
|
)
|
|
|
|
|
2024-01-26 09:34:42 -06:00
|
|
|
func globalDisplaySetRepoState() {
|
2024-02-17 08:38:44 -06:00
|
|
|
for _, repo := range repolist.AllRepos() {
|
2024-02-17 15:47:46 -06:00
|
|
|
if repo.Status.IsDirty() {
|
2024-02-16 20:37:23 -06:00
|
|
|
repo.Show()
|
|
|
|
continue
|
|
|
|
}
|
2024-01-25 13:09:33 -06:00
|
|
|
if me.autoHideReadOnly.Checked() {
|
2024-02-17 15:47:46 -06:00
|
|
|
if repo.Status.ReadOnly() {
|
2024-01-25 13:09:33 -06:00
|
|
|
repo.Hide()
|
2024-01-26 09:34:42 -06:00
|
|
|
continue
|
2024-01-25 13:09:33 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if me.autoHidePerfect.Checked() {
|
2024-02-17 08:38:44 -06:00
|
|
|
if repo.IsPerfect() {
|
2024-01-25 13:09:33 -06:00
|
|
|
repo.Hide()
|
2024-01-26 09:34:42 -06:00
|
|
|
continue
|
2024-01-25 13:09:33 -06:00
|
|
|
}
|
|
|
|
}
|
2024-01-26 09:34:42 -06:00
|
|
|
repo.Show()
|
2024-01-25 13:09:33 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func globalDisplayShow() {
|
2024-02-17 08:38:44 -06:00
|
|
|
for _, repo := range repolist.AllRepos() {
|
2024-01-25 13:09:33 -06:00
|
|
|
if me.autoHideReadOnly.Checked() {
|
2024-02-17 15:47:46 -06:00
|
|
|
if repo.Status.ReadOnly() {
|
2024-01-25 13:09:33 -06:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if me.autoHidePerfect.Checked() {
|
2024-02-17 08:38:44 -06:00
|
|
|
if repo.IsPerfect() {
|
2024-01-25 13:09:33 -06:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repo.Show()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-12 15:24:35 -06:00
|
|
|
func globalDisplayOptions(vbox *gui.Node) {
|
2024-01-20 17:17:48 -06:00
|
|
|
group1 := vbox.NewGroup("Global Display Options")
|
|
|
|
|
|
|
|
group1.NewButton("Show Repository Window", func() {
|
2024-01-26 09:34:42 -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
|
|
|
}
|
2024-01-17 01:55:22 -06:00
|
|
|
})
|
2024-01-20 16:09:15 -06:00
|
|
|
|
2024-01-25 02:40:59 -06:00
|
|
|
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
|
2024-01-25 11:11:43 -06:00
|
|
|
me.autoHideReadOnly.Custom = func() {
|
2024-01-25 02:50:16 -06:00
|
|
|
if me.autoHideReadOnly.Checked() {
|
2024-01-26 09:34:42 -06:00
|
|
|
globalDisplaySetRepoState()
|
2024-01-25 13:09:33 -06:00
|
|
|
} else {
|
|
|
|
globalDisplayShow()
|
2024-01-25 02:50:16 -06:00
|
|
|
}
|
|
|
|
}
|
2024-01-25 02:40:59 -06:00
|
|
|
|
2024-01-30 13:09:24 -06:00
|
|
|
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
|
2024-01-20 16:09:15 -06:00
|
|
|
me.autoHidePerfect.Custom = func() {
|
|
|
|
if me.autoHidePerfect.Checked() {
|
2024-01-26 09:34:42 -06:00
|
|
|
globalDisplaySetRepoState()
|
2024-01-20 16:09:15 -06:00
|
|
|
} else {
|
2024-01-25 13:09:33 -06:00
|
|
|
globalDisplayShow()
|
2024-01-16 11:14:30 -06:00
|
|
|
}
|
2024-01-20 16:09:15 -06:00
|
|
|
}
|
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() {
|
|
|
|
me.repos.View.SetAutoScan(me.autoScanReposCB.Checked())
|
|
|
|
}
|
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)
|
|
|
|
me.duration.SetText(s)
|
2024-02-16 17:55:53 -06:00
|
|
|
})
|
|
|
|
me.duration = scanbox.NewLabel("")
|
2024-01-16 11:56:55 -06:00
|
|
|
|
2024-02-07 13:04:25 -06:00
|
|
|
var tagsW *tagWindow
|
2024-02-13 09:18:04 -06:00
|
|
|
group1.NewButton("git tags Window", func() {
|
2024-02-07 13:04:25 -06:00
|
|
|
if tagsW == nil {
|
|
|
|
tagsW = makeTagWindow()
|
|
|
|
} else {
|
|
|
|
tagsW.win.Toggle()
|
2024-02-06 17:48:15 -06:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2024-02-07 13:04:25 -06:00
|
|
|
var listallB *gui.Node
|
2024-02-13 09:18:04 -06:00
|
|
|
listallB = group1.NewButton("go.wit.com", func() {
|
2024-02-07 13:04:25 -06:00
|
|
|
listallB.Disable()
|
2024-02-13 09:18:04 -06:00
|
|
|
if me.lw == nil {
|
2024-02-18 15:08:49 -06:00
|
|
|
me.lw = gowit.ListWindow(me.repos.View)
|
2024-02-13 09:18:04 -06:00
|
|
|
}
|
|
|
|
if me.lw.Hidden() {
|
|
|
|
me.lw.Show()
|
2024-02-07 13:04:25 -06:00
|
|
|
} else {
|
2024-02-13 09:18:04 -06:00
|
|
|
me.lw.Hide()
|
2024-02-06 17:48:15 -06:00
|
|
|
}
|
2024-02-07 13:04:25 -06:00
|
|
|
listallB.Enable()
|
2024-02-06 17:48:15 -06:00
|
|
|
})
|
2024-02-12 15:24:35 -06:00
|
|
|
}
|
2024-02-06 17:48:15 -06:00
|
|
|
|
2024-02-12 15:24:35 -06:00
|
|
|
func debuggerBox(vbox *gui.Node) {
|
2024-01-20 17:17:48 -06:00
|
|
|
group2 := vbox.NewGroup("Debugger")
|
|
|
|
group2.NewButton("logging Window", func() {
|
2024-01-20 16:09:15 -06:00
|
|
|
logsettings.LogWindow()
|
|
|
|
})
|
2024-01-20 17:17:48 -06:00
|
|
|
|
|
|
|
group2.NewButton("Debugger Window", func() {
|
|
|
|
debugger.DebugWindow()
|
|
|
|
})
|
2024-01-16 11:14:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func hidePerfect() {
|
2024-02-17 08:38:44 -06:00
|
|
|
for _, repo := range repolist.AllRepos() {
|
|
|
|
if repo.IsPerfect() {
|
|
|
|
if repo.Hidden() {
|
2024-01-16 11:14:30 -06:00
|
|
|
continue
|
|
|
|
}
|
2024-01-19 18:37:27 -06:00
|
|
|
repo.Hide()
|
2024-01-16 11:14:30 -06:00
|
|
|
// return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|