NODE: walking around in the rabbit hole
This commit is contained in:
parent
24244a206e
commit
310569479b
23
debug.go
23
debug.go
|
@ -114,14 +114,10 @@ func addTableTab() {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DebugDataNodeMap() {
|
func (dn *GuiData) DumpNodeMap() {
|
||||||
if Data.NodeMap == nil {
|
|
||||||
log.Println("DebugDataNodeMap() NodeMap == nil")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Println("DebugDataNodeMap():")
|
log.Println("DebugDataNodeMap():")
|
||||||
for name, node := range Data.NodeMap {
|
for name, node := range dn.NodeMap {
|
||||||
log.Println("\tNode name =", node.Width, node.Height, name)
|
log.Println("\tNode =", node.id, node.Width, node.Height, name)
|
||||||
if (node.children == nil) {
|
if (node.children == nil) {
|
||||||
log.Println("\t\tNo children")
|
log.Println("\t\tNo children")
|
||||||
} else {
|
} else {
|
||||||
|
@ -173,12 +169,12 @@ func FindNode(name string) *Node {
|
||||||
|
|
||||||
func (dn *GuiData) ListChildren(dump bool) {
|
func (dn *GuiData) ListChildren(dump bool) {
|
||||||
if Data.NodeMap == nil {
|
if Data.NodeMap == nil {
|
||||||
log.Println("Data.NodeMap == nil")
|
log.Println("gui.Data.ListChildren() Data.NodeMap == nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("Dumping Data.NodeMap:")
|
log.Println("gui.Data.ListChildren() Data.NodeMap:")
|
||||||
for name, node := range Data.NodeMap {
|
for name, node := range Data.NodeMap {
|
||||||
log.Println("\tData.NodeMap name =", node.id, node.Width, node.Height, name)
|
log.Println("\tgui.Data.ListChildren() node =", node.id, node.Width, node.Height, name)
|
||||||
if (dump == true) {
|
if (dump == true) {
|
||||||
node.Dump()
|
node.Dump()
|
||||||
}
|
}
|
||||||
|
@ -188,13 +184,14 @@ func (dn *GuiData) ListChildren(dump bool) {
|
||||||
|
|
||||||
func (dn *GuiData) findId(id string) *Node {
|
func (dn *GuiData) findId(id string) *Node {
|
||||||
if Data.NodeMap == nil {
|
if Data.NodeMap == nil {
|
||||||
log.Println("Data.NodeMap == nil")
|
log.Println("gui.Data.findId() map == nil")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
log.Println("Dumping Data.NodeMap:")
|
// log.Println("Dumping Data.NodeMap:")
|
||||||
for name, node := range Data.NodeMap {
|
for name, node := range Data.NodeMap {
|
||||||
log.Println("\tData.NodeMap name =", node.id, node.Width, node.Height, name)
|
// log.Println("\tData.NodeMap name =", node.id, node.Width, node.Height, name)
|
||||||
if (id == node.id) {
|
if (id == node.id) {
|
||||||
|
log.Println("\tgui.Data.findId() found node =", node.id, node.Width, node.Height, name)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
// TODO: fix // Oct 9
|
// TODO: fix // Oct 9
|
||||||
|
|
|
@ -102,14 +102,16 @@ func (n *Node) List() {
|
||||||
func (n *Node) ListChildren(dump bool) {
|
func (n *Node) ListChildren(dump bool) {
|
||||||
log.Println("\tListChildren() node =", n.id, n.Name, n.Width, n.Height)
|
log.Println("\tListChildren() node =", n.id, n.Name, n.Width, n.Height)
|
||||||
|
|
||||||
|
if (dump == true) {
|
||||||
|
n.Dump()
|
||||||
|
}
|
||||||
if len(n.children) == 0 {
|
if len(n.children) == 0 {
|
||||||
if (n.parent != nil) {
|
if (n.parent != nil) {
|
||||||
log.Println("\t\t\tparent =",n.parent.id)
|
log.Println("\t\t\tparent =",n.parent.id)
|
||||||
}
|
}
|
||||||
log.Println("\t\tNo children START")
|
log.Println("\t\t", n.id, "has no children")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// spew.Dump(n)
|
|
||||||
for _, child := range n.children {
|
for _, child := range n.children {
|
||||||
log.Println("\t\tListChildren() child =",child.id, child.Name, child.Width, child.Height)
|
log.Println("\t\tListChildren() child =",child.id, child.Name, child.Width, child.Height)
|
||||||
if (child.parent != nil) {
|
if (child.parent != nil) {
|
||||||
|
@ -118,12 +120,14 @@ func (n *Node) ListChildren(dump bool) {
|
||||||
log.Println("\t\t\tno parent")
|
log.Println("\t\t\tno parent")
|
||||||
panic("no parent")
|
panic("no parent")
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (dump == true) {
|
if (dump == true) {
|
||||||
child.Dump()
|
child.Dump()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (child.children == nil) {
|
if (child.children == nil) {
|
||||||
log.Println("\t\t\tNo children END")
|
log.Println("\t\t", child.id, "has no children")
|
||||||
// break
|
break
|
||||||
}
|
}
|
||||||
log.Println("\t\t\tHas children:", child.children)
|
log.Println("\t\t\tHas children:", child.children)
|
||||||
child.ListChildren(dump)
|
child.ListChildren(dump)
|
||||||
|
|
|
@ -165,26 +165,48 @@ func makeWindowDebug() ui.Control {
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
vbox = addGroup(hbox, "Node Debug")
|
vbox = addGroup(hbox, "Node Debug")
|
||||||
|
|
||||||
n1 := addButton(vbox, "DebugDataNodeMap()")
|
n1 := addButton(vbox, "Data.DumpNodeMap()")
|
||||||
n1.OnClicked(func(*ui.Button) {
|
n1.OnClicked(func(*ui.Button) {
|
||||||
DebugDataNodeMap()
|
Data.DumpNodeMap()
|
||||||
})
|
})
|
||||||
|
|
||||||
n2 := addButton(vbox, "DebugDataNodeChildren()")
|
n1 = addButton(vbox, "DebugDataNodeChildren()")
|
||||||
n2.OnClicked(func(*ui.Button) {
|
n1.OnClicked(func(*ui.Button) {
|
||||||
DebugDataNodeChildren()
|
DebugDataNodeChildren()
|
||||||
})
|
})
|
||||||
|
|
||||||
n3 := addButton(vbox, "Node.ListChildren(false)")
|
n1 = addButton(vbox, "Data.ListChildren(false)")
|
||||||
n3.OnClicked(func(*ui.Button) {
|
n1.OnClicked(func(*ui.Button) {
|
||||||
Data.ListChildren(false)
|
Data.ListChildren(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
n4 := addButton(vbox, "Node.ListChildren(true)")
|
n1 = addButton(vbox, "Data.ListChildren(true)")
|
||||||
n4.OnClicked(func(*ui.Button) {
|
n1.OnClicked(func(*ui.Button) {
|
||||||
Data.ListChildren(true)
|
Data.ListChildren(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
n1 = addButton(vbox, "Node.ListChildren(false)")
|
||||||
|
n1.OnClicked(func(*ui.Button) {
|
||||||
|
y := nodeCombo.Selected()
|
||||||
|
log.Println("y =", y)
|
||||||
|
log.Println("nodeNames[y] =", nodeNames[y])
|
||||||
|
node := Data.findId(nodeNames[y])
|
||||||
|
if (node != nil) {
|
||||||
|
node.ListChildren(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
n1 = addButton(vbox, "Node.ListChildren(true)")
|
||||||
|
n1.OnClicked(func(*ui.Button) {
|
||||||
|
y := nodeCombo.Selected()
|
||||||
|
log.Println("y =", y)
|
||||||
|
log.Println("nodeNames[y] =", nodeNames[y])
|
||||||
|
node := Data.findId(nodeNames[y])
|
||||||
|
if (node != nil) {
|
||||||
|
node.ListChildren(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
vbox = addGroup(hbox, "Numbers")
|
vbox = addGroup(hbox, "Numbers")
|
||||||
|
|
Loading…
Reference in New Issue