diff options
Diffstat (limited to 'andlabs/action.go')
| -rw-r--r-- | andlabs/action.go | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/andlabs/action.go b/andlabs/action.go index 57cbdba..7a723b1 100644 --- a/andlabs/action.go +++ b/andlabs/action.go @@ -3,6 +3,8 @@ package main import ( "strconv" "github.com/andlabs/ui" + + "go.wit.com/log" "go.wit.com/gui/widget" ) @@ -38,11 +40,11 @@ func (n *node) enable(b bool) { } func (n *node) pad(at widget.ActionType) { - log(logInfo, "pad() on WidgetId =", n.WidgetId) + log.Log(INFO, "pad() on WidgetId =", n.WidgetId) t := n.tk if (t == nil) { - log(logError, "pad() toolkit struct == nil. for", n.WidgetId) + log.Log(ERROR, "pad() toolkit struct == nil. for", n.WidgetId) return } @@ -103,9 +105,9 @@ func (n *node) pad(at widget.ActionType) { t.uiBox.SetPadded(false) } case widget.Textbox: - log(debugError, "TODO: implement ActionType =", at) + log.Log(ERROR, "TODO: implement ActionType =", at) default: - log(debugError, "TODO: implement pad() for", at) + log.Log(ERROR, "TODO: implement pad() for", at) } } @@ -121,29 +123,29 @@ func (n *node) move(newParent *node) { case widget.Grid: // t.uiGrid.SetPadded(true) case widget.Box: - log(logInfo, "TODO: move() where =", p.ParentId) - log(logInfo, "TODO: move() for widget =", n.WidgetId) + log.Log(INFO, "TODO: move() where =", p.ParentId) + log.Log(INFO, "TODO: move() for widget =", n.WidgetId) stretchy = true if (p.tk.uiBox != nil) { p.tk.uiBox.Append(n.tk.uiControl, stretchy) } - // log(debugNow, "is there a tParent parent? =", tParent.parent) + // log.Log(NOW, "is there a tParent parent? =", tParent.parent) // tParent.uiBox.Delete(0) // this didn't work: // tWidget.uiControl.Disable() // sleep(.8) default: - log(logError, "TODO: need to implement move() for type =", n.WidgetType) - log(logError, "TODO: need to implement move() for where =", p.ParentId) - log(logError, "TODO: need to implement move() for widget =", n.WidgetId) + log.Log(ERROR, "TODO: need to implement move() for type =", n.WidgetType) + log.Log(ERROR, "TODO: need to implement move() for where =", p.ParentId) + log.Log(ERROR, "TODO: need to implement move() for widget =", n.WidgetId) } } func (n *node) Delete() { p := n.parent - log(debugNow, "uiDelete()", n.WidgetId, "to", p.WidgetId) + log.Log(NOW, "uiDelete()", n.WidgetId, "to", p.WidgetId) switch p.WidgetType { case widget.Group: @@ -155,10 +157,10 @@ func (n *node) Delete() { case widget.Grid: // t.uiGrid.SetPadded(true) case widget.Box: - log(debugNow, "tWidget.boxC =", p.Name) - log(debugNow, "is there a tParent parent? =", p.parent) + log.Log(NOW, "tWidget.boxC =", p.Name) + log.Log(NOW, "is there a tParent parent? =", p.parent) if (p.tk.boxC < 1) { - log(debugNow, "Can not delete from Box. already empty. tWidget.boxC =", p.tk.boxC) + log.Log(NOW, "Can not delete from Box. already empty. tWidget.boxC =", p.tk.boxC) return } p.tk.uiBox.Delete(0) @@ -169,14 +171,14 @@ func (n *node) Delete() { // sleep(.8) // tParent.uiBox.Append(tWidget.uiControl, stretchy) default: - log(debugError, "TODO: need to implement uiDelete() for widget =", n.WidgetId, n.WidgetType) - log(debugError, "TODO: need to implement uiDelete() for parent =", p.WidgetId, p.WidgetType) + log.Log(ERROR, "TODO: need to implement uiDelete() for widget =", n.WidgetId, n.WidgetType) + log.Log(ERROR, "TODO: need to implement uiDelete() for parent =", p.WidgetId, p.WidgetType) } } func rawAction(a *widget.Action) { - log(logInfo, "rawAction() START a.ActionType =", a.ActionType) - log(logInfo, "rawAction() START a.S =", a.S) + log.Log(INFO, "rawAction() START a.ActionType =", a.ActionType) + log.Log(INFO, "rawAction() START a.S =", a.S) if (a.ActionType == widget.InitToolkit) { // TODO: make sure to only do this once @@ -188,10 +190,10 @@ func rawAction(a *widget.Action) { return } - log(logInfo, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId) + log.Log(INFO, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId) switch a.WidgetType { case widget.Flag: - flag(a) + log.Log(ERROR, "rawAction() RE-IMPLEMENT LOG FLAGS") return } @@ -207,17 +209,17 @@ func rawAction(a *widget.Action) { } if (a.ActionType == widget.Dump) { - log(debugNow, "rawAction() Dump =", a.ActionType, a.WidgetType, n.Name) + log.Log(NOW, "rawAction() Dump =", a.ActionType, a.WidgetType, n.Name) me.rootNode.listChildren(true) return } if (n == nil) { me.rootNode.listChildren(true) - log(true, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType) - log(true, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId) - log(true, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType) - log(true, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId) + log.Log(NOW, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType) + log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId) + log.Log(NOW, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType) + log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId) return panic("findWidgetId found nil for id = " + strconv.Itoa(a.WidgetId)) } @@ -255,11 +257,11 @@ func rawAction(a *widget.Action) { case widget.Delete: n.Delete() case widget.Move: - log(debugNow, "rawAction() attempt to move() =", a.ActionType, a.WidgetType) + log.Log(NOW, "rawAction() attempt to move() =", a.ActionType, a.WidgetType) newParent := me.rootNode.findWidgetId(a.ParentId) n.move(newParent) default: - log(debugError, "rawAction() Unknown =", a.ActionType, a.WidgetType) + log.Log(ERROR, "rawAction() Unknown =", a.ActionType, a.WidgetType) } - log(logInfo, "rawAction() END =", a.ActionType, a.WidgetType) + log.Log(INFO, "rawAction() END =", a.ActionType, a.WidgetType) } |
