summaryrefslogtreecommitdiff
path: root/main.go
blob: 1c83220a24847992bb0aef202c52daedb43c77e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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()

	// 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)
		*/
	})
}