diff options
| author | Jeff Carr <[email protected]> | 2022-11-06 19:57:20 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-11-06 19:57:20 -0600 |
| commit | b410d0fd083ee89eed410cda2123a22cddcd3f44 (patch) | |
| tree | 3f1a637003629a3ec7d383b5db6beb0df9e5a97c /toolkit/andlabs | |
| parent | e55fb6675d692e3f44fa67b02b12661e476bd028 (diff) | |
Implement a early AddButton() via a golang pluginv0.4.5
pass a name to gocui.AddButton()
cleaner plugin usage
add the start to golang plugin
plugin stuff in a single file
added a button correctly
andlabs/ui added a button via plugin to gocli
hot diggity!
trying to invoke a gocli plugin function from the andlabs ui
load the plugin
hide more debugging output
turn off all output
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs')
| -rw-r--r-- | toolkit/andlabs/box.go | 20 | ||||
| -rw-r--r-- | toolkit/andlabs/common.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/main.go | 8 | ||||
| -rw-r--r-- | toolkit/andlabs/structs.go | 6 | ||||
| -rw-r--r-- | toolkit/andlabs/window.go | 12 |
5 files changed, 40 insertions, 14 deletions
diff --git a/toolkit/andlabs/box.go b/toolkit/andlabs/box.go index 8347bab..29a8331 100644 --- a/toolkit/andlabs/box.go +++ b/toolkit/andlabs/box.go @@ -12,10 +12,14 @@ func (t *Toolkit) GetBox() *ui.Box { // create a new box func (t *Toolkit) NewBox() *Toolkit { - log.Println("gui.Toolbox.NewBox() START create default") + if (DebugToolkit) { + log.Println("gui.Toolbox.NewBox() START create default") + } t.Dump() if (t.uiGroup != nil) { - log.Println("\tgui.Toolbox.NewBox() is a Group") + if (DebugToolkit) { + log.Println("\tgui.Toolbox.NewBox() is a Group") + } var newTK Toolkit vbox := ui.NewVerticalBox() @@ -26,7 +30,9 @@ func (t *Toolkit) NewBox() *Toolkit { return &newTK } if (t.uiBox != nil) { - log.Println("\tgui.Toolbox.NewBox() is a Box") + if (DebugToolkit) { + log.Println("\tgui.Toolbox.NewBox() is a Box") + } var newTK Toolkit vbox := ui.NewVerticalBox() @@ -38,7 +44,9 @@ func (t *Toolkit) NewBox() *Toolkit { return &newTK } if (t.uiWindow != nil) { - log.Println("\tgui.Toolbox.NewBox() is a Window") + if (DebugToolkit) { + log.Println("\tgui.Toolbox.NewBox() is a Window") + } var newT Toolkit vbox := ui.NewVerticalBox() @@ -50,7 +58,9 @@ func (t *Toolkit) NewBox() *Toolkit { // panic("WTF") return &newT } - log.Println("\tgui.Toolbox.NewBox() FAILED. Couldn't figure out where to make a box") + if (DebugToolkit) { + log.Println("\tgui.Toolbox.NewBox() FAILED. Couldn't figure out where to make a box") + } t.Dump() return nil } diff --git a/toolkit/andlabs/common.go b/toolkit/andlabs/common.go index e997aca..451f9d6 100644 --- a/toolkit/andlabs/common.go +++ b/toolkit/andlabs/common.go @@ -3,7 +3,9 @@ package toolkit import "log" func init() { - log.Println("gui/toolkit init() Setting defaultBehavior = true") + if (DebugToolkit) { + log.Println("gui/toolkit init() Setting defaultBehavior = true") + } setDefaultBehavior(true) } @@ -37,7 +39,9 @@ func (t Toolkit) commonChange(widget string) { func (t *Toolkit) broken() bool { if (t.uiBox == nil) { if (t.uiWindow != nil) { - log.Println("gui.Toolkit.UiBox == nil. This is an empty window. Try to add a box") + if (DebugToolkit) { + log.Println("gui.Toolkit.UiBox == nil. This is an empty window. Try to add a box") + } t.NewBox() return false } diff --git a/toolkit/andlabs/main.go b/toolkit/andlabs/main.go index d1dc7e6..da639fa 100644 --- a/toolkit/andlabs/main.go +++ b/toolkit/andlabs/main.go @@ -9,7 +9,9 @@ import ( ) func Main(f func()) { - log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + if (DebugToolkit) { + log.Println("Starting gui.Main() (using gtk via andlabs/ui)") + } ui.Main(f) } @@ -22,6 +24,8 @@ func Main(f func()) { // For example: Queue(NewWindow()) // func Queue(f func()) { - log.Println("Sending function to gui.Main() (using gtk via andlabs/ui)") + if (DebugToolkit) { + log.Println("Sending function to gui.Main() (using gtk via andlabs/ui)") + } ui.QueueMain(f) } diff --git a/toolkit/andlabs/structs.go b/toolkit/andlabs/structs.go index 374627c..9bba671 100644 --- a/toolkit/andlabs/structs.go +++ b/toolkit/andlabs/structs.go @@ -21,8 +21,10 @@ var DebugToolkit bool func setDefaultBehavior(s bool) { defaultBehavior = s if (defaultBehavior) { - log.Println("Setting this toolkit to use the default behavior.") - log.Println("This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.") + if (DebugToolkit) { + log.Println("Setting this toolkit to use the default behavior.") + log.Println("This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.") + } stretchy = false padded = true menubar = true diff --git a/toolkit/andlabs/window.go b/toolkit/andlabs/window.go index 3e5f16a..efbd672 100644 --- a/toolkit/andlabs/window.go +++ b/toolkit/andlabs/window.go @@ -17,7 +17,9 @@ func (t *Toolkit) ErrorWindow(msg1 string, msg2 string) { func NewWindow(title string, x int, y int) *Toolkit { var t Toolkit - log.Println("toolkit NewWindow", title, x, y) + if (DebugToolkit) { + log.Println("toolkit NewWindow", title, x, y) + } w := ui.NewWindow(title, x, y, menubar) w.SetBorderless(canvas) w.SetMargined(margin) @@ -50,11 +52,15 @@ func NewWindow(title string, x int, y int) *Toolkit { } func (t *Toolkit) SetWindowTitle(title string) { - log.Println("toolkit NewWindow", t.Name, "title", title) + if (DebugToolkit) { + log.Println("toolkit NewWindow", t.Name, "title", title) + } win := t.uiWindow if (win != nil) { win.SetTitle(title) } else { - log.Println("Setting the window title", title) + if (DebugToolkit) { + log.Println("Setting the window title", title) + } } } |
