summaryrefslogtreecommitdiff
path: root/action.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-10 04:37:42 -0500
committerJeff Carr <[email protected]>2025-03-10 04:37:42 -0500
commit531a31e4b32421589341047629491adeea5d4b57 (patch)
tree775537a7e4bc8ccab59bd4801d518011f32aa902 /action.go
parent154c750e024adfb385f2fc134255ba70533285eb (diff)
quiet normal init() conditions
Diffstat (limited to 'action.go')
-rw-r--r--action.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/action.go b/action.go
index c64dd49..9ed5360 100644
--- a/action.go
+++ b/action.go
@@ -13,17 +13,18 @@ import (
// everything from the application goes through here
func (me *TreeInfo) doAction(a widget.Action) {
if a.ActionType == widget.ToolkitInit {
- log.Log(TREEWARN, "tree.doAction() trapped ToolkitInit finally!")
+ log.Log(TREE, "tree.doAction() trapped ToolkitInit finally!")
a.WidgetType = widget.Root
n := addNode(&a)
me.Add(n)
- log.Log(TREEWARN, "tree.doAction() init() me.treeRoot")
- if me.ToolkitInit != nil {
- log.Log(TREEWARN, "tree.doAction() doing ToolkitInit()")
- me.ToolkitInit()
- } else {
- log.Log(TREEWARN, "tree.doAction() me.ToolkitInit() == nil")
+ log.Log(TREE, "tree.doAction() init() me.treeRoot")
+ if me.ToolkitInit == nil {
+ log.Log(TREE, "tree.doAction() ToolkitInit() was called before plugin had a chance to initialize")
+ log.Log(TREE, "tree.doAction() TODO: fix channel to pause")
+ return
}
+ log.Log(TREE, "tree.doAction() doing ToolkitInit()")
+ me.ToolkitInit()
return
}
if a.TablePB != nil {
@@ -44,6 +45,11 @@ func (me *TreeInfo) doAction(a widget.Action) {
me.Add(n)
return
}
+ if a.WidgetId == 0 {
+ // this is ok. This is the binary tree base and it's already initialized. This happens on startup
+ return
+ }
+ // this shouldn't really happen. It's good to print a warning so the plugin code can be debugged
log.Log(TREEWARN, "attempting to re-add widget", a.WidgetId, a.WidgetType, a.ActionType)
return
}