summaryrefslogtreecommitdiff
path: root/plugin.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-12 17:00:44 -0600
committerJeff Carr <[email protected]>2025-02-12 17:00:44 -0600
commit827a258a867a652ea2207877d3dc7541d1afca26 (patch)
treeefe8914aecc31343e239ad663de2491168e0d09c /plugin.go
parentdb0986fa06245a1173aa3a3b654e7df25117acdc (diff)
initOnce()
Diffstat (limited to 'plugin.go')
-rw-r--r--plugin.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugin.go b/plugin.go
index 61ae47f..426e500 100644
--- a/plugin.go
+++ b/plugin.go
@@ -9,6 +9,8 @@ package tree
*/
import (
+ "time"
+
"go.wit.com/widget"
)
@@ -36,6 +38,21 @@ func (n *Node) FindWidgetId(id int) *Node {
return nil
}
+func (me *TreeInfo) InitOK() {
+ me.ok = true
+}
+
+// this hack is to wait for the application to send something
+// before trying to do anything. todo: rethink this someday
+func (me *TreeInfo) waitOK() {
+ for {
+ if me.ok {
+ return
+ }
+ time.Sleep(10 * time.Millisecond)
+ }
+}
+
// Other goroutines must use this to access the GUI
//
// You can not acess / process the GUI thread directly from
@@ -47,6 +64,8 @@ func (me *TreeInfo) Callback(guiCallback chan widget.Action) {
me.callback = guiCallback
}
+// this is the function that receives things from the application
func (me *TreeInfo) PluginChannel() chan widget.Action {
+ me.waitOK()
return me.pluginChan
}