From ff20e794264253b1ecc2f65dfdebe9ed67c1e261 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 29 Dec 2023 17:51:42 -0600 Subject: [PATCH] implement --gui-debug command line option Signed-off-by: Jeff Carr --- main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/main.go b/main.go index b2054b9..3254d0a 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package gui import ( "os" + "time" "go.wit.com/gui/toolkit" ) @@ -123,6 +124,9 @@ func New() *Node { // try to load andlabs, if that doesn't work, fall back to the console func (n *Node) Default() *Node { + // start the GUI debugger if --gui-debug is true + checkDebug() + if (argGui.GuiPlugin != "") { log(logError, "New.Default() try toolkit =", argGui.GuiPlugin) return n.LoadToolkit(argGui.GuiPlugin) @@ -142,6 +146,26 @@ func (n *Node) Default() *Node { return n } +func checkDebug() { + if ! ArgDebug() { + return + } + f := func() { + log(debugGui, "wit/gui START DEBUG") + log(debugGui, "wit/gui START DEBUG") + log(debugGui, "wit/gui START DEBUG") + time.Sleep(2 * time.Second) + log(debugGui, "wit/gui START DEBUG") + log(debugGui, "wit/gui START DEBUG") + log(debugGui, "wit/gui START DEBUG") + DebugWindow() + log(debugGui, "wit/gui END DEBUG") + log(debugGui, "wit/gui END DEBUG") + log(debugGui, "wit/gui END DEBUG") + } + go f() +} + // The window is destroyed but the application does not quit func (n *Node) StandardClose() { log(debugGui, "wit/gui Standard Window Close. name =", n.Name)