summaryrefslogtreecommitdiff
path: root/debug.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-10-08 23:22:47 -0500
committerJeff Carr <[email protected]>2022-10-08 23:22:47 -0500
commit086986b6b8f55d15d18595bcbf3f76c023365b61 (patch)
tree9f1dc4da5b2d125f7a017418d4d9912e16b71039 /debug.go
parentf92a50e2e665a18e2201f1d6714025dcc39301cc (diff)
parent45644ef9bc333f5def62d1c7f474dc96274e63fa (diff)
Merge branch 'master' into jcarr
Diffstat (limited to 'debug.go')
-rw-r--r--debug.go113
1 files changed, 46 insertions, 67 deletions
diff --git a/debug.go b/debug.go
index 3369be6..c895e01 100644
--- a/debug.go
+++ b/debug.go
@@ -1,27 +1,28 @@
package gui
-import "log"
-import "time"
-import "fmt"
-import "reflect"
+import (
+ "fmt"
+ "log"
+ "time"
-// import "github.com/andlabs/ui"
-// import _ "github.com/andlabs/ui/winmanifest"
-import "github.com/davecgh/go-spew/spew"
-// import pb "git.wit.com/wit/witProtobuf"
+ // "github.com/davecgh/go-spew/spew"
+)
+// WatchGUI() opens a goroutine
//
-// this watches the GUI primarily to process protobuf's
-// this is pointless or wrong but I use it for debugging
-//
+// From that goroutine, it dumps out debugging information every 4 seconds
+/*
+ TODO: add configuration triggers on what to dump out
+ TODO: allow this to be sent to /var/log, syslogd, systemd's journalctl, etc
+*/
func WatchGUI() {
count := 0
for {
- if (count > 20) {
+ if count > 20 {
log.Println("Sleep() in watchGUI()")
- if (Config.Debug) {
- DumpBoxes()
+ if Config.Debug {
+ // DumpBoxes()
}
count = 0
}
@@ -30,46 +31,6 @@ func WatchGUI() {
}
}
-func DumpBoxes() {
- for name, window := range Data.WindowMap {
- log.Println("gui.DumpBoxes()", name)
- log.Println("gui.DumpBoxes()\tWindow.name =", window.Name)
- log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow))
- log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow)
- if (window.UiTab != nil) {
- log.Println("gui.DumpBoxes()\tWindow.UiTab type =", reflect.TypeOf(window.UiTab))
- log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
- log.Println("gui.DumpBoxes()\tWindow.UiTab.NumPages() =", window.UiTab.NumPages())
- // tmp := spew.NewDefaultConfig()
- // tmp.MaxDepth = 2
- // tmp.Dump(window.UiTab)
- if (Config.Debug) {
- scs := spew.ConfigState{MaxDepth: 2}
- scs.Dump(window.UiTab)
- }
- }
- }
- for i, window := range Data.Windows {
- log.Println("gui.DumpBoxes() Data.Windows", i, "Name =", window.Name)
- for name, abox := range window.BoxMap {
- log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
- /*
- if (name == "DEBUG") {
- log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
- win := abox.Window
- log.Println("\t\twatchGUI() BOX win =", reflect.TypeOf(win))
- area := win.Area
- log.Println("\t\twatchGUI() BOX area =", reflect.TypeOf(area), area.UiArea)
- // spew.Dump(area.UiArea)
- // area.UiArea.Show()
- // time.Sleep(2000 * time.Millisecond)
- // os.Exit(0)
- }
- */
- }
- }
-}
-
func addTableTab() {
var parts []TableColumnData
@@ -78,22 +39,40 @@ func addTableTab() {
var b TableColumnData
b.CellType = foo
- b.Heading = fmt.Sprintf("heading%d", key)
+ b.Heading = fmt.Sprintf("heading%d", key)
parts = append(parts, b)
}
- log.Println("Sleep for 2 seconds, then try to add new tabs")
- time.Sleep(1 * 1000 * 1000 * 1000)
- // AddTableTab(Data.Window1.T, 1, "test seven", 7, parts, nil)
+ log.Println("Sleep for 1 second, then try to add new tabs")
+ time.Sleep(1 * time.Second)
}
-/*
-func runTestHide(b *GuiButton) {
- log.Println("runTestHide START")
- Data.Window1.Box1.Hide()
- Data.Window1.Box2.Hide()
- // time.Sleep(2000 * time.Millisecond)
- Data.State = "HIDE"
- log.Println("runTestHide END")
+func (dn *GuiData) DumpNodeMap() {
+ log.Println("DebugDataNodeMap():")
+ for name, node := range dn.NodeMap {
+ log.Println("\tNode =", node.id, node.Width, node.Height, name)
+ if (node.children == nil) {
+ log.Println("\t\tNo children")
+ } else {
+ log.Println("\t\tHas children:", node.children)
+ }
+ // node.SetName("yahoo")
+ // log.Println("\tData.NodeMap node =", node)
+ }
+}
+
+func (dn *GuiData) ListChildren(dump bool) {
+ if Data.NodeMap == nil {
+ log.Println("gui.Data.ListChildren() Data.NodeMap == nil")
+ return
+ }
+ log.Println("gui.Data.ListChildren() Data.NodeMap:")
+ for name, node := range Data.NodeMap {
+ listChildrenDepth = 0
+ if (dump == true) {
+ log.Println("tgui.Data.ListChildren() node =", node.id, node.Width, node.Height, name)
+ node.Dump()
+ }
+ node.ListChildren(dump)
+ }
}
-*/