diff options
| author | Jeff Carr <[email protected]> | 2025-01-20 05:06:08 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-20 05:06:08 -0600 |
| commit | 5005edc9e37cb207f6c6035ea6fe3c3d98d94caa (patch) | |
| tree | 2ef2a0ba9fa27a2ced91572261170a93fdb5c3c6 /plugin.go | |
| parent | 250f1c756881c04720b277bbe1e56ece4988c88f (diff) | |
add a 'app' defined default plugin variablev0.22.22
Diffstat (limited to 'plugin.go')
| -rw-r--r-- | plugin.go | 40 |
1 files changed, 20 insertions, 20 deletions
@@ -56,6 +56,26 @@ type aplug struct { var allPlugins []*aplug +func (n *Node) LoadToolkit(name string) (*Node, error) { + log.Log(PLUG, "LoadToolkit() START for name =", name) + plug := initPlugin(name) + if plug == nil { + return n, errors.New("initPlugin(" + name + ") failed") + } + plug.dead = false + + log.Log(PLUG, "LoadToolkit() sending Toolkit Init action to the plugin channel") + var a widget.Action + a.ActionType = widget.ToolkitInit + plug.pluginChan <- a + // sleep(.5) // temp hack until chan communication is setup + + // TODO: find a new way to do this that is locking, safe and accurate + me.rootNode.redraw(plug) + log.Log(PLUG, "LoadToolkit() END for name =", name) + return n, nil +} + // loads and initializes a toolkit (andlabs/ui, gocui, etc) // attempts to locate the .so file func initPlugin(name string) *aplug { @@ -281,26 +301,6 @@ func (n *Node) ListToolkits() { } } -func (n *Node) LoadToolkit(name string) (*Node, error) { - log.Log(PLUG, "LoadToolkit() START for name =", name) - plug := initPlugin(name) - if plug == nil { - return n, errors.New("initPlugin(" + name + ") failed") - } - plug.dead = false - - log.Log(PLUG, "LoadToolkit() sending Toolkit Init action to the plugin channel") - var a widget.Action - a.ActionType = widget.ToolkitInit - plug.pluginChan <- a - // sleep(.5) // temp hack until chan communication is setup - - // TODO: find a new way to do this that is locking, safe and accurate - me.rootNode.redraw(plug) - log.Log(PLUG, "LoadToolkit() END for name =", name) - return n, nil -} - func (n *Node) CloseToolkit(name string) bool { log.Log(PLUG, "CloseToolkit() for name =", name) for i, plug := range allPlugins { |
