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-01-20 16:09:15 -06:00
|
|
|
"go.wit.com/lib/gui/logsettings"
|
2024-02-19 22:00:58 -06:00
|
|
|
"go.wit.com/lib/gui/repolist"
|
2024-01-31 01:36:54 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-16 11:14:30 -06:00
|
|
|
)
|
|
|
|
|
2024-02-19 22:00:58 -06:00
|
|
|
func showHideRepos(repo *repolist.Repo) {
|
2024-02-20 14:44:38 -06:00
|
|
|
if repo.GoPath() == "go.wit.com/dev/alexflint/arg" {
|
|
|
|
log.Info("found autoHideReleased() =", me.autoHideReleased.Checked())
|
|
|
|
log.Info("found alexflint/arg IsReleased() =", repo.Status.IsReleased())
|
|
|
|
}
|
2024-02-19 22:00:58 -06:00
|
|
|
// always show dirty repos
|
|
|
|
if repo.IsDirty() {
|
|
|
|
repo.Show()
|
|
|
|
return
|
|
|
|
}
|
2024-02-20 14:44:38 -06:00
|
|
|
// always show repos that have not been merged ?
|
2024-02-19 22:00:58 -06:00
|
|
|
if repo.GoState() == "merge to devel" {
|
|
|
|
repo.Show()
|
|
|
|
return
|
|
|
|
}
|
2024-02-19 14:40:21 -06:00
|
|
|
|
2024-02-19 22:00:58 -06:00
|
|
|
// hide read-only repos. These are repos that do not
|
|
|
|
// match things in the users config file (.config/autotypist)
|
|
|
|
if me.autoHideReadOnly.Checked() {
|
|
|
|
if repo.Status.ReadOnly() {
|
|
|
|
repo.Hide()
|
|
|
|
return
|
2024-01-25 13:09:33 -06:00
|
|
|
}
|
2024-02-19 22:00:58 -06:00
|
|
|
}
|
2024-02-20 14:44:38 -06:00
|
|
|
if me.autoHideReleased.Checked() {
|
|
|
|
if repo.Status.IsReleased() {
|
2024-02-20 06:53:07 -06:00
|
|
|
repo.Hide()
|
|
|
|
return
|
2024-01-25 13:09:33 -06:00
|
|
|
}
|
|
|
|
}
|
2024-02-20 06:53:07 -06:00
|
|
|
repo.Show()
|
2024-01-25 13:09:33 -06:00
|
|
|
}
|
|
|
|
|
2024-01-16 11:14:30 -06:00
|
|
|
func globalDisplayOptions(box *gui.Node) {
|
2024-01-20 17:17:48 -06:00
|
|
|
vbox := box.NewVerticalBox("DISPLAYVBOX")
|
2024-01-16 11:14:30 -06:00
|
|
|
|
2024-01-20 17:17:48 -06:00
|
|
|
group1 := vbox.NewGroup("Global Display Options")
|
|
|
|
|
2024-02-19 19:42:14 -06:00
|
|
|
hidegrid := group1.NewGrid("hidecfg", 0, 0)
|
|
|
|
|
|
|
|
hidegrid.NewButton("Show Repository Window", func() {
|
2024-02-18 15:09:04 -06:00
|
|
|
if me.repos.Hidden() {
|
|
|
|
me.repos.Show()
|
2024-02-11 18:58:52 -06:00
|
|
|
} else {
|
2024-02-18 15:09:04 -06:00
|
|
|
me.repos.Hide()
|
2024-02-11 18:58:52 -06:00
|
|
|
}
|
2024-02-18 15:09:04 -06:00
|
|
|
log.Info("showing reposwin")
|
2024-01-17 01:55:22 -06:00
|
|
|
})
|
2024-02-19 19:42:14 -06:00
|
|
|
hidegrid.NextRow()
|
2024-01-20 16:09:15 -06:00
|
|
|
|
2024-02-19 19:42:14 -06:00
|
|
|
me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true)
|
2024-02-20 14:44:38 -06:00
|
|
|
// me.autoHideReadOnly.Custom = func() {
|
|
|
|
// log.Info("registered hide function to globalDisplayShow()")
|
|
|
|
// me.repos.View.RegisterHideFunction(globalDisplayShow)
|
|
|
|
// }
|
2024-02-19 19:42:14 -06:00
|
|
|
hidegrid.NextRow()
|
2024-01-25 02:40:59 -06:00
|
|
|
|
2024-02-20 14:44:38 -06:00
|
|
|
me.autoHideReleased = hidegrid.NewCheckbox("Hide Released repos").SetChecked(true)
|
2024-02-19 19:42:14 -06:00
|
|
|
hidegrid.NextRow()
|
|
|
|
|
|
|
|
me.ignoreWhitelist = hidegrid.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
|
|
|
|
hidegrid.NextRow()
|
2024-02-11 19:10:18 -06:00
|
|
|
|
2024-02-19 19:42:14 -06:00
|
|
|
me.scanEveryMinute = hidegrid.NewCheckbox("Scan every minute").SetChecked(false)
|
2024-02-20 14:44:38 -06:00
|
|
|
me.scanEveryMinute.Custom = func() {
|
|
|
|
me.repos.View.SetAutoScan(me.scanEveryMinute.Checked())
|
|
|
|
}
|
2024-02-19 19:42:14 -06:00
|
|
|
hidegrid.NewButton("scan now", func() {
|
|
|
|
log.Info("re-scanning repos now")
|
|
|
|
i, s := me.repos.View.ScanRepositories()
|
|
|
|
log.Info("re-scanning repos done", i, s)
|
2024-02-20 14:44:38 -06:00
|
|
|
// me.duration.SetText(s)
|
2024-02-19 19:42:14 -06:00
|
|
|
})
|
2024-02-20 14:44:38 -06:00
|
|
|
me.duration = me.repos.View.MirrorScanDuration()
|
|
|
|
hidegrid.Append(me.duration)
|
|
|
|
|
2024-02-19 19:42:14 -06:00
|
|
|
hidegrid.NextRow()
|
2024-01-31 01:36:54 -06:00
|
|
|
|
2024-02-20 14:44:38 -06:00
|
|
|
group1 = vbox.NewGroup("prep for release")
|
2024-02-19 19:42:14 -06:00
|
|
|
grid := group1.NewGrid("test", 0, 0)
|
2024-01-16 11:14:30 -06:00
|
|
|
|
2024-01-31 02:27:17 -06:00
|
|
|
var longB *gui.Node
|
2024-02-20 20:42:54 -06:00
|
|
|
longB = grid.NewButton("generate go.sum files", func() {
|
2024-01-31 02:27:17 -06:00
|
|
|
me.Disable()
|
2024-02-20 14:44:38 -06:00
|
|
|
var worked bool = true
|
2024-02-18 15:09:04 -06:00
|
|
|
for _, repo := range me.repos.View.AllRepos() {
|
|
|
|
if whitelist(repo.GoPath()) {
|
2024-01-31 02:27:17 -06:00
|
|
|
continue
|
|
|
|
}
|
2024-02-20 14:44:38 -06:00
|
|
|
ok, err := me.repos.View.CheckValidGoSum(repo)
|
2024-02-20 06:53:07 -06:00
|
|
|
if !ok {
|
|
|
|
log.Info("redo go.sum failed on", repo.GoPath(), err)
|
2024-02-20 14:44:38 -06:00
|
|
|
worked = false
|
2024-02-01 13:30:26 -06:00
|
|
|
}
|
2024-01-31 02:27:17 -06:00
|
|
|
}
|
2024-02-20 14:44:38 -06:00
|
|
|
log.Info("redo go.sum finished with", worked)
|
2024-01-31 02:27:17 -06:00
|
|
|
me.Enable()
|
2024-02-20 14:44:38 -06:00
|
|
|
longB.SetLabel("go.sum files created")
|
|
|
|
if worked {
|
|
|
|
longB.Disable()
|
2024-01-31 01:36:54 -06:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2024-02-20 14:44:38 -06:00
|
|
|
me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
|
2024-01-31 02:27:17 -06:00
|
|
|
me.Disable()
|
2024-02-20 14:44:38 -06:00
|
|
|
defer me.Enable()
|
|
|
|
if setAllBranchesToMaster() {
|
|
|
|
// if it succeeds, disable this button
|
|
|
|
me.setBranchesToMasterB.Disable()
|
2024-01-31 01:36:54 -06:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2024-02-19 19:42:14 -06:00
|
|
|
grid.NextRow()
|
2024-02-05 19:27:19 -06:00
|
|
|
|
2024-01-20 17:17:48 -06:00
|
|
|
group2 := vbox.NewGroup("Debugger")
|
2024-02-19 19:42:14 -06:00
|
|
|
dbggrid := group2.NewGrid("gdb", 0, 0)
|
|
|
|
dbggrid.NewButton("logging Window", func() {
|
2024-01-20 16:09:15 -06:00
|
|
|
logsettings.LogWindow()
|
|
|
|
})
|
2024-02-19 19:42:14 -06:00
|
|
|
dbggrid.NextRow()
|
2024-01-20 17:17:48 -06:00
|
|
|
|
2024-02-19 19:42:14 -06:00
|
|
|
dbggrid.NewButton("Debugger Window", func() {
|
2024-01-20 17:17:48 -06:00
|
|
|
debugger.DebugWindow()
|
|
|
|
})
|
2024-01-16 11:14:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func hidePerfect() {
|
2024-02-18 15:09:04 -06:00
|
|
|
for _, repo := range me.repos.View.AllRepos() {
|
|
|
|
if repo.State() == "PERFECT" {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|