NODE: it builds, runs and doesn't crash
Also, it doesn't really work as the formatting and other buttons and things don't get populated
This commit is contained in:
parent
f71355f571
commit
4e0b713201
10
box.go
10
box.go
|
@ -35,6 +35,7 @@ func add(box *GuiBox, newbox *GuiBox) {
|
|||
|
||||
newbox.Window.BoxMap["MAINBOX"] = newbox
|
||||
log.Println("gui.add() END")
|
||||
panic("gui.add() MAINBOX gui.add() END")
|
||||
return
|
||||
} else {
|
||||
log.Println("\tgui.add() ERROR DONT KNOW HOW TO ADD TO A RAW WINDOW YET")
|
||||
|
@ -42,6 +43,7 @@ func add(box *GuiBox, newbox *GuiBox) {
|
|||
}
|
||||
log.Println("\tgui.add() ERROR DON'T KNOW HOW TO add to Window as MAINBOX DONE")
|
||||
log.Println("gui.add() END")
|
||||
panic("gui.add() gui.add() END")
|
||||
return
|
||||
}
|
||||
log.Println("\tgui.add() adding", newbox.Name, "to", box.Name)
|
||||
|
@ -56,16 +58,15 @@ func add(box *GuiBox, newbox *GuiBox) {
|
|||
panic("gui.add() ERROR newbox.UiBox == nil")
|
||||
}
|
||||
|
||||
if (box.UiBox == nil) {
|
||||
}
|
||||
|
||||
if (box.UiBox == nil) {
|
||||
box.Dump()
|
||||
// panic("gui.add() ERROR box.UiBox == nil")
|
||||
return
|
||||
// TODO: fix this whole add() function // Oct 9
|
||||
panic("gui.add() ERROR box.UiBox == nil")
|
||||
}
|
||||
box.UiBox.Append(newbox.UiBox, false)
|
||||
box.Dump()
|
||||
panic("gui.add()")
|
||||
|
||||
// add the newbox to the Window.BoxMap[]
|
||||
box.Window.BoxMap[newbox.Name] = newbox
|
||||
|
@ -123,6 +124,7 @@ func NewBox(box *GuiBox, axis int, name string) *GuiBox {
|
|||
uiBox.SetPadded(true)
|
||||
newbox.UiBox = uiBox
|
||||
add(box, newbox)
|
||||
// panic("gui.NewBox")
|
||||
return newbox
|
||||
}
|
||||
|
||||
|
|
13
debug.go
13
debug.go
|
@ -9,14 +9,13 @@ import (
|
|||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
// import "reflect"
|
||||
|
||||
// import "github.com/andlabs/ui"
|
||||
// import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
//
|
||||
// Dump out debugging information every 4 seconds
|
||||
// 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
|
||||
|
||||
|
|
2
gui.go
2
gui.go
|
@ -20,6 +20,8 @@ func init() {
|
|||
Data.WindowMap = make(map[string]*GuiWindow)
|
||||
Data.NodeMap = make(map[string]*Node)
|
||||
|
||||
Data.NodeSlice = make([]*Node, 0)
|
||||
|
||||
Config.counter = 0
|
||||
Config.prefix = "jwc"
|
||||
}
|
||||
|
|
|
@ -130,10 +130,12 @@ func (n *Node) Append(child *Node) {
|
|||
// return
|
||||
// }
|
||||
n.children = append(n.children, child)
|
||||
if (Config.Debug) {
|
||||
log.Println("child node:")
|
||||
child.Dump()
|
||||
log.Println("parent node:")
|
||||
n.Dump()
|
||||
}
|
||||
// time.Sleep(3 * time.Second)
|
||||
}
|
||||
|
||||
|
@ -275,7 +277,7 @@ func (parent *Node) AddTab(title string, uiC ui.Control) *Node {
|
|||
parent.uiWindow.SetMargined(true)
|
||||
parent.uiTab = inittab
|
||||
|
||||
parent.Dump()
|
||||
// parent.Dump()
|
||||
// panic("gui.AddTab() ERROR uiTab == nil")
|
||||
}
|
||||
|
||||
|
@ -288,7 +290,9 @@ func (parent *Node) AddTab(title string, uiC ui.Control) *Node {
|
|||
tab.Append(title, uiC)
|
||||
tab.SetMargined(0, true)
|
||||
|
||||
// panic("gui.AddTab() before makeNode()")
|
||||
newNode := parent.makeNode(title, 555, 600 + Config.counter)
|
||||
newNode.uiTab = tab
|
||||
// panic("gui.AddTab() after makeNode()")
|
||||
return newNode
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ type GuiData struct {
|
|||
|
||||
// Store access to everything via binary tree's
|
||||
NodeMap map[string]*Node
|
||||
NodeArray []*Node
|
||||
NodeSlice []*Node
|
||||
|
||||
// A map of all buttons everywhere on all
|
||||
// windows, all tabs, across all goroutines
|
||||
|
|
|
@ -30,7 +30,8 @@ func (mh *TableData) ColumnTypes(m *ui.TableModel) []ui.TableValue {
|
|||
}
|
||||
|
||||
// TODO: Figure out why this is being called 1000 times a second (10 times for each row & column)
|
||||
// Nevermind this TODO. Who gives a shit. This is a really smart way to treat the OS toolkits
|
||||
//
|
||||
// Nevermind that TODO. Who gives a shit. This is a really smart way to treat the OS toolkits
|
||||
func (mh *TableData) CellValue(m *ui.TableModel, row, column int) ui.TableValue {
|
||||
if (Config.DebugTable) {
|
||||
log.Println("CellValue() row, column =", row, column)
|
||||
|
|
30
window.go
30
window.go
|
@ -2,6 +2,7 @@ package gui
|
|||
|
||||
import (
|
||||
"log"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -257,16 +258,24 @@ func makeNode(parent *Node, title string, x int, y int) *Node {
|
|||
Config.counter += 1
|
||||
node.id = id
|
||||
|
||||
// panic("gui.makeNode() START")
|
||||
if (parent == nil) {
|
||||
if (Data.NodeMap[title] != nil) {
|
||||
log.Println("Duplicate uiNewWindow() name =", title)
|
||||
// TODO: just change the 'title' to something unique
|
||||
panic(fmt.Sprintf("Duplicate uiNewWindow() name = %s\n", title))
|
||||
return nil
|
||||
}
|
||||
// panic("gui.makeNode() before NodeMap()")
|
||||
Data.NodeMap[title] = &node
|
||||
Data.NodeArray = append(Data.NodeArray, &node)
|
||||
Data.NodeSlice = append(Data.NodeSlice, &node)
|
||||
// panic("gui.makeNode() after NodeMap()")
|
||||
return &node
|
||||
} else {
|
||||
panic("gui.makeNode() before Append()")
|
||||
parent.Append(&node)
|
||||
panic("gui.makeNode() after Append()")
|
||||
}
|
||||
node.parent = parent
|
||||
return &node
|
||||
|
@ -326,14 +335,28 @@ func (n *Node) initBlankWindow() ui.Control {
|
|||
return hbox
|
||||
}
|
||||
|
||||
var master = 0
|
||||
func makeBlankNode(title string) *Node {
|
||||
log.Println("gui.makeBlankNode() title =", title)
|
||||
if Data.NodeMap[title] != nil {
|
||||
log.Println("gui.makeBlankNode() already exists title =", title)
|
||||
title = title + Config.prefix + strconv.Itoa(Config.counter)
|
||||
Config.counter += 1
|
||||
}
|
||||
if Data.NodeMap[title] != nil {
|
||||
panic("gui.makeBlankNode() already exists")
|
||||
return nil
|
||||
}
|
||||
|
||||
node := makeNode(nil, title, x, y)
|
||||
return node
|
||||
}
|
||||
|
||||
func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Node {
|
||||
log.Println("gui.WindowMap START title =", title)
|
||||
if Data.WindowMap[title] != nil {
|
||||
log.Println("Data.WindowMap[title] already exists title =", title)
|
||||
master = master + 1
|
||||
title = title + " jcarr " + strconv.Itoa(master)
|
||||
title = title + Config.prefix + strconv.Itoa(Config.counter)
|
||||
Config.counter += 1
|
||||
}
|
||||
if Data.WindowMap[title] != nil {
|
||||
log.Println("Data.WindowMap[title] already exists title =", title)
|
||||
|
@ -357,7 +380,6 @@ func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Nod
|
|||
box.Window = &newGuiWindow
|
||||
box.Name = title
|
||||
|
||||
// func makeNode(parent *Node, title string, x int, y int) *Node {
|
||||
node := makeNode(parent, title, x, y)
|
||||
node.box = &box
|
||||
node.uiWindow = window
|
||||
|
|
Loading…
Reference in New Issue