diff --git a/cmds/buttonplugin/main.go b/cmds/buttonplugin/main.go index 6d556b3..7c62b21 100644 --- a/cmds/buttonplugin/main.go +++ b/cmds/buttonplugin/main.go @@ -16,7 +16,7 @@ var buttonCounter int = 5 func main() { // This will turn on all debugging - gui.SetDebug(true) + // gui.SetDebug(true) // myGui = gui.New().LoadToolkit("gocui") myGui = gui.New().LoadToolkit("andlabs") diff --git a/node.go b/node.go index 67c7943..85c7fb9 100644 --- a/node.go +++ b/node.go @@ -12,24 +12,6 @@ func (n *Node) newNode(title string, t toolkit.WidgetType, custom func()) *Node newN.WidgetType = t newN.Custom = custom - // TODO: This should not be defined for each widget. This has to be stupid - // or wait a second, is this where I send something to a channel? - newN.Custom = func() { - log(debugChange, "Trying to find Window Close. widgetType =", newN.WidgetType) - if (newN.WidgetType == toolkit.Window) { - log(debugChange, "Need to delete newN here") - n.Delete(newN) - } - if (newN.Custom == nil) { - log(debugChange, "newT.Custom() == nil. Not doing anything. SEND SOMETHING TO THE CHANNEL") - return - } - log(debugChange, "newT.Custom() START SEND SOMETHING TO THE CHANNEL node =", newN.Name) - // send something to the channel here???? - newN.Custom() - log(debugChange, "newT.Custom() END SEND SOMETHING TO THE CHANNEL node =", newN.Name) - } - n.Append(newN) newN.parent = n return newN 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") -} diff --git a/toolkit/andlabs/resources/ping6.broken.png b/toolkit/andlabs/resources/ping6.broken.png deleted file mode 100644 index 9a3e2ae..0000000 Binary files a/toolkit/andlabs/resources/ping6.broken.png and /dev/null differ diff --git a/toolkit/andlabs/resources/ping6.pure-bright.png b/toolkit/andlabs/resources/ping6.pure-bright.png deleted file mode 100644 index 82c554d..0000000 Binary files a/toolkit/andlabs/resources/ping6.pure-bright.png and /dev/null differ diff --git a/toolkit/andlabs/resources/ping6.pure.png b/toolkit/andlabs/resources/ping6.pure.png deleted file mode 100644 index 9e08140..0000000 Binary files a/toolkit/andlabs/resources/ping6.pure.png and /dev/null differ diff --git a/toolkit/andlabs/resources/ping6.working.png b/toolkit/andlabs/resources/ping6.working.png deleted file mode 100644 index 6767c59..0000000 Binary files a/toolkit/andlabs/resources/ping6.working.png and /dev/null differ diff --git a/toolkit/gocui/main.go b/toolkit/gocui/main.go index f0415f5..7f9958f 100644 --- a/toolkit/gocui/main.go +++ b/toolkit/gocui/main.go @@ -11,7 +11,7 @@ import ( // sets defaults and establishes communication // to this toolkit from the wit/gui golang package -func Init() { +func init() { log(logInfo, "Init() of awesome-gocui") me.defaultWidth = 10 me.defaultHeight = 2 // this means by default one line of text in a button