summaryrefslogtreecommitdiff
path: root/toolkit/gocui/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-08 00:28:33 -0500
committerJeff Carr <[email protected]>2023-04-08 00:28:33 -0500
commit55b5aed5c4837c8de131925966b328f43bb03b61 (patch)
treee66bd66d675d352c4efa3ce0fcbfa818527e9c8d /toolkit/gocui/main.go
parent56b4aa8014baa8205459545dc27a173cbbcbee16 (diff)
both andlabs & gocui plugins have working channels
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/main.go')
-rw-r--r--toolkit/gocui/main.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/toolkit/gocui/main.go b/toolkit/gocui/main.go
index b115786..2365f6f 100644
--- a/toolkit/gocui/main.go
+++ b/toolkit/gocui/main.go
@@ -33,6 +33,23 @@ func Callback(guiCallback chan toolkit.Action) {
me.callback = guiCallback
}
+func PluginChannel() chan toolkit.Action {
+ return me.pluginChan
+}
+
+func catchActionChannel() {
+ log(logNow, "makeCallback() START")
+ for {
+ log(logNow, "makeCallback() for loop")
+ select {
+ case a := <-me.pluginChan:
+ log(logNow, "makeCallback() SELECT widget id =", a.WidgetId, a.Name)
+ Action(&a)
+ sleep(.1)
+ }
+ }
+}
+
func Exit() {
// TODO: send exit to the plugin
me.baseGui.Close()
@@ -50,6 +67,10 @@ func Main(f func()) {
setOutput(outf)
log("This is a test log entry")
+ if (me.pluginChan == nil) {
+ me.pluginChan = make(chan toolkit.Action)
+ }
+ go catchActionChannel()
MouseMain()
me.baseGui.Close()
}