summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--event.go39
-rw-r--r--init.go16
2 files changed, 27 insertions, 28 deletions
diff --git a/event.go b/event.go
index d2383af..8414c15 100644
--- a/event.go
+++ b/event.go
@@ -16,9 +16,9 @@ import (
"go.wit.com/widget"
)
-func (me *TreeInfo) DoEnableDebugger() {
+func (me *TreeInfo) SendEnableDebugger() {
if me.callback == nil {
- log.Warn("DoUserEvent() toolkit panic() callback == nil")
+ log.Warn("SendUserEvent() toolkit panic() callback == nil")
return
}
var a widget.Action
@@ -28,61 +28,64 @@ func (me *TreeInfo) DoEnableDebugger() {
return
}
-func (me *TreeInfo) DoToolkitLoad(s string) {
+func (me *TreeInfo) SendToolkitLoad(s string) {
if me.callback == nil {
- log.Warn("DoUserEvent() toolkit load callback == nil")
+ log.Warn("SendUserEvent() toolkit load callback == nil")
return
}
var a widget.Action
a.ActionType = widget.ToolkitLoad
a.ProgName = me.PluginName
a.Value = s
- log.Warn("DoUserEvent() START: toolkit load", s)
+ log.Warn("SendUserEvent() START: toolkit load", s)
me.callback <- a
- log.Warn("DoUserEvent() END: toolkit load", s)
+ log.Warn("SendUserEvent() END: toolkit load", s)
return
}
-func (me *TreeInfo) DoToolkitPanic() {
+func (me *TreeInfo) SendToolkitPanic() {
if me.callback == nil {
- log.Warn("DoUserEvent() toolkit panic() callback == nil")
+ log.Warn("SendUserEvent() toolkit panic() callback == nil")
return
}
var a widget.Action
a.ActionType = widget.ToolkitPanic
a.ProgName = me.PluginName
- log.Info("DoUserEvent() START: toolkit panic()")
+ log.Info("SendUserEvent() START: toolkit panic()")
me.callback <- a
- log.Info("DoUserEvent() END: toolkit panic()")
+ log.Info("SendUserEvent() END: toolkit panic()")
return
}
-func (me *TreeInfo) DoWindowCloseEvent(n *Node) {
+func (me *TreeInfo) SendWindowCloseEvent(n *Node) {
if me.callback == nil {
- log.Warn("DoUserEvent() callback == nil", n.WidgetId)
+ log.Warn("SendUserEvent() callback == nil", n.WidgetId)
return
}
var a widget.Action
a.WidgetId = n.WidgetId
a.ActionType = widget.CloseWindow
- log.Info("DoUserEvent() START: user closed the window", n.GetProgName())
+ log.Info("SendUserEvent() START: user closed the window", n.GetProgName())
me.callback <- a
- log.Info("DoUserEvent() END: user closed the window", n.GetProgName())
+ log.Info("SendUserEvent() END: user closed the window", n.GetProgName())
return
}
// Other goroutines must use this to access the GUI
-func (me *TreeInfo) DoUserEvent(n *Node) {
+func (me *TreeInfo) SendUserEvent(n *Node) {
if me.callback == nil {
- log.Warn("DoUserEvent() callback == nil", n.WidgetId)
+ log.Warn("SendUserEvent() callback == nil", n.WidgetId)
return
}
var a widget.Action
a.WidgetId = n.WidgetId
a.Value = n.State.Value
a.ActionType = widget.User
- log.Info("DoUserEvent() START: send a user event to the callback channel")
+ if n.WidgetType == widget.Checkbox {
+ log.Info("SendUserEvent() checkbox going to send:", a.Value)
+ }
+ log.Info("SendUserEvent() START: send a user event to the callback channel")
me.callback <- a
- log.Info("DoUserEvent() END: sent a user event to the callback channel")
+ log.Info("SendUserEvent() END: sent a user event to the callback channel")
return
}
diff --git a/init.go b/init.go
index 9c6ef5d..ba82b78 100644
--- a/init.go
+++ b/init.go
@@ -10,19 +10,11 @@ import (
var muAction sync.Mutex
-func (me *TreeInfo) toolkit(a widget.Action) {
- if me.ActionFromChannel == nil {
- log.Error(errors.New("toolkit ActionFromChannel == nil"), a.WidgetId, a.ActionType, a.WidgetType)
- return
- }
- me.ActionFromChannel(a)
-}
-
func (me *TreeInfo) catchActionChannel() {
defer func() {
if r := recover(); r != nil {
log.Warn(me.PluginName, "tree YAHOOOO Recovered in simpleStdin()", r)
- me.DoToolkitPanic()
+ me.SendToolkitPanic()
panic(-1)
}
}()
@@ -43,7 +35,11 @@ func (me *TreeInfo) catchActionChannel() {
*/
muAction.Lock()
// send this to the toolkit
- me.toolkit(a)
+ if me.ActionFromChannel == nil {
+ log.Error(errors.New("toolkit ActionFromChannel == nil"), a.WidgetId, a.ActionType, a.WidgetType)
+ } else {
+ me.ActionFromChannel(a)
+ }
muAction.Unlock()
// log.Info("catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
}