summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-04 12:49:26 -0600
committerJeff Carr <[email protected]>2024-01-04 12:49:26 -0600
commit1f0e212002c2c5b34ea23d91e504ed59d31cab22 (patch)
treed40e6caaa970ad63ae86199ad11b65ae9397feb1
parent973f6411f4a59dcf21a8151d21578775deb340e0 (diff)
logSettings window moved to 'gui/gadgets'
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--Makefile3
-rw-r--r--logSettings.go100
-rw-r--r--mainWindow.go5
-rw-r--r--structs.go4
4 files changed, 10 insertions, 102 deletions
diff --git a/Makefile b/Makefile
index c1e8774..93ffb6a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
# git remote add github [email protected]:wit-go/gui-debugger.git
+all:
+ go mod tidy
+
github:
git push -u github master
git push -u github devel
diff --git a/logSettings.go b/logSettings.go
deleted file mode 100644
index fee9bf4..0000000
--- a/logSettings.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package debugger
-
-import (
- "go.wit.com/log"
- "go.wit.com/gui/gui"
-)
-
-type LogSettings struct {
- ready bool
- hidden bool
- err error
- name string
-
- parent *gui.Node // should be the root of the 'gui' package binary tree
- window *gui.Node // our window for displaying the log package settings
- group *gui.Node //
- grid *gui.Node //
- checkbox *gui.Node
- label *gui.Node
-
-}
-
-func (ls *LogSettings) Set(b bool) {
- // log.Set(ls.name, b)
- log.Warn("log.Set() FIXME: not working here anymore")
- ls.checkbox.Set(b)
-}
-
-func NewLogFlag(p *gui.Node, name string) *LogSettings {
- ls := new(LogSettings)
- ls.parent = p
- ls.ready = false
- ls.name = name
-
- ls.checkbox = p.NewCheckbox(name)
- ls.label = p.NewLabel("Enable log." + name)
- // ls.checkbox.Set(log.Get(name))
- ls.checkbox.Custom = func() {
- // log.Set(name, ls.checkbox.B)
- log.Warn("log.Set() FIXME: not working here anymore")
- }
- return ls
-}
-
-// Let's you toggle on and off the various types of debugging output
-// These checkboxes should be in the same order as the are printed
-func DebugFlags(n *gui.Node) {
- var newW, newB, g *gui.Node
-
- logGadgets := make(map[string]*LogSettings)
-
- newW = myGui.NewWindow("Debug Flags")
- newW.Custom = myGui.StandardClose
-
- newB = newW.NewBox("hBox", true)
- g = newB.NewGroup("Show").Pad()
-
- g.NewButton("log.SetTmp()", func () {
- log.SetTmp()
- })
-
- g.NewButton("log.All(true)", func () {
- for _, lf := range logGadgets {
- lf.Set(true)
- }
- log.All(true)
- })
-
- g.NewButton("log.All(false)", func () {
- for _, lf := range logGadgets {
- lf.Set(false)
- }
- log.All(false)
- })
-
- g.NewButton("Dump Flags", func () {
- // ShowDebugValues()
- log.ListFlags()
- })
-
- /*
- g.NewButton("All On", func () {
- SetDebug(true)
- })
-
- g.NewButton("All Off", func () {
- SetDebug(false)
- })
- */
-
- g = newB.NewGroup("List")
- g = g.NewGrid("flags grid", 2, 2)
-
- /*
- logGadgets["INFO"] = NewLogFlag(g, "INFO")
- logGadgets["WARN"] = NewLogFlag(g, "WARN")
- logGadgets["SPEW"] = NewLogFlag(g, "SPEW")
- logGadgets["ERROR"] = NewLogFlag(g, "ERROR")
- */
-}
diff --git a/mainWindow.go b/mainWindow.go
index 460b76b..b40056c 100644
--- a/mainWindow.go
+++ b/mainWindow.go
@@ -5,6 +5,7 @@ import (
"go.wit.com/log"
"go.wit.com/gui/gui"
+ "go.wit.com/gui/gadgets/logsettings"
)
/*
@@ -17,6 +18,8 @@ func DebugWindow(p *gui.Node) {
bugWin.StandardClose()
bugTab = DebugWindow2(bugWin, "Debug Tab")
bugTab.StandardClose()
+ // initialize the log settings window (does not display it)
+ myLS = logsettings.New(myGui)
if ArgDebug() {
log.SetTmp()
}
@@ -35,7 +38,7 @@ func DebugWindow2(n *gui.Node, title string) *gui.Node {
gr = newB.NewGroup("Debugging Windows:")
gr.NewButton("logging", func () {
- DebugFlags(myGui)
+ myLS.Show()
})
gr.NewButton("Debug Widgets", func () {
DebugWidgetWindow(myGui)
diff --git a/structs.go b/structs.go
index 0f6d853..8d4e9f9 100644
--- a/structs.go
+++ b/structs.go
@@ -2,7 +2,7 @@ package debugger
import (
"go.wit.com/gui/gui"
- // "go.wit.com/gui/gui/toolkit"
+ "go.wit.com/gui/gadgets/logsettings"
)
// main debugging window
@@ -10,6 +10,8 @@ var myGui *gui.Node
var bugWin *gui.Node
var bugTab *gui.Node
+var myLS *logsettings.LogSettings
+
var mapWindows map[string]*gui.Node // tracks all windows that exist
// global var for checking to see if this