diff options
Diffstat (limited to 'nocui/main.go')
| -rw-r--r-- | nocui/main.go | 55 |
1 files changed, 12 insertions, 43 deletions
diff --git a/nocui/main.go b/nocui/main.go index f6cfb3b..ebf3fae 100644 --- a/nocui/main.go +++ b/nocui/main.go @@ -1,55 +1,24 @@ package main -import ( - "sync" - "go.wit.com/log" - "go.wit.com/gui/widget" -) - -var muAction sync.Mutex - -func catchActionChannel() { - log.Log(NOW, "catchActionChannel() START") - for { - log.Log(NOW, "catchActionChannel() for loop") - select { - case a := <-pluginChan: - log.Log(NOW, "catchActionChannel() SELECT widget id =", a.WidgetId, a.ProgName) - log.Log(NOW, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType) - muAction.Lock() - doAction(&a) - muAction.Unlock() - log.Log(NOW, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType) - } - } -} - /* -// Other goroutines must use this to access the GUI -// -// You can not acess / process the GUI thread directly from -// other goroutines. This is due to the nature of how -// Linux, MacOS and Windows work (they all work differently. suprise. surprise.) -// -// this sets the channel to send user events back from the plugin -func Callback(guiCallback chan widget.Action) { - callback = guiCallback -} + This is reference code for toolkit developers -func PluginChannel() chan widget.Action { - return pluginChan -} + The 'nocui' is a bare minimum toolkit. It's all you need + to interact with the GUI */ -// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc +import ( + "go.wit.com/log" + "go.wit.com/gui/toolkits/tree" +) + func init() { log.Log(INFO, "Init()") - // andlabs = make(map[int]*andlabsT) - pluginChan = make(chan widget.Action, 1) + me.myTree = tree.New() + me.myTree.PluginName = "nocui" + me.myTree.ActionFromChannel = doAction - log.Log(NOW, "Init() start channel reciever") - go catchActionChannel() go simpleStdin() - log.Log(NOW, "Init() END") + log.Log(INFO, "Init() END") } |
