diff options
Diffstat (limited to 'toolkit/andlabs')
| -rw-r--r-- | toolkit/andlabs/main.go | 15 | ||||
| -rw-r--r-- | toolkit/andlabs/plugin.go | 16 |
2 files changed, 24 insertions, 7 deletions
diff --git a/toolkit/andlabs/main.go b/toolkit/andlabs/main.go index 5a99421..e9ac6b1 100644 --- a/toolkit/andlabs/main.go +++ b/toolkit/andlabs/main.go @@ -24,9 +24,6 @@ func catchActionChannel() { log(logNow, "catchActionChannel() START") for { log(logNow, "catchActionChannel() for loop") - uiMain.Do(func() { - go ui.Main(demoUI) - }) select { case a := <-pluginChan: log(logNow, "catchActionChannel() SELECT widget id =", a.WidgetId, a.Name) @@ -95,7 +92,7 @@ func queue(f func()) { } // This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc -func Init() { +func init() { log(logNow, "Init() START") log(debugToolkit, "Init()") // Can you pass values to a plugin init() ? Otherwise, there is no way to safely print @@ -106,7 +103,17 @@ func Init() { pluginChan = make(chan toolkit.Action, 1) log(logNow, "Init() start channel reciever") + go ui.Main(func() { + demoUI() + }) go catchActionChannel() + /* + // go catchActionChannel() + go uiMain.Do(func() { + ui.Main(demoUI) + // go catchActionChannel() + }) + */ log(logNow, "Init() END") } diff --git a/toolkit/andlabs/plugin.go b/toolkit/andlabs/plugin.go index f9befd5..a7205fb 100644 --- a/toolkit/andlabs/plugin.go +++ b/toolkit/andlabs/plugin.go @@ -24,6 +24,7 @@ func Send(p *toolkit.Widget, c *toolkit.Widget) { } */ +/* func oldAction2(a *toolkit.Action) { log(logNow, "Action() START") if (a == nil) { @@ -31,22 +32,31 @@ func oldAction2(a *toolkit.Action) { return } pluginChan <- *a - /* + f := func() { rawAction(a) } // f() Queue(f) - */ log(logNow, "Action() END") } - +*/ func rawAction(a toolkit.Action) { log(debugAction, "rawAction() START a.ActionType =", a.ActionType) log(debugAction, "rawAction() START a.S =", a.S) + if (a.ActionType == toolkit.InitToolkit) { + // TODO: make sure to only do this once + // go uiMain.Do(func() { + // ui.Main(demoUI) + // go catchActionChannel() + // }) + // try doing this on toolkit load in init() + return + } + log(logNow, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId) switch a.WidgetType { case toolkit.Flag: |
