unloading the gocui toolkit works
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
535f15f741
commit
37dee72c32
|
@ -146,7 +146,7 @@ attempts to locate the .so file
|
|||
|
||||
`func ShowDebugValues()`
|
||||
|
||||
### func [StandardExit](/main.go#L153)
|
||||
### func [StandardExit](/main.go#L169)
|
||||
|
||||
`func StandardExit()`
|
||||
|
||||
|
@ -187,7 +187,7 @@ var Config GuiConfig
|
|||
The Node is a binary tree. This is how all GUI elements are stored
|
||||
simply the name and the size of whatever GUI element exists
|
||||
|
||||
#### func [New](/main.go#L126)
|
||||
#### func [New](/main.go#L142)
|
||||
|
||||
`func New() *Node`
|
||||
|
||||
|
|
18
main.go
18
main.go
|
@ -112,13 +112,29 @@ func (n *Node) doUserEvent(a toolkit.Action) {
|
|||
}
|
||||
|
||||
func (n *Node) LoadToolkit(name string) *Node {
|
||||
log(logInfo, "Start() Main(f) for name =", name)
|
||||
log(logInfo, "LoadToolkit() for name =", name)
|
||||
if (FindPlugin(name) == nil) {
|
||||
return n
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *Node) CloseToolkit(name string) bool {
|
||||
log(logInfo, "CloseToolkit() for name =", name)
|
||||
for _, aplug := range allPlugins {
|
||||
log(debugGui, "CloseToolkit() found", aplug.name)
|
||||
if (aplug.name == name) {
|
||||
log(debugNow, "CloseToolkit() sending close", name)
|
||||
var a toolkit.Action
|
||||
a.ActionType = toolkit.CloseToolkit
|
||||
aplug.pluginChan <- a
|
||||
sleep(.5)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// There should only be one of these per application
|
||||
// This is due to restrictions by being cross platform
|
||||
// some toolkit's on some operating systems don't support more than one
|
||||
|
|
|
@ -83,5 +83,6 @@ func main() {
|
|||
log("This is a test log entry")
|
||||
|
||||
MouseMain()
|
||||
log(true, "MouseMain() closed")
|
||||
me.baseGui.Close()
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
// if you include more than just this import
|
||||
// then your plugin might be doing something un-ideal (just a guess from 2023/02/27)
|
||||
"git.wit.org/wit/gui/toolkit"
|
||||
|
@ -38,6 +39,11 @@ func action(a *toolkit.Action) {
|
|||
w.AddText(a.S)
|
||||
case toolkit.Move:
|
||||
log(logNow, "attempt to move() =", a.ActionType, a.WidgetType, a.Name)
|
||||
case toolkit.CloseToolkit:
|
||||
log(logNow, "attempting to close the plugin and release stdout and stderr")
|
||||
me.baseGui.Close()
|
||||
// defer outf.Close()
|
||||
setOutput(os.Stdout)
|
||||
default:
|
||||
log(logError, "action() Unknown =", a.ActionType, a.WidgetType, a.Name)
|
||||
}
|
||||
|
|
|
@ -109,7 +109,6 @@ const (
|
|||
|
||||
const (
|
||||
Add ActionType = iota
|
||||
User // the user did something (mouse, keyboard, etc)
|
||||
Delete
|
||||
Get
|
||||
Set
|
||||
|
@ -127,7 +126,9 @@ const (
|
|||
Append
|
||||
Move
|
||||
Dump
|
||||
Quit
|
||||
User // the user did something (mouse, keyboard, etc)
|
||||
InitToolkit // initializes the toolkit
|
||||
CloseToolkit // closes the toolkit
|
||||
)
|
||||
|
||||
func (s WidgetType) String() string {
|
||||
|
|
Loading…
Reference in New Issue