From 355e5ec968427c2b07b78fec12224f31a65df740 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 14 Nov 2022 14:30:28 -0600 Subject: setup building without plugins on windows notes from github remote keep removing os.Exit() rename from andlabs2 back to andlabs rename files for windows andlabs/ui gocui always sets STDOUT a file in /tmp/ Signed-off-by: Jeff Carr --- toolkit/andlabs-direct/common.go | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 toolkit/andlabs-direct/common.go (limited to 'toolkit/andlabs-direct/common.go') diff --git a/toolkit/andlabs-direct/common.go b/toolkit/andlabs-direct/common.go new file mode 100644 index 0000000..451f9d6 --- /dev/null +++ b/toolkit/andlabs-direct/common.go @@ -0,0 +1,61 @@ +package toolkit + +import "log" + +func init() { + if (DebugToolkit) { + log.Println("gui/toolkit init() Setting defaultBehavior = true") + } + setDefaultBehavior(true) +} + +func (t Toolkit) commonChange(widget string) { + s := t.String() + if (DebugToolkit) { + log.Println("gui.Toolkit.ui.OnChanged() =", s) + } + if (t.OnChanged != nil) { + if (DebugToolkit) { + log.Println("gui.Toolkit.OnChanged() trying to run toolkit.OnChanged() entered val =", s) + } + t.OnChanged(&t) + return + } + if (t.Custom != nil) { + if (DebugToolkit) { + log.Println("gui.Toolkit.OnChanged() Running toolkit.Custom()") + t.Dump() + } + t.Custom() + return + } + if (DebugToolkit) { + log.Println("gui.Toolkit.OnChanged() ENDED without finding any callback") + } +} + +// does some sanity checks on the internal structs of the binary tree +// TODO: probably this should not panic unless it's running in devel mode (?) +func (t *Toolkit) broken() bool { + if (t.uiBox == nil) { + if (t.uiWindow != nil) { + if (DebugToolkit) { + log.Println("gui.Toolkit.UiBox == nil. This is an empty window. Try to add a box") + } + t.NewBox() + return false + } + log.Println("gui.Toolkit.UiBox == nil. I can't add a widget without a place to put it") + // log.Println("probably could just make a box here?") + // corruption or something horrible? + panic("wit/gui toolkit/andlabs func broken() invalid goroutine access into this toolkit?") + panic("wit/gui toolkit/andlabs func broken() this probably should not cause the app to panic here (?)") + return true + } + if (t.uiWindow == nil) { + log.Println("gui.Toolkit.UiWindow == nil. I can't add a widget without a place to put it (IGNORING FOR NOW)") + forceDump(t) + return false + } + return false +} -- cgit v1.2.3