82 lines
1.5 KiB
Go
82 lines
1.5 KiB
Go
// This is a simple example
|
|
package main
|
|
|
|
import (
|
|
"embed"
|
|
"fmt"
|
|
"time"
|
|
|
|
"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.LoadToolkit("nocui")
|
|
me.myGui.Default()
|
|
|
|
autotypistWindow()
|
|
repoworld()
|
|
|
|
for _, repo := range me.allrepos {
|
|
repo.status.Update()
|
|
repo.newScan()
|
|
}
|
|
if release.win == nil {
|
|
log.Info("Creating the Release Window")
|
|
createReleaseWindow()
|
|
globalDisplaySetRepoState()
|
|
// open the repo window
|
|
reposwin.Toggle()
|
|
log.Info("Toggling the Release Window")
|
|
release.win.Toggle()
|
|
}
|
|
log.Info("Toggling the Release Window")
|
|
release.win.Toggle()
|
|
release.openrepo.Disable()
|
|
|
|
// 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
|
|
duration := timeFunction(func() {
|
|
scanGoSum()
|
|
for _, repo := range me.allrepos {
|
|
repo.newScan()
|
|
}
|
|
})
|
|
s := fmt.Sprint(duration)
|
|
me.autoWorkingPwd.SetText(s)
|
|
})
|
|
}
|
|
|
|
func autotypistWindow() {
|
|
win := me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.")
|
|
box := win.NewBox("bw hbox", true)
|
|
|
|
globalDisplayOptions(box)
|
|
}
|