summaryrefslogtreecommitdiff
path: root/debug.go
blob: c895e01a3cb308f60b46dff70d6848d82bc4a600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package gui

import (
	"fmt"
	"log"
	"time"

	// "github.com/davecgh/go-spew/spew"
)

// WatchGUI() opens a goroutine
//
// 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 {
			log.Println("Sleep() in watchGUI()")
			if Config.Debug {
				// DumpBoxes()
			}
			count = 0
		}
		count += 1
		time.Sleep(200 * time.Millisecond)
	}
}

func addTableTab() {
	var parts []TableColumnData

	for key, foo := range []string{"BG", "TEXTCOLOR", "BUTTON", "TEXTCOLOR", "TEXTCOLOR", "TEXT", "BUTTON", "TEXT", "BUTTON"} {
		log.Println(key, foo)

		var b TableColumnData
		b.CellType = foo
		b.Heading = fmt.Sprintf("heading%d", key)
		parts = append(parts, b)
	}

	log.Println("Sleep for 1 second, then try to add new tabs")
	time.Sleep(1 * time.Second)
}

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)
	}
}