debugging output cleanups
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
99a42bf88b
commit
695f116eec
22
action.go
22
action.go
|
@ -178,27 +178,27 @@ func SetLabel(n *tree.Node, s string) {
|
|||
|
||||
func SetText(n *tree.Node, s string) {
|
||||
if n == nil {
|
||||
log.Warn("Tree Error: Add() sent n == nil")
|
||||
log.Log(WARN, "Tree Error: Add() sent n == nil")
|
||||
return
|
||||
}
|
||||
if n.TK == nil {
|
||||
log.Warn("Tree sent an action on a widget we didn't seem to have.")
|
||||
log.Log(WARN, "Tree sent an action on a widget we didn't seem to have.")
|
||||
return
|
||||
}
|
||||
setText(n, s)
|
||||
log.Info("SetText() (new)", n.WidgetType, n.String(), s)
|
||||
log.Log(ANDLABS, "SetText() (new)", n.WidgetType, n.String(), s)
|
||||
}
|
||||
|
||||
func AddText(n *tree.Node, s string) {
|
||||
if n == nil {
|
||||
log.Warn("Tree Error: Add() sent n == nil")
|
||||
log.Log(WARN, "Tree Error: Add() sent n == nil")
|
||||
return
|
||||
}
|
||||
if n.TK == nil {
|
||||
log.Warn("Tree sent an action on a widget we didn't seem to have.")
|
||||
log.Log(WARN, "Tree sent an action on a widget we didn't seem to have.")
|
||||
return
|
||||
}
|
||||
log.Info("AddText()", n.WidgetType, n.String())
|
||||
log.Log(ANDLABS, "AddText()", n.WidgetType, n.String())
|
||||
// w := n.TK.(*guiWidget)
|
||||
// w.AddText(s)
|
||||
addText(n, s)
|
||||
|
@ -207,11 +207,11 @@ func AddText(n *tree.Node, s string) {
|
|||
func newAction(n *tree.Node, atype widget.ActionType) {
|
||||
log.Log(INFO, "newaction() START", atype)
|
||||
if n == nil {
|
||||
log.Warn("Tree Error: Add() sent n == nil")
|
||||
log.Log(WARN, "Tree Error: Add() sent n == nil")
|
||||
return
|
||||
}
|
||||
if n.TK == nil {
|
||||
log.Warn("Tree sent an action on a widget we didn't seem to have.")
|
||||
log.Log(WARN, "Tree sent an action on a widget we didn't seem to have.")
|
||||
// do this init here again? Probably something
|
||||
// went wrong and we should reset the our while gocui.View tree
|
||||
n.TK = initWidget(n)
|
||||
|
@ -219,13 +219,13 @@ func newAction(n *tree.Node, atype widget.ActionType) {
|
|||
// w := n.TK.(*guiWidget)
|
||||
switch atype {
|
||||
case widget.Show:
|
||||
log.Log(NOW, "Show() HERE. a.Hidden() was =", n.Hidden())
|
||||
log.Log(ANDLABS, "Show() HERE. a.Hidden() was =", n.Hidden())
|
||||
show(n, true)
|
||||
case widget.Hide:
|
||||
log.Log(NOW, "Hide() HERE. a.State.Hidden was =", n.Hidden())
|
||||
log.Log(ANDLABS, "Hide() HERE. a.State.Hidden was =", n.Hidden())
|
||||
hide(n)
|
||||
case widget.Move:
|
||||
log.Log(NOW, "attempt to move() =", atype, n.WidgetType, n.ProgName())
|
||||
log.Log(ANDLABS, "attempt to move() =", atype, n.WidgetType, n.ProgName())
|
||||
case widget.ToolkitClose:
|
||||
log.Log(NOW, "attempting to Quit andlabs.ui")
|
||||
// standardClose()
|
||||
|
|
10
add.go
10
add.go
|
@ -30,13 +30,13 @@ func add(n *tree.Node) {
|
|||
newSlider(p, n)
|
||||
case widget.Dropdown:
|
||||
newDropdown(p, n)
|
||||
setText(n, n.State.DefaultS)
|
||||
// setText(n, n.State.DefaultS)
|
||||
case widget.Combobox:
|
||||
newCombobox(p, n)
|
||||
setText(n, n.State.DefaultS)
|
||||
// setText(n, n.State.DefaultS)
|
||||
case widget.Textbox:
|
||||
newTextbox(p, n)
|
||||
setText(n, n.State.DefaultS)
|
||||
// setText(n, n.State.DefaultS)
|
||||
/*
|
||||
case widget.Image:
|
||||
newImage(p, n)
|
||||
|
@ -48,7 +48,7 @@ func add(n *tree.Node) {
|
|||
|
||||
func newAdd(n *tree.Node) {
|
||||
if n == nil {
|
||||
log.Warn("Tree Error: Add() sent n == nil")
|
||||
log.Log(WARN, "Tree Error: Add() sent n == nil")
|
||||
return
|
||||
}
|
||||
if n.WidgetType == widget.Root {
|
||||
|
@ -57,7 +57,7 @@ func newAdd(n *tree.Node) {
|
|||
}
|
||||
add(n)
|
||||
if n.TK == nil {
|
||||
log.Warn("Tree sent an action on a widget we didn't seem to have.")
|
||||
log.Log(WARN, "Tree sent an action on a widget we didn't seem to have.")
|
||||
// do this init here again? Probably something
|
||||
// went wrong and we should reset the our while gocui.View tree
|
||||
n.TK = initWidget(n)
|
||||
|
|
12
combobox.go
12
combobox.go
|
@ -34,11 +34,11 @@ func newCombobox(p, n *tree.Node) {
|
|||
log.Log(ANDLABS, "add combobox entries on create:", n.State.Strings)
|
||||
// add the initial combobox entries
|
||||
for i, s := range n.State.Strings {
|
||||
log.Log(ANDLABS, "add combobox entries on create", n.GetProgName(), i, s)
|
||||
log.Log(ANDLABS, "add combobox entries on create progname:", n.GetProgName(), "State.Strings =", i, s)
|
||||
addComboboxName(n, s)
|
||||
}
|
||||
cur := n.String()
|
||||
log.Log(ANDLABS, "add combobox: set default value on create to", n.GetProgName(), cur)
|
||||
cur := n.CurrentS()
|
||||
log.Log(ANDLABS, "add combobox: set default value on create to", cur)
|
||||
setComboboxName(n, cur)
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ func addComboboxName(n *tree.Node, s string) {
|
|||
}
|
||||
var tk *guiWidget
|
||||
tk = n.TK.(*guiWidget)
|
||||
log.Log(INFO, "addComboboxName()", n.WidgetId, "add:", s)
|
||||
log.Log(ANDLABS, "addComboboxName()", n.WidgetId, "add:", s)
|
||||
|
||||
tk.uiEditableCombobox.Append(s)
|
||||
if tk.val == nil {
|
||||
|
@ -59,7 +59,7 @@ func addComboboxName(n *tree.Node, s string) {
|
|||
|
||||
// If this is the first menu added, set the dropdown to it
|
||||
if tk.c == 0 {
|
||||
log.Log(INFO, "THIS IS THE FIRST combobox", s)
|
||||
log.Log(ANDLABS, "addComboboxName() first string:", s)
|
||||
tk.uiEditableCombobox.SetText(s)
|
||||
}
|
||||
tk.c = tk.c + 1
|
||||
|
@ -71,7 +71,7 @@ func setComboboxName(n *tree.Node, s string) bool {
|
|||
}
|
||||
var tk *guiWidget
|
||||
tk = n.TK.(*guiWidget)
|
||||
log.Log(INFO, "SetComboboxName()", n.WidgetId, ",", s)
|
||||
log.Log(ANDLABS, "SetComboboxName()", n.WidgetId, ",", s)
|
||||
tk.uiEditableCombobox.SetText(s)
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -99,6 +99,6 @@ func setDropdownName(n *tree.Node, s string) bool {
|
|||
return true
|
||||
}
|
||||
}
|
||||
log.Warn("SetDropdownName() failed", s, n.WidgetId, n.GetProgName())
|
||||
log.Log(WARN, "SetDropdownName() failed", s, n.WidgetId, n.GetProgName())
|
||||
return false
|
||||
}
|
||||
|
|
5
flags.go
5
flags.go
|
@ -11,11 +11,9 @@ import (
|
|||
var NOW *log.LogFlag
|
||||
var INFO *log.LogFlag
|
||||
|
||||
var SPEW *log.LogFlag
|
||||
var WARN *log.LogFlag
|
||||
|
||||
var ERROR *log.LogFlag
|
||||
var CHANGE *log.LogFlag
|
||||
var ANDLABS *log.LogFlag
|
||||
|
||||
func init() {
|
||||
|
@ -26,9 +24,6 @@ func init() {
|
|||
INFO = log.NewFlag("INFO", false, full, short, "normal debugging stuff")
|
||||
|
||||
WARN = log.NewFlag("WARN", false, full, short, "bad things")
|
||||
SPEW = log.NewFlag("SPEW", false, full, short, "spew stuff")
|
||||
|
||||
CHANGE = log.NewFlag("CHANGE", false, full, short, "show when the user does things")
|
||||
|
||||
full = "go.wit.com/gui"
|
||||
short = "andlabs"
|
||||
|
|
10
main.go
10
main.go
|
@ -64,7 +64,7 @@ func queueMain(currentA widget.Action) {
|
|||
// this never happends
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Warn("YAHOOOO Recovered in queueMain() application:", r)
|
||||
log.Log("YAHOOOO Recovered in queueMain() application:", r)
|
||||
log.Println("Recovered from panic:", r)
|
||||
log.Println("Stack trace:")
|
||||
debug.PrintStack()
|
||||
|
@ -87,9 +87,9 @@ func queueMain(currentA widget.Action) {
|
|||
func guiMain() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Warn("YAHOOOO Recovered in guiMain application:", r)
|
||||
log.Warn("Recovered from panic:", r)
|
||||
log.Warn("Stack trace:")
|
||||
log.Log(WARN, "YAHOOOO Recovered in guiMain application:", r)
|
||||
log.Log(WARN, "Recovered from panic:", r)
|
||||
log.Log(WARN, "Stack trace:")
|
||||
debug.PrintStack()
|
||||
me.myTree.SendToolkitPanic()
|
||||
return
|
||||
|
@ -108,7 +108,7 @@ func guiMain() {
|
|||
}
|
||||
|
||||
func Init() {
|
||||
log.Warn("Init() TODO: move init() to here")
|
||||
log.Log(WARN, "Init() TODO: move init() to here")
|
||||
}
|
||||
|
||||
// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc
|
||||
|
|
16
setText.go
16
setText.go
|
@ -11,17 +11,15 @@ func setText(n *tree.Node, name string) {
|
|||
var tk *guiWidget
|
||||
tk = n.TK.(*guiWidget)
|
||||
|
||||
log.Info("setText() START with text =", name, n.WidgetType)
|
||||
log.Log(CHANGE, "setText() START with text =", name)
|
||||
log.Log(ANDLABS, "setText() START with text =", name, n.WidgetType)
|
||||
if tk == nil {
|
||||
log.Log(ERROR, "setText error. tk == nil", n.GetProgName(), n.WidgetId)
|
||||
return
|
||||
}
|
||||
log.Log(CHANGE, "setText() Attempt on", n.WidgetType, "with", name)
|
||||
|
||||
switch n.WidgetType {
|
||||
case widget.Window:
|
||||
log.Log(CHANGE, "setText() Attempt to set the title to", name)
|
||||
log.Log(ANDLABS, "setText() Attempt to set the title to", name)
|
||||
tk.uiWindow.SetTitle(name)
|
||||
case widget.Tab:
|
||||
case widget.Group:
|
||||
|
@ -29,7 +27,7 @@ func setText(n *tree.Node, name string) {
|
|||
case widget.Checkbox:
|
||||
tk.uiCheckbox.SetText(name)
|
||||
case widget.Textbox:
|
||||
log.Info("setText() on Textbox START with text =", name)
|
||||
log.Log(ANDLABS, "setText() on Textbox START with text =", name)
|
||||
if tk.uiEntry != nil {
|
||||
tk.uiEntry.SetText(name)
|
||||
}
|
||||
|
@ -49,13 +47,13 @@ func setText(n *tree.Node, name string) {
|
|||
var i int = -1
|
||||
var s string
|
||||
orig = tk.uiCombobox.Selected()
|
||||
log.Log(CHANGE, "try to set the Dropdown to", name, "from", orig)
|
||||
log.Log(ANDLABS, "try to set the Dropdown to", name, "from", orig)
|
||||
// try to find the string
|
||||
for i, s = range tk.val {
|
||||
log.Log(CHANGE, "i, s", i, s)
|
||||
log.Log(ANDLABS, "i, s", i, s)
|
||||
if name == s {
|
||||
tk.uiCombobox.SetSelected(i)
|
||||
log.Log(CHANGE, "setText() Dropdown worked.", name)
|
||||
log.Log(ANDLABS, "setText() Dropdown worked.", name)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -73,5 +71,5 @@ func setText(n *tree.Node, name string) {
|
|||
default:
|
||||
log.Log(ERROR, "plugin Send() Don't know how to setText on", n.WidgetType, "yet")
|
||||
}
|
||||
log.Log(CHANGE, "setText() END with name =")
|
||||
log.Log(ANDLABS, "setText() END with name =")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue