diff options
| author | Jeff Carr <[email protected]> | 2023-04-22 12:25:50 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-04-22 12:25:50 -0500 |
| commit | 52eb9b1ad29756756881b90ba5221d03cd504fbd (patch) | |
| tree | 8e80b65d20516d57797b7e3d39d44a147c7641ba /toolkit | |
| parent | 2b10d882a35d5a8b79c7d48eaa59e7d027be5e8d (diff) | |
unloading the gocui toolkit works
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit')
| -rw-r--r-- | toolkit/gocui/main.go | 1 | ||||
| -rw-r--r-- | toolkit/gocui/plugin.go | 6 | ||||
| -rw-r--r-- | toolkit/widget.go | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/toolkit/gocui/main.go b/toolkit/gocui/main.go index de35700..f0415f5 100644 --- a/toolkit/gocui/main.go +++ b/toolkit/gocui/main.go @@ -83,5 +83,6 @@ func main() { log("This is a test log entry") MouseMain() + log(true, "MouseMain() closed") me.baseGui.Close() } diff --git a/toolkit/gocui/plugin.go b/toolkit/gocui/plugin.go index ce47f20..f70ae96 100644 --- a/toolkit/gocui/plugin.go +++ b/toolkit/gocui/plugin.go @@ -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) } diff --git a/toolkit/widget.go b/toolkit/widget.go index 769bf09..21f2f47 100644 --- a/toolkit/widget.go +++ b/toolkit/widget.go @@ -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 { |
