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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
// 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 (
"fmt"
"os"
"time"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/logsettings"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
func debug() {
time.Sleep(2 * time.Second)
for {
log.Info("idle loop() todo: could check for things here")
time.Sleep(90 * time.Second)
}
}
func doGui() {
me.myGui = gui.New()
// me.myGui.SetAppDefaultPlugin(me.forge.Config.DefaultGui)
me.myGui.Default()
win := gadgets.NewGenericWindow("regex: a WIT Cloud private AI tool", "Current Conversations")
drawWindow(win)
win.Custom = func() {
log.Warn("MAIN WINDOW CLOSE")
me.myGui.StandardExit()
os.Exit(0)
}
me.mainWindow = win
// sits here forever
debug()
}
func drawWindow(win *gadgets.GenericWindow) {
grid := win.Group.RawGrid()
grid.NewLabel("label worked")
grid.NextRow()
var insertWin *gadgets.GenericWindow
s := fmt.Sprintf("Show Chat Entries (%d)", me.chats.Len())
grid.NewButton(s, func() {
// if the window exists, just toggle it open or closed
if insertWin != nil {
insertWin.Toggle()
return
}
insertWin = makeChatsWindow()
})
grid.NewButton("simple hello", func() {
err := simpleHello()
if err != nil {
badExit(err)
}
})
grid.NewButton("submit question", func() {
doEditorOnce()
})
grid.NewButton("print playback", func() {
shell.RunVerbose([]string{"regex", "playback"})
})
grid.NewButton("clean", func() {
doClean()
})
grid.NextRow()
grid.NewButton("debugger", func() {
debugger.DebugWindow()
})
grid.NewButton("logging", func() {
logsettings.LogWindow()
})
}
// old things before they are removed, deprecated, fixed, etc
func makeOldStuff() *gadgets.GenericWindow {
oldWin := gadgets.NewGenericWindow("old code", "old code on it's way out")
grid := oldWin.Group.RawGrid()
grid.NewButton("Release Window", func() {
log.Info("todo: move releaser here")
})
return oldWin
}
|