more helpful and easier to read debugging output
This commit is contained in:
parent
bbdf7fefbd
commit
5b39848b64
26
debug.go
26
debug.go
|
@ -8,9 +8,9 @@ import (
|
|||
)
|
||||
|
||||
func (w *guiWidget) dumpTree(s string) {
|
||||
// log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String())
|
||||
// log.Log(ERROR, "dump w", w.node.WidgetId, w.WidgetType, w.String())
|
||||
if w == nil {
|
||||
log.Log(ERROR, "dumpTree w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
|
||||
log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.WidgetType, w.String())
|
||||
return
|
||||
}
|
||||
w.showWidgetPlacement("dumpTree() " + s)
|
||||
|
@ -29,27 +29,29 @@ func (w *guiWidget) showWidgetPlacement(s string) {
|
|||
} else {
|
||||
pId = w.node.Parent.WidgetId
|
||||
}
|
||||
s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.node.WidgetId, pId)
|
||||
s1 = fmt.Sprintf("(wId,pId)=(%4d,%4d) ", w.node.WidgetId, pId)
|
||||
sizeW, sizeH := w.Size()
|
||||
s1 += fmt.Sprintf("size=(%2d,%2d)", sizeW, sizeH)
|
||||
s1 += fmt.Sprintf("size=(%3d,%3d)", sizeW, sizeH)
|
||||
if w.Visible() {
|
||||
s1 += fmt.Sprintf("gocui=(%2d,%2d,%2d,%2d)",
|
||||
s1 += fmt.Sprintf("gocui=(%3d,%3d,%3d,%3d)",
|
||||
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
|
||||
} else {
|
||||
s1 += fmt.Sprintf(" %2s %2s %2s %2s ", "", "", "", "")
|
||||
s1 += fmt.Sprintf(" %3s %3s %3s %3s ", "", "", "", "")
|
||||
}
|
||||
if w.node.Parent != nil {
|
||||
if w.node.Parent.WidgetType == widget.Grid {
|
||||
s1 += fmt.Sprintf("At(%2d,%2d) ", w.node.State.AtW, w.node.State.AtH)
|
||||
s1 += fmt.Sprintf("At(%3d,%3d) ", w.node.State.AtW, w.node.State.AtH)
|
||||
} else {
|
||||
s1 += fmt.Sprintf(" %2s %2s ", "", "")
|
||||
s1 += fmt.Sprintf(" %3s %3s ", "", "")
|
||||
}
|
||||
} else {
|
||||
s1 += fmt.Sprintf(" %2s %2s ", "", "")
|
||||
s1 += fmt.Sprintf(" %3s %3s ", "", "")
|
||||
}
|
||||
tmp := "." + w.String() + ". " + w.cuiName
|
||||
var end string
|
||||
if w.node.WidgetType == widget.Box {
|
||||
tmp = "." + w.node.State.Direction.String() + ". " + w.cuiName
|
||||
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.node.State.Direction.String())
|
||||
} else {
|
||||
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.String())
|
||||
}
|
||||
log.Log(NOW, s1, s, w.node.WidgetType, ",", tmp) //
|
||||
log.Log(NOW, s1, s, end)
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ func makeDropdownView(ddItems string) *guiWidget {
|
|||
func addDropdown() *tree.Node {
|
||||
n := new(tree.Node)
|
||||
n.WidgetType = widget.Flag
|
||||
n.WidgetId = 2222
|
||||
n.WidgetId = -222
|
||||
n.ParentId = 0
|
||||
|
||||
// store the internal toolkit information
|
||||
|
@ -62,7 +62,7 @@ func addDropdown() *tree.Node {
|
|||
tk.node.State.Label = "DropBox"
|
||||
|
||||
// set the name used by gocui to the id
|
||||
tk.cuiName = "-1 dropbox"
|
||||
tk.cuiName = "-1 DR"
|
||||
|
||||
tk.color = &colorFlag
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ func (w *guiWidget) doWidgetClick() {
|
|||
child.hideWidgets()
|
||||
}
|
||||
}
|
||||
// w.dumpTree("click end")
|
||||
case widget.Checkbox:
|
||||
if w.node.State.Checked {
|
||||
log.Log(WARN, "checkbox is being set to false")
|
||||
|
|
4
junk1.go
4
junk1.go
|
@ -105,7 +105,7 @@ func addDebugKeys(g *gocui.Gui) {
|
|||
func(g *gocui.Gui, v *gocui.View) error {
|
||||
w, h := g.MousePosition()
|
||||
for _, tk := range findByXY(w, h) {
|
||||
log.Log(GOCUI, fmt.Sprintf("findByXY() msgDown() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
|
||||
log.Log(GOCUI, fmt.Sprintf("findByXY() msgDown() %s wId=%d at (%d,%d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String()))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
@ -152,7 +152,7 @@ func addDebugKeys(g *gocui.Gui) {
|
|||
g.SetKeybinding("", 'M', gocui.ModNone,
|
||||
func(g *gocui.Gui, v *gocui.View) error {
|
||||
w := me.treeRoot.TK.(*guiWidget)
|
||||
w.dumpTree("M")
|
||||
w.dumpTree("MM")
|
||||
return nil
|
||||
})
|
||||
|
||||
|
|
2
place.go
2
place.go
|
@ -35,7 +35,6 @@ func (w *guiWidget) placeBox(startW int, startH int) {
|
|||
if w.WidgetType != widget.Box {
|
||||
return
|
||||
}
|
||||
// tk.dumpTree("beforebox")
|
||||
|
||||
newW := startW
|
||||
newH := startH
|
||||
|
@ -58,7 +57,6 @@ func (w *guiWidget) placeBox(startW int, startH int) {
|
|||
}
|
||||
log.Log(INFO, "BOX END size(W,H) =", sizeW, sizeH, "new(W,H) =", newW, newH)
|
||||
}
|
||||
// tk.dumpTree("afterbox")
|
||||
}
|
||||
|
||||
func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
||||
|
|
Loading…
Reference in New Issue