implement --gui-debug command line option

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-12-29 17:51:42 -06:00
parent 4eae0a3e07
commit ff20e79426
1 changed files with 24 additions and 0 deletions

24
main.go
View File

@ -2,6 +2,7 @@ package gui
import ( import (
"os" "os"
"time"
"go.wit.com/gui/toolkit" "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 // try to load andlabs, if that doesn't work, fall back to the console
func (n *Node) Default() *Node { func (n *Node) Default() *Node {
// start the GUI debugger if --gui-debug is true
checkDebug()
if (argGui.GuiPlugin != "") { if (argGui.GuiPlugin != "") {
log(logError, "New.Default() try toolkit =", argGui.GuiPlugin) log(logError, "New.Default() try toolkit =", argGui.GuiPlugin)
return n.LoadToolkit(argGui.GuiPlugin) return n.LoadToolkit(argGui.GuiPlugin)
@ -142,6 +146,26 @@ func (n *Node) Default() *Node {
return n 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 // The window is destroyed but the application does not quit
func (n *Node) StandardClose() { func (n *Node) StandardClose() {
log(debugGui, "wit/gui Standard Window Close. name =", n.Name) log(debugGui, "wit/gui Standard Window Close. name =", n.Name)