summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-23 10:45:43 -0500
committerJeff Carr <[email protected]>2023-04-23 10:45:43 -0500
commit7d178283f1834ddd01123a5d5d0b160bb8d7234d (patch)
tree029e95a3b339e3d5de281124b440f893ead0b5ca /toolkit/andlabs/main.go
parent1322a011e7f5b8665b671d4c5ee4e65804ca75be (diff)
more code cleanups
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/main.go')
-rw-r--r--toolkit/andlabs/main.go70
1 files changed, 8 insertions, 62 deletions
diff --git a/toolkit/andlabs/main.go b/toolkit/andlabs/main.go
index e9ac6b1..f9a7e68 100644
--- a/toolkit/andlabs/main.go
+++ b/toolkit/andlabs/main.go
@@ -2,7 +2,6 @@ package main
import (
"sync"
- "embed"
"git.wit.org/wit/gui/toolkit"
"github.com/andlabs/ui"
@@ -10,9 +9,6 @@ import (
_ "github.com/andlabs/ui/winmanifest"
)
-//go:embed resources
-var res embed.FS
-
// this is the channel we get requests to make widgets
var pluginChan chan toolkit.Action
@@ -27,32 +23,10 @@ func catchActionChannel() {
select {
case a := <-pluginChan:
log(logNow, "catchActionChannel() SELECT widget id =", a.WidgetId, a.Name)
- /*
- // go Action(a)
- if (uiMainUndef) {
- log(logError,"catchActionChannel() main() was not run yet")
- log(logError,"catchActionChannel() main() was not run yet")
- log(logError,"catchActionChannel() main() was not run yet")
- log(logError,"catchActionChannel() ui.Main() START")
- log(logError,"catchActionChannel() ui.Main() START")
- log(logError,"catchActionChannel() ui.Main() START")
- log(logError,"catchActionChannel() ui.Main() START")
- sleep(1)
- // go ui.Main(demoUI)
- // go ui.Main( func() {
- // rawAction(a)
- // })
- // probably not needed, but in here for now under development
- uiMainUndef = false
- sleep(1)
- } else {
- log(logNow, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType)
- rawAction(a)
- log(logNow, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
- }
- */
log(logNow, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType)
muAction.Lock()
+ // TODO ui.QueueMain(f)
+ // TODO ui.QueueMain( func() {rawAction(a)} )
rawAction(a)
muAction.Unlock()
log(logNow, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
@@ -60,13 +34,12 @@ func catchActionChannel() {
}
}
-/*
-func main(f func()) {
- log(debugNow, "Main() START (using gtk via andlabs/ui)")
- f() // support the old way. deprecate this
-}
-*/
-
+// Other goroutines must use this to access the GUI
+//
+// You can not acess / process the GUI thread directly from
+// other goroutines. This is due to the nature of how
+// Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
+//
// this sets the channel to send user events back from the plugin
func Callback(guiCallback chan toolkit.Action) {
callback = guiCallback
@@ -76,21 +49,6 @@ func PluginChannel() chan toolkit.Action {
return pluginChan
}
-
-// Other goroutines must use this to access the GUI
-//
-// You can not acess / process the GUI thread directly from
-// other goroutines. This is due to the nature of how
-// Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
-//
-// For example: Queue(NewWindow())
-//
-func queue(f func()) {
- log(logNow, "Sending function to ui.QueueMain()")
- log(logNow, "using gui.Queue() in this plugin DOES BREAK. TODO: solve this with channels")
- ui.QueueMain(f)
-}
-
// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc
func init() {
log(logNow, "Init() START")
@@ -107,17 +65,5 @@ func init() {
demoUI()
})
go catchActionChannel()
- /*
- // go catchActionChannel()
- go uiMain.Do(func() {
- ui.Main(demoUI)
- // go catchActionChannel()
- })
- */
log(logNow, "Init() END")
}
-
-// TODO: properly exit the plugin since Quit() doesn't do it
-func Quit() {
- log(debugToolkit, "Quit() TODO: close the toolkit cleanly")
-}