87 lines
1.6 KiB
Go
87 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"embed"
|
|
"time"
|
|
|
|
"go.wit.com/lib/debugger"
|
|
"go.wit.com/log"
|
|
|
|
"go.wit.com/gui"
|
|
)
|
|
|
|
//go:embed resources/*
|
|
var resToolkit embed.FS
|
|
|
|
func main() {
|
|
me = new(autoType)
|
|
me.allrepos = make(map[string]*repo)
|
|
|
|
me.myGui = gui.New()
|
|
me.myGui.InitEmbed(resToolkit)
|
|
me.myGui.Default()
|
|
|
|
me.autotypistWindow = me.myGui.NewWindow("autotypist: it types faster than you can.")
|
|
me.mainbox = me.autotypistWindow.NewBox("bw hbox", true)
|
|
|
|
vbox1 := me.mainbox.NewVerticalBox("BOX1")
|
|
globalDisplayOptions(vbox1)
|
|
docsBox(vbox1)
|
|
if debugger.ArgDebug() {
|
|
debuggerBox(vbox1)
|
|
}
|
|
// disable the interface while everything is scanned
|
|
me.Disable()
|
|
|
|
vbox2 := me.mainbox.NewVerticalBox("BOX2")
|
|
globalBuildOptions(vbox2)
|
|
me.summary = submitPatchesBox(vbox2)
|
|
|
|
globalResetOptions(me.mainbox)
|
|
|
|
repolistWindow()
|
|
|
|
// process everything on the command line
|
|
handleCmdLine()
|
|
|
|
for _, repo := range me.allrepos {
|
|
repo.status.Update()
|
|
repo.newScan()
|
|
}
|
|
me.Enable()
|
|
|
|
// processing is done. update the repo summary box
|
|
me.summary.Update()
|
|
|
|
// scan repos every 30 seconds
|
|
// check every second for the checkbox changing
|
|
var i int = 60
|
|
myTicker(1*time.Second, "newScan()", func() {
|
|
i += 1
|
|
if !me.scanEveryMinute.Checked() {
|
|
if i < 60 {
|
|
i = 60
|
|
}
|
|
// print every 13 seconds
|
|
if i%13 == 0 {
|
|
log.Info("Not auto scanning", i)
|
|
}
|
|
return
|
|
}
|
|
if i < 60 {
|
|
return
|
|
}
|
|
i = 0
|
|
timeFunction(func() {
|
|
// scanGoSum()
|
|
for _, repo := range me.allrepos {
|
|
repo.newScan()
|
|
}
|
|
})
|
|
/*
|
|
s := fmt.Sprint(duration)
|
|
// me.autoWorkingPwd.SetText(s)
|
|
*/
|
|
})
|
|
}
|