summaryrefslogtreecommitdiff
path: root/toolkit/andlabs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/andlabs')
-rw-r--r--toolkit/andlabs/add.go4
-rw-r--r--toolkit/andlabs/main.go41
-rw-r--r--toolkit/andlabs/window.go6
3 files changed, 20 insertions, 31 deletions
diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go
index e6f3305..2f35e99 100644
--- a/toolkit/andlabs/add.go
+++ b/toolkit/andlabs/add.go
@@ -29,7 +29,7 @@ func add(a *toolkit.Action) {
// for now, window gets handled without checking where == nil)
if (a.WidgetType == toolkit.Window) {
- doWindow(a)
+ newWindow(*a)
return
}
@@ -44,7 +44,7 @@ func add(a *toolkit.Action) {
switch a.WidgetType {
case toolkit.Window:
- doWindow(a)
+ newWindow(*a)
return
case toolkit.Tab:
log(debugError, "add() CAME AT THIS FROM add() =", a.Name)
diff --git a/toolkit/andlabs/main.go b/toolkit/andlabs/main.go
index c107038..8466abf 100644
--- a/toolkit/andlabs/main.go
+++ b/toolkit/andlabs/main.go
@@ -15,6 +15,8 @@ var res embed.FS
// this is the channel we get requests to make widgets
var pluginChan chan toolkit.Action
+var uiMain bool = false
+
func catchActionChannel() {
log(logNow, "makeCallback() START")
for {
@@ -25,11 +27,19 @@ func catchActionChannel() {
// go Action(a)
if (a.WidgetType == toolkit.Window) {
log(logNow, "makeCallback() WINDOW START")
- go ui.Main( func() {
- log(logNow, "ui.Main() WINDOW START DOING NOTHING")
- newWindow(&a)
- log(logNow, "ui.Main() WINDOW END")
- })
+ // this is a hack for now
+ // if uiMain == true, ui.Main() has already started
+ if (uiMain) {
+ log(logNow, "WINDOW START newWindow(&a)")
+ newWindow(a)
+ } else {
+ go ui.Main( func() {
+ log(logNow, "ui.Main() WINDOW START DOING NOTHING")
+ newWindow(a)
+ log(logNow, "ui.Main() WINDOW END")
+ })
+ uiMain = true
+ }
sleep(.5)
log(logNow, "makeCallback() WINDOW END")
} else {
@@ -43,7 +53,7 @@ func catchActionChannel() {
}
func Main(f func()) {
- log(debugNow, "gui.Main() START (using gtk via andlabs/ui)")
+ log(debugNow, "Main() START (using gtk via andlabs/ui)")
f() // support the old way. deprecate this
}
@@ -79,28 +89,11 @@ func Init() {
// log(debugToolkit, "gui/toolkit init() Setting defaultBehavior = true")
setDefaultBehavior(true)
- // mapWidgets = make(map[*andlabsT]*toolkit.Widget)
- // mapToolkits = make(map[*toolkit.Widget]*andlabsT)
-
andlabs = make(map[int]*andlabsT)
pluginChan = make(chan toolkit.Action)
- log(logNow, "Init() ui.Main() start")
+ log(logNow, "Init() start channel reciever")
go catchActionChannel()
- /*
- ui.Main( func() {
- log(logNow, "gui.Main() IN (using gtk via andlabs/ui)")
- var a toolkit.Action
- a.Name = "jcarr"
- a.Width = 640
- a.Height = 480
- a.WidgetId = 0
- newWindow(&a)
- // time.Sleep(1 * time.Second)
- // NewWindow2("helloworld2", 200, 100)
- log(logNow, "gui.Main() EXIT (using gtk via andlabs/ui)")
- })
- */
log(logNow, "Init() END")
}
diff --git a/toolkit/andlabs/window.go b/toolkit/andlabs/window.go
index 9e2e950..34245d8 100644
--- a/toolkit/andlabs/window.go
+++ b/toolkit/andlabs/window.go
@@ -15,7 +15,7 @@ func (t *andlabsT) ErrorWindow(msg1 string, msg2 string) {
ui.MsgBoxError(t.uiWindow, msg1, msg2)
}
-func newWindow(a *toolkit.Action) {
+func newWindow(a toolkit.Action) {
var newt *andlabsT
newt = new(andlabsT)
@@ -49,7 +49,3 @@ func (t *andlabsT) SetWindowTitle(title string) {
log(debugToolkit, "Setting the window title", title)
}
}
-
-func doWindow(a *toolkit.Action) {
- newWindow(a)
-}