summaryrefslogtreecommitdiff
path: root/doGui.go
diff options
context:
space:
mode:
Diffstat (limited to 'doGui.go')
-rw-r--r--doGui.go75
1 files changed, 75 insertions, 0 deletions
diff --git a/doGui.go b/doGui.go
new file mode 100644
index 0000000..24ec444
--- /dev/null
+++ b/doGui.go
@@ -0,0 +1,75 @@
+// 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/fhelp"
+ "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() {
+ if me.forge.Config.GetDefaultGui() == "" {
+ me.forge.Config.DefaultGui = "gocui"
+ me.forge.ConfigSave()
+ }
+ me.myGui = gui.New()
+ me.myGui.InitEmbed(resources)
+ me.myGui.SetAppDefaultPlugin(me.forge.Config.DefaultGui) // sets the default GUI plugin to use
+ if pname, err := me.myGui.Default(); err != nil {
+ if !fhelp.BuildPlugin("gocui") {
+ log.Info("You can't run the forge GUI since the plugins did not build", pname)
+ okExit("")
+ } else {
+ if err := me.myGui.LoadToolkitNew("gocui"); err != nil {
+ log.Info("The plugins built, but still failed to load", pname)
+ badExit(err)
+ }
+ log.Info("The plugins built and loaded!", pname)
+ }
+ }
+
+ 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)
+
+ // sits here forever
+ debug()
+}
+
+func drawWindow(win *gadgets.GenericWindow) {
+ grid := win.Group.RawGrid()
+
+ grid.NewButton("stats", func() {
+ doList()
+ })
+}