summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doGui.go83
-rw-r--r--getNextAutoTopic.go (renamed from doGetNextAutoTopic.go)2
-rw-r--r--main.go4
-rw-r--r--structs.go14
-rw-r--r--windowChats.go89
5 files changed, 183 insertions, 9 deletions
diff --git a/doGui.go b/doGui.go
new file mode 100644
index 0000000..157eed0
--- /dev/null
+++ b/doGui.go
@@ -0,0 +1,83 @@
+// 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/gadgets"
+ "go.wit.com/log"
+)
+
+func debug() {
+ time.Sleep(2 * time.Second)
+ for {
+ log.Printf("idle loop() 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")
+ me.mainWindow.Custom = func() {
+ log.Warn("MAIN WINDOW CLOSE")
+ os.Exit(0)
+ }
+
+ drawWindow(me.mainWindow)
+
+ // 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()
+ })
+}
+
+// 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
+}
diff --git a/doGetNextAutoTopic.go b/getNextAutoTopic.go
index 75060a7..70f4e13 100644
--- a/doGetNextAutoTopic.go
+++ b/getNextAutoTopic.go
@@ -7,7 +7,7 @@ import (
"go.wit.com/log"
)
-func doGetNextAutoTopic() {
+func getNextAutoTopic() {
max := 0
for _, chat := range me.chats.GetChats() {
if strings.HasPrefix(chat.GetChatName(), "Auto ") {
diff --git a/main.go b/main.go
index b2b58bb..709fb29 100644
--- a/main.go
+++ b/main.go
@@ -98,10 +98,10 @@ func main() {
okExit("")
}
- // doGui()
+ doGui()
// by default, start interacting with gemini-cli
- me.pp.WriteHelp(os.Stdout)
+ // me.pp.WriteHelp(os.Stdout)
okExit("")
}
diff --git a/structs.go b/structs.go
index f56498d..4de5abd 100644
--- a/structs.go
+++ b/structs.go
@@ -8,6 +8,7 @@ import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
+ "go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/chatpb"
"google.golang.org/genai"
)
@@ -16,10 +17,11 @@ var me *mainType
// this app's variables
type mainType struct {
- pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
- chats *chatpb.Chats // all our prior conversations with regex
- myGui *gui.Node // the gui toolkit handle
- client *genai.Client // the Google Gemini AI client variable
- ctx context.Context // global context. what does this acutally mean?
- lastChat *chatpb.Chat // the last chat. append to here
+ pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
+ chats *chatpb.Chats // all our prior conversations with regex
+ client *genai.Client // the Google Gemini AI client variable
+ ctx context.Context // global context. what does this acutally mean?
+ lastChat *chatpb.Chat // the last chat. append to here
+ myGui *gui.Node // the gui toolkit handle
+ mainWindow *gadgets.GenericWindow // the main GUI window
}
diff --git a/windowChats.go b/windowChats.go
new file mode 100644
index 0000000..d92b4ce
--- /dev/null
+++ b/windowChats.go
@@ -0,0 +1,89 @@
+// 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/lib/gadgets"
+ "go.wit.com/lib/protobuf/chatpb"
+ "go.wit.com/log"
+)
+
+/*
+type stdReposTableWin struct {
+ sync.Mutex
+ win *gadgets.GenericWindow // the machines gui window
+ boxTB *gui.Node // the machines gui parent box widget
+ TB *gitpb.ReposTable // the gui table buffer
+ pb *gitpb.Repos // the current repos protobuf
+ update bool // if the window should be updated
+}
+
+func (w *stdReposTableWin) Toggle() {
+ if w == nil {
+ return
+ }
+ if w.win == nil {
+ return
+ }
+ w.win.Toggle()
+}
+*/
+
+func makeChatsWindow() *gadgets.GenericWindow {
+ insertWin := gadgets.NewGenericWindow("regex Chats", "Display Chats")
+ insertWin.Win.Custom = func() {
+ log.Info("test delete window here")
+ }
+ grid := insertWin.Group.RawGrid()
+
+ var t *chatpb.ChatsTable
+ grid.NewButton("dirty", func() {
+ })
+
+ grid.NewButton("delete PB table", func() {
+ if t != nil {
+ t.Delete()
+ t = nil
+ log.Info("Table should have been deleted")
+ }
+ })
+ // display the protobuf
+ t = addChatsPB(insertWin, me.chats)
+ f := func(chat *chatpb.Chat) {
+ log.Info("got to ChatTable.Custom() id =", chat.GetUuid(), chat.GetChatName())
+ }
+ t.Custom(f)
+ log.Info("table has uuid", t.GetUuid())
+
+ return insertWin
+}
+
+func addChatsPB(win *gadgets.GenericWindow, pb *chatpb.Chats) *chatpb.ChatsTable {
+ t := pb.NewTable("testForgeRepos")
+ t.NewUuid()
+ tbox := win.Bottom.Box().SetProgName("TBOX")
+ t.SetParent(tbox)
+
+ sf := t.AddStringFunc("chat", func(r *chatpb.Chat) string {
+ return r.GetUuid()
+ })
+ sf.Custom = func(r *chatpb.Chat) {
+ log.Info("do button click on", r.GetUuid())
+ }
+ t.AddTimeFunc("age", func(chat *chatpb.Chat) time.Time {
+ return chat.GetCtime().AsTime()
+ })
+ t.AddChatName()
+ f := func(repo *chatpb.Chat) string {
+ log.Info("chat =", repo.GetUuid(), repo.GetChatName())
+ return repo.GetUuid()
+ }
+ t.AddButtonFunc("cur version", f)
+ t.ShowTable()
+ return t
+}