summaryrefslogtreecommitdiff
path: root/doGui.go
blob: de7fd96d7f67e22939f443e1b57fd577eec0a5d9 (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
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

// An app to submit patches for the 30 GO GUI repos

import (
	"time"

	"go.wit.com/gui"
	"go.wit.com/lib/gadgets"
	"go.wit.com/lib/gui/shell"
	"go.wit.com/log"
)

func debug() {
	defer func() {
		if r := recover(); r != nil {
			gui.Crash(r, "forge debug()")
		}
	}()
	time.Sleep(2 * time.Second)
	for {
		now := time.Now()

		doList()

		log.Printf("finished a scan here in (%s)\n", shell.FormatDuration(time.Since(now)))
		time.Sleep(90 * time.Second)
	}
}

func doGui() {
	mainWindow := gadgets.NewGenericWindow("forged: forge.wit.com", "Current Settings")
	mainWindow.Custom = func() {
		log.Warn("MAIN WINDOW CLOSE")
		now := time.Now()
		log.Printf("rill repos.Reload() took (%s)\n", shell.FormatDuration(time.Since(now)))
		okExit("")
	}
	drawWindow(mainWindow)
}

func drawWindow(win *gadgets.GenericWindow) {
	grid := win.Group.RawGrid()

	grid.NewButton("stats", func() {
		doList()
	})
}