summaryrefslogtreecommitdiff
path: root/andlabs/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-15 16:11:40 -0600
committerJeff Carr <[email protected]>2024-01-15 16:11:40 -0600
commit29c39d7a1cbc1f071fa819e589fa6ed93fcb7d80 (patch)
tree4081338b6e1ed2e1cc26f3153f1eee3070873558 /andlabs/main.go
parent708ea661988fd0e4886fc63f3f6dffe25b6fa276 (diff)
Destroy window and node from binary treev0.12.3
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'andlabs/main.go')
-rw-r--r--andlabs/main.go33
1 files changed, 26 insertions, 7 deletions
diff --git a/andlabs/main.go b/andlabs/main.go
index ac52a5c..5a6d383 100644
--- a/andlabs/main.go
+++ b/andlabs/main.go
@@ -5,15 +5,26 @@ import (
"go.wit.com/log"
"go.wit.com/gui/widget"
- "github.com/andlabs/ui"
+ "go.wit.com/dev/andlabs/ui"
// the _ means we only need this for the init()
- _ "github.com/andlabs/ui/winmanifest"
+ _ "go.wit.com/dev/andlabs/ui/winmanifest"
)
var uiMainUndef bool = true
var uiMain sync.Once
var muAction sync.Mutex
+func queueMain(currentA widget.Action) {
+ defer func() {
+ if r := recover(); r != nil {
+ log.Warn("YAHOOOO Recovered in main application:", r)
+ }
+ }()
+ ui.QueueMain( func() {
+ rawAction(&currentA)
+ })
+}
+
func catchActionChannel() {
log.Log(INFO, "catchActionChannel() START")
for {
@@ -25,14 +36,25 @@ func catchActionChannel() {
muAction.Lock()
// TODO ui.QueueMain(f)
// TODO ui.QueueMain( func() {rawAction(a)} )
- ui.QueueMain( func() {rawAction(&a)} )
// rawAction(a)
+ queueMain(a)
muAction.Unlock()
log.Log(INFO, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
}
}
}
+func guiMain() {
+ defer func() {
+ if r := recover(); r != nil {
+ log.Warn("YAHOOOO Recovered in main application:", r)
+ }
+ }()
+ ui.Main(func() {
+ demoUI()
+ })
+}
+
// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc
func init() {
log.Log(INFO, "Init() START")
@@ -41,13 +63,10 @@ func init() {
// log.Log(INFO, "init() Setting defaultBehavior = true")
setDefaultBehavior(true)
-
// TODO: this is messed up. run ui.Main() from the first add? Initialize it with an empty thing first?
// fake out the OS toolkit by making a fake window. This is probably needed for macos & windows
// actually, this probably breaks the macos build
- go ui.Main(func() {
- demoUI()
- })
+ go guiMain()
// andlabs = make(map[int]*andlabsT)
pluginChan = make(chan widget.Action, 1)