94 lines
1.8 KiB
Go
94 lines
1.8 KiB
Go
// 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/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()
|
|
|
|
me.mainWindow = gadgets.NewGenericWindow("regex: a WIT Cloud private AI tool", "Current Conversations")
|
|
|
|
drawWindow(me.mainWindow)
|
|
|
|
me.mainWindow.Custom = func() {
|
|
log.Warn("MAIN WINDOW CLOSE")
|
|
os.Exit(0)
|
|
}
|
|
|
|
// 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()
|
|
})
|
|
|
|
var oldWin *gadgets.GenericWindow
|
|
grid.NewButton("old", func() {
|
|
if oldWin != nil {
|
|
oldWin.Toggle()
|
|
return
|
|
}
|
|
oldWin = makeOldStuff()
|
|
})
|
|
|
|
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
|
|
}
|