diff options
| author | Jeff Carr <[email protected]> | 2024-01-17 21:21:29 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-17 21:21:29 -0600 |
| commit | a6a3e1193fa7c77165f3ed2eb0031f319b4abdd0 (patch) | |
| tree | 2c5a9fbf4dbc5f7bd5cb235542082da5eba342c6 /main.go | |
| parent | 8ef3fc7a73a004385d36561c6c8acc4be7e3e24b (diff) | |
work around a toolkit panic()v0.12.11
things should work when
GUI is not really there
Int() and Bool()
helloworld works
compiles and runs
RawWindow shouldn't auto exit
add StandardExit()
Signed-off-by: Jeff Carr <[email protected]>
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 56 |
1 files changed, 55 insertions, 1 deletions
@@ -60,7 +60,7 @@ func (n *Node) findId(i int) (*Node) { func watchCallback() { log.Info("guiChan() START") for { - log.Info("guiChan() restarted") + log.Info("guiChan() select restarted") select { case a := <-me.guiChan: if (a.ActionType == widget.UserQuit) { @@ -69,9 +69,52 @@ func watchCallback() { log.Exit("wit/gui toolkit.UserQuit") break } + if (a.ActionType == widget.CloseWindow) { + log.Warn("guiChan() Close Window") + StandardExit() + break + } + if (a.ActionType == widget.ToolkitPanic) { + log.Warn("guiChan() Toolkit panic() in", a.ProgName) + log.Warn("guiChan() unload toolkit plugin here", a.ProgName) + me.rootNode.ListToolkits() + for _, aplug := range allPlugins { + log.Warn("ListToolkits() already loaded toolkit plugin =", aplug.name) + if aplug.name == a.ProgName { + log.Warn("FOUND PLUGIN =", aplug.name) + log.Warn("unload here") + log.Warn("panic on purpose") + me.rootNode.CloseToolkit(aplug.name) + // panic("panic trapped!") + // log.Sleep(.5) + // me.rootNode.LoadToolkit("gocui") + break + } + } + // StandardExit() + me.rootNode.LoadToolkit("nocui") + break + } + if (a.ActionType == widget.ToolkitLoad) { + newPlug := widget.GetString(a.Value) + log.Warn("Attempt to load a new toolkit", newPlug, "here") + me.rootNode.LoadToolkit(newPlug) + } if (a.ActionType == widget.EnableDebug) { log.Warn("guiChan() Enable Debugging Window") log.Warn("guiChan() TODO: not implemented") + log.Warn("guiChan() Listing Toolkits:") + PLUG.Set(true) + me.rootNode.ListToolkits() + me.rootNode.ListChildren(true) + for i, aplug := range allPlugins { + log.Warn("plug =", i, aplug.name) + if aplug.name == "andlabs" { + log.Warn("Found plug =", i, aplug.name) + //closePlugin(aplug) + allPlugins = allPlugins[1:] + } + } // DebugWindow() break } @@ -191,3 +234,14 @@ func StandardExit() { } log.Exit(0) } + +// The window is destroyed and the application exits +// TODO: properly exit the plugin since Quit() doesn't do it +func (n *Node) StandardExit() { + log.Log(NOW, "wit/gui Standard Window Exit. running os.Exit()") + log.Log(NOW, "StandardExit() attempt to exit each toolkit plugin") + for i, plug := range allPlugins { + log.Log(NOW, "NewButton()", i, plug) + } + log.Exit(0) +} |
