156 lines
3.7 KiB
Go
156 lines
3.7 KiB
Go
package main
|
|
|
|
import (
|
|
"go.wit.com/gui"
|
|
"go.wit.com/lib/debugger"
|
|
"go.wit.com/lib/gui/logsettings"
|
|
"go.wit.com/lib/gui/repolist"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
func showHideRepos(repo *repolist.Repo) {
|
|
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())
|
|
}
|
|
// always show dirty repos
|
|
if repo.IsDirty() {
|
|
repo.Show()
|
|
return
|
|
}
|
|
// always show repos that have not been merged ?
|
|
if repo.GoState() == "merge to devel" {
|
|
repo.Show()
|
|
return
|
|
}
|
|
|
|
// 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
|
|
}
|
|
}
|
|
if me.autoHideReleased.Checked() {
|
|
if repo.Status.IsReleased() {
|
|
repo.Hide()
|
|
return
|
|
}
|
|
}
|
|
repo.Show()
|
|
}
|
|
|
|
func globalDisplayOptions(box *gui.Node) {
|
|
vbox := box.NewVerticalBox("DISPLAYVBOX")
|
|
|
|
group1 := vbox.NewGroup("Global Display Options")
|
|
|
|
hidegrid := group1.NewGrid("hidecfg", 0, 0)
|
|
|
|
hidegrid.NewButton("Show Repository Window", func() {
|
|
if me.repos.Hidden() {
|
|
me.repos.Show()
|
|
} else {
|
|
me.repos.Hide()
|
|
}
|
|
log.Info("showing reposwin")
|
|
})
|
|
hidegrid.NextRow()
|
|
|
|
me.autoHideReadOnly = hidegrid.NewCheckbox("Hide read-only repos").SetChecked(true)
|
|
// me.autoHideReadOnly.Custom = func() {
|
|
// log.Info("registered hide function to globalDisplayShow()")
|
|
// me.repos.View.RegisterHideFunction(globalDisplayShow)
|
|
// }
|
|
hidegrid.NextRow()
|
|
|
|
me.autoHideReleased = hidegrid.NewCheckbox("Hide Released repos").SetChecked(true)
|
|
hidegrid.NextRow()
|
|
|
|
me.ignoreWhitelist = hidegrid.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
|
|
hidegrid.NextRow()
|
|
|
|
me.scanEveryMinute = hidegrid.NewCheckbox("Scan every minute").SetChecked(false)
|
|
me.scanEveryMinute.Custom = func() {
|
|
me.repos.View.SetAutoScan(me.scanEveryMinute.Checked())
|
|
}
|
|
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)
|
|
// me.duration.SetText(s)
|
|
})
|
|
me.duration = me.repos.View.MirrorScanDuration()
|
|
hidegrid.Append(me.duration)
|
|
|
|
hidegrid.NextRow()
|
|
|
|
group1 = vbox.NewGroup("prep for release")
|
|
grid := group1.NewGrid("test", 0, 0)
|
|
|
|
var longB *gui.Node
|
|
longB = grid.NewButton("generate go.sum files", func() {
|
|
me.Disable()
|
|
var worked bool = true
|
|
for _, repo := range me.repos.View.AllRepos() {
|
|
if whitelist(repo.GoPath()) {
|
|
continue
|
|
}
|
|
ok, err := me.repos.View.CheckValidGoSum(repo)
|
|
if !ok {
|
|
log.Info("redo go.sum failed on", repo.GoPath(), err)
|
|
worked = false
|
|
}
|
|
}
|
|
log.Info("redo go.sum finished with", worked)
|
|
me.Enable()
|
|
longB.SetLabel("go.sum files created")
|
|
if worked {
|
|
longB.Disable()
|
|
}
|
|
})
|
|
|
|
me.setBranchesToMasterB = grid.NewButton("set all branches to master", func() {
|
|
me.Disable()
|
|
defer me.Enable()
|
|
if setAllBranchesToMaster() {
|
|
// if it succeeds, disable this button
|
|
me.setBranchesToMasterB.Disable()
|
|
}
|
|
})
|
|
grid.NextRow()
|
|
|
|
var setTarget *gui.Node
|
|
// check to see if target versions need to be changed
|
|
setTarget = grid.NewButton("increment target versions", func() {
|
|
if incrementTargetVersion() {
|
|
setTarget.SetText("DONE")
|
|
}
|
|
})
|
|
grid.NextRow()
|
|
|
|
group2 := vbox.NewGroup("Debugger")
|
|
dbggrid := group2.NewGrid("gdb", 0, 0)
|
|
dbggrid.NewButton("logging Window", func() {
|
|
logsettings.LogWindow()
|
|
})
|
|
dbggrid.NextRow()
|
|
|
|
dbggrid.NewButton("Debugger Window", func() {
|
|
debugger.DebugWindow()
|
|
})
|
|
}
|
|
|
|
func hidePerfect() {
|
|
for _, repo := range me.repos.View.AllRepos() {
|
|
if repo.State() == "PERFECT" {
|
|
if repo.Hidden() {
|
|
continue
|
|
}
|
|
repo.Hide()
|
|
// return
|
|
}
|
|
}
|
|
}
|