diff options
| author | Jeff Carr <[email protected]> | 2025-02-12 17:00:44 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-12 17:00:44 -0600 |
| commit | 827a258a867a652ea2207877d3dc7541d1afca26 (patch) | |
| tree | efe8914aecc31343e239ad663de2491168e0d09c /plugin.go | |
| parent | db0986fa06245a1173aa3a3b654e7df25117acdc (diff) | |
initOnce()
Diffstat (limited to 'plugin.go')
| -rw-r--r-- | plugin.go | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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 } |
