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
|
newbox.Window.BoxMap["MAINBOX"] = newbox
|
||||||
log.Println("gui.add() END")
|
log.Println("gui.add() END")
|
||||||
|
panic("gui.add() MAINBOX gui.add() END")
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
log.Println("\tgui.add() ERROR DONT KNOW HOW TO ADD TO A RAW WINDOW YET")
|
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("\tgui.add() ERROR DON'T KNOW HOW TO add to Window as MAINBOX DONE")
|
||||||
log.Println("gui.add() END")
|
log.Println("gui.add() END")
|
||||||
|
panic("gui.add() gui.add() END")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("\tgui.add() adding", newbox.Name, "to", box.Name)
|
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")
|
panic("gui.add() ERROR newbox.UiBox == nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box.UiBox == nil) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (box.UiBox == nil) {
|
if (box.UiBox == nil) {
|
||||||
box.Dump()
|
box.Dump()
|
||||||
|
// panic("gui.add() ERROR box.UiBox == nil")
|
||||||
return
|
return
|
||||||
// TODO: fix this whole add() function // Oct 9
|
// TODO: fix this whole add() function // Oct 9
|
||||||
panic("gui.add() ERROR box.UiBox == nil")
|
|
||||||
}
|
}
|
||||||
box.UiBox.Append(newbox.UiBox, false)
|
box.UiBox.Append(newbox.UiBox, false)
|
||||||
|
box.Dump()
|
||||||
|
panic("gui.add()")
|
||||||
|
|
||||||
// add the newbox to the Window.BoxMap[]
|
// add the newbox to the Window.BoxMap[]
|
||||||
box.Window.BoxMap[newbox.Name] = newbox
|
box.Window.BoxMap[newbox.Name] = newbox
|
||||||
|
@ -123,6 +124,7 @@ func NewBox(box *GuiBox, axis int, name string) *GuiBox {
|
||||||
uiBox.SetPadded(true)
|
uiBox.SetPadded(true)
|
||||||
newbox.UiBox = uiBox
|
newbox.UiBox = uiBox
|
||||||
add(box, newbox)
|
add(box, newbox)
|
||||||
|
// panic("gui.NewBox")
|
||||||
return newbox
|
return newbox
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
debug.go
13
debug.go
|
@ -9,14 +9,13 @@ import (
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
)
|
)
|
||||||
|
|
||||||
// import "reflect"
|
// WatchGUI() opens a goroutine
|
||||||
|
|
||||||
// import "github.com/andlabs/ui"
|
|
||||||
// import _ "github.com/andlabs/ui/winmanifest"
|
|
||||||
|
|
||||||
//
|
|
||||||
// Dump out debugging information every 4 seconds
|
|
||||||
//
|
//
|
||||||
|
// 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() {
|
func WatchGUI() {
|
||||||
count := 0
|
count := 0
|
||||||
|
|
||||||
|
|
2
gui.go
2
gui.go
|
@ -20,6 +20,8 @@ func init() {
|
||||||
Data.WindowMap = make(map[string]*GuiWindow)
|
Data.WindowMap = make(map[string]*GuiWindow)
|
||||||
Data.NodeMap = make(map[string]*Node)
|
Data.NodeMap = make(map[string]*Node)
|
||||||
|
|
||||||
|
Data.NodeSlice = make([]*Node, 0)
|
||||||
|
|
||||||
Config.counter = 0
|
Config.counter = 0
|
||||||
Config.prefix = "jwc"
|
Config.prefix = "jwc"
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,10 +130,12 @@ func (n *Node) Append(child *Node) {
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
n.children = append(n.children, child)
|
n.children = append(n.children, child)
|
||||||
log.Println("child node:")
|
if (Config.Debug) {
|
||||||
child.Dump()
|
log.Println("child node:")
|
||||||
log.Println("parent node:")
|
child.Dump()
|
||||||
n.Dump()
|
log.Println("parent node:")
|
||||||
|
n.Dump()
|
||||||
|
}
|
||||||
// time.Sleep(3 * time.Second)
|
// time.Sleep(3 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +277,7 @@ func (parent *Node) AddTab(title string, uiC ui.Control) *Node {
|
||||||
parent.uiWindow.SetMargined(true)
|
parent.uiWindow.SetMargined(true)
|
||||||
parent.uiTab = inittab
|
parent.uiTab = inittab
|
||||||
|
|
||||||
parent.Dump()
|
// parent.Dump()
|
||||||
// panic("gui.AddTab() ERROR uiTab == nil")
|
// 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.Append(title, uiC)
|
||||||
tab.SetMargined(0, true)
|
tab.SetMargined(0, true)
|
||||||
|
|
||||||
|
// panic("gui.AddTab() before makeNode()")
|
||||||
newNode := parent.makeNode(title, 555, 600 + Config.counter)
|
newNode := parent.makeNode(title, 555, 600 + Config.counter)
|
||||||
newNode.uiTab = tab
|
newNode.uiTab = tab
|
||||||
|
// panic("gui.AddTab() after makeNode()")
|
||||||
return newNode
|
return newNode
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ type GuiData struct {
|
||||||
|
|
||||||
// Store access to everything via binary tree's
|
// Store access to everything via binary tree's
|
||||||
NodeMap map[string]*Node
|
NodeMap map[string]*Node
|
||||||
|
NodeArray []*Node
|
||||||
|
NodeSlice []*Node
|
||||||
|
|
||||||
// A map of all buttons everywhere on all
|
// A map of all buttons everywhere on all
|
||||||
// windows, all tabs, across all goroutines
|
// 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)
|
// 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 {
|
func (mh *TableData) CellValue(m *ui.TableModel, row, column int) ui.TableValue {
|
||||||
if (Config.DebugTable) {
|
if (Config.DebugTable) {
|
||||||
log.Println("CellValue() row, column =", row, column)
|
log.Println("CellValue() row, column =", row, column)
|
||||||
|
|
30
window.go
30
window.go
|
@ -2,6 +2,7 @@ package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -257,16 +258,24 @@ func makeNode(parent *Node, title string, x int, y int) *Node {
|
||||||
Config.counter += 1
|
Config.counter += 1
|
||||||
node.id = id
|
node.id = id
|
||||||
|
|
||||||
|
// panic("gui.makeNode() START")
|
||||||
if (parent == nil) {
|
if (parent == nil) {
|
||||||
if (Data.NodeMap[title] != nil) {
|
if (Data.NodeMap[title] != nil) {
|
||||||
log.Println("Duplicate uiNewWindow() name =", title)
|
log.Println("Duplicate uiNewWindow() name =", title)
|
||||||
// TODO: just change the 'title' to something unique
|
// TODO: just change the 'title' to something unique
|
||||||
|
panic(fmt.Sprintf("Duplicate uiNewWindow() name = %s\n", title))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
// panic("gui.makeNode() before NodeMap()")
|
||||||
Data.NodeMap[title] = &node
|
Data.NodeMap[title] = &node
|
||||||
|
Data.NodeArray = append(Data.NodeArray, &node)
|
||||||
|
Data.NodeSlice = append(Data.NodeSlice, &node)
|
||||||
|
// panic("gui.makeNode() after NodeMap()")
|
||||||
return &node
|
return &node
|
||||||
} else {
|
} else {
|
||||||
|
panic("gui.makeNode() before Append()")
|
||||||
parent.Append(&node)
|
parent.Append(&node)
|
||||||
|
panic("gui.makeNode() after Append()")
|
||||||
}
|
}
|
||||||
node.parent = parent
|
node.parent = parent
|
||||||
return &node
|
return &node
|
||||||
|
@ -326,14 +335,28 @@ func (n *Node) initBlankWindow() ui.Control {
|
||||||
return hbox
|
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 {
|
func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Node {
|
||||||
log.Println("gui.WindowMap START title =", title)
|
log.Println("gui.WindowMap START title =", title)
|
||||||
if Data.WindowMap[title] != nil {
|
if Data.WindowMap[title] != nil {
|
||||||
log.Println("Data.WindowMap[title] already exists title =", title)
|
log.Println("Data.WindowMap[title] already exists title =", title)
|
||||||
master = master + 1
|
title = title + Config.prefix + strconv.Itoa(Config.counter)
|
||||||
title = title + " jcarr " + strconv.Itoa(master)
|
Config.counter += 1
|
||||||
}
|
}
|
||||||
if Data.WindowMap[title] != nil {
|
if Data.WindowMap[title] != nil {
|
||||||
log.Println("Data.WindowMap[title] already exists title =", title)
|
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.Window = &newGuiWindow
|
||||||
box.Name = title
|
box.Name = title
|
||||||
|
|
||||||
// func makeNode(parent *Node, title string, x int, y int) *Node {
|
|
||||||
node := makeNode(parent, title, x, y)
|
node := makeNode(parent, title, x, y)
|
||||||
node.box = &box
|
node.box = &box
|
||||||
node.uiWindow = window
|
node.uiWindow = window
|
||||||
|
|
Loading…
Reference in New Issue