initial table dumps to STDOUT
This commit is contained in:
parent
5dadf3b5ef
commit
26d674c800
13
Makefile
13
Makefile
|
@ -24,6 +24,13 @@ regex: goimports
|
||||||
GO111MODULE=off go install \
|
GO111MODULE=off go install \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
|
CUI: install
|
||||||
|
regex --gui gocui
|
||||||
|
|
||||||
|
GTK: clean install
|
||||||
|
regex --gui andlabs
|
||||||
|
|
||||||
|
|
||||||
dumb-build:
|
dumb-build:
|
||||||
go install -v -x \
|
go install -v -x \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
@ -32,12 +39,6 @@ install-raw: goimports vet
|
||||||
go install \
|
go install \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
andlabs: clean install
|
|
||||||
regex --gui gocui --gui-verbose --gui-file ../../toolkits/andlabs/andlabs.so
|
|
||||||
|
|
||||||
gocui: install
|
|
||||||
regex --gui gocui --gui-verbose --gui-file ../../toolkits/gocui/gocui.so >/tmp/regex.log 2>&1
|
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
@# // to globally reset paths:
|
@# // to globally reset paths:
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
/*
|
||||||
|
enables GUI options and the debugger in your application
|
||||||
|
*/
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/lib/debugger"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if debugger.ArgDebug() {
|
||||||
|
log.Info("cmd line --debugger == true")
|
||||||
|
go func() {
|
||||||
|
log.Sleep(2)
|
||||||
|
debugger.DebugWindow()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
14
doGui.go
14
doGui.go
|
@ -11,7 +11,9 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
|
"go.wit.com/lib/debugger"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/lib/gui/logsettings"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,13 +31,14 @@ func doGui() {
|
||||||
me.myGui.Default()
|
me.myGui.Default()
|
||||||
|
|
||||||
me.mainWindow = gadgets.NewGenericWindow("regex: a WIT Cloud private AI tool", "Current Conversations")
|
me.mainWindow = gadgets.NewGenericWindow("regex: a WIT Cloud private AI tool", "Current Conversations")
|
||||||
|
|
||||||
|
drawWindow(me.mainWindow)
|
||||||
|
|
||||||
me.mainWindow.Custom = func() {
|
me.mainWindow.Custom = func() {
|
||||||
log.Warn("MAIN WINDOW CLOSE")
|
log.Warn("MAIN WINDOW CLOSE")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
drawWindow(me.mainWindow)
|
|
||||||
|
|
||||||
// sits here forever
|
// sits here forever
|
||||||
debug()
|
debug()
|
||||||
|
|
||||||
|
@ -67,6 +70,13 @@ func drawWindow(win *gadgets.GenericWindow) {
|
||||||
}
|
}
|
||||||
oldWin = makeOldStuff()
|
oldWin = makeOldStuff()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
grid.NewButton("debugger", func() {
|
||||||
|
debugger.DebugWindow()
|
||||||
|
})
|
||||||
|
grid.NewButton("logging", func() {
|
||||||
|
logsettings.LogWindow()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// old things before they are removed, deprecated, fixed, etc
|
// old things before they are removed, deprecated, fixed, etc
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// An app to submit patches for the 30 GO GUI repos
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
|
@ -42,7 +41,18 @@ func makeChatsWindow() *gadgets.GenericWindow {
|
||||||
grid := insertWin.Group.RawGrid()
|
grid := insertWin.Group.RawGrid()
|
||||||
|
|
||||||
var t *chatpb.ChatsTable
|
var t *chatpb.ChatsTable
|
||||||
grid.NewButton("dirty", func() {
|
grid.NewButton("show", func() {
|
||||||
|
if t != nil {
|
||||||
|
log.Info("Delete the table first")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 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())
|
||||||
})
|
})
|
||||||
|
|
||||||
grid.NewButton("delete PB table", func() {
|
grid.NewButton("delete PB table", func() {
|
||||||
|
@ -69,21 +79,59 @@ func addChatsPB(win *gadgets.GenericWindow, pb *chatpb.Chats) *chatpb.ChatsTable
|
||||||
tbox := win.Bottom.Box().SetProgName("TBOX")
|
tbox := win.Bottom.Box().SetProgName("TBOX")
|
||||||
t.SetParent(tbox)
|
t.SetParent(tbox)
|
||||||
|
|
||||||
sf := t.AddStringFunc("chat", func(r *chatpb.Chat) string {
|
sf := t.AddStringFunc("uuid", func(r *chatpb.Chat) string {
|
||||||
return r.GetUuid()
|
return r.GetUuid()
|
||||||
})
|
})
|
||||||
sf.Custom = func(r *chatpb.Chat) {
|
sf.Custom = func(r *chatpb.Chat) {
|
||||||
log.Info("do button click on", r.GetUuid())
|
log.Info("todo: fix mouseClick() on stringFunc in GUI table", r.GetUuid())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add a general show button
|
||||||
|
bf := t.AddButtonFunc("cur version", func(chat *chatpb.Chat) string { return "show" })
|
||||||
|
bf.Custom = func(r *chatpb.Chat) {
|
||||||
|
log.Info("todo: show a chat window here", r.GetUuid())
|
||||||
|
}
|
||||||
|
|
||||||
|
// show the age of the chat
|
||||||
t.AddTimeFunc("age", func(chat *chatpb.Chat) time.Time {
|
t.AddTimeFunc("age", func(chat *chatpb.Chat) time.Time {
|
||||||
return chat.GetCtime().AsTime()
|
return chat.GetCtime().AsTime()
|
||||||
})
|
})
|
||||||
t.AddChatName()
|
t.AddChatName()
|
||||||
f := func(repo *chatpb.Chat) string {
|
|
||||||
log.Info("chat =", repo.GetUuid(), repo.GetChatName())
|
// make a button to show the ChatEntries
|
||||||
return repo.GetUuid()
|
entryButton := t.AddButtonFunc("Entries", func(chat *chatpb.Chat) string {
|
||||||
|
return fmt.Sprintf("%d", len(chat.GetEntries()))
|
||||||
|
})
|
||||||
|
entryButton.Custom = func(chat *chatpb.Chat) {
|
||||||
|
log.Info("show entries for", chat.GetUuid())
|
||||||
|
chat.PrintChatEntriesTable()
|
||||||
}
|
}
|
||||||
t.AddButtonFunc("cur version", f)
|
|
||||||
|
// make a button to show the Stats (old stuff from gemini-cli)
|
||||||
|
statsButton := t.AddButtonFunc("Stats", func(chat *chatpb.Chat) string {
|
||||||
|
return fmt.Sprintf("%d", len(chat.GetSession()))
|
||||||
|
})
|
||||||
|
statsButton.Custom = func(chat *chatpb.Chat) {
|
||||||
|
log.Info("show gemini-cli /stats for", chat.GetUuid())
|
||||||
|
chat.PrintChatStatsTable()
|
||||||
|
}
|
||||||
|
|
||||||
|
// make a button to show content in the *genai.GeminiRequest structures
|
||||||
|
genaiButton := t.AddButtonFunc("# of genai.Req's", func(chat *chatpb.Chat) string {
|
||||||
|
var counter int
|
||||||
|
for _, entry := range chat.GetEntries() {
|
||||||
|
if entry.GeminiRequest != nil {
|
||||||
|
counter += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%d", counter)
|
||||||
|
})
|
||||||
|
genaiButton.Custom = func(chat *chatpb.Chat) {
|
||||||
|
log.Info("show *genai.GeminiRequsts for", chat.GetUuid())
|
||||||
|
chat.PrintChatGeminiTable()
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the tabel (send the gui protobuf to the GO plugin)
|
||||||
t.ShowTable()
|
t.ShowTable()
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue