From 947169df5a22c9f9b53f825764747f648c70ff1e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 29 Mar 2023 22:44:08 -0500 Subject: ready for version v0.7.4 start deprecating toolkit.Widget switch to variable name 'ParentId' use 'ActionType' and 'WidgetType' preliminary redraw() final definition of variables 'Name' and 'Text' more cleaning of the code remove lots of dumb code bind 'd' key press to dump out debugging info early color handling in gocui! Signed-off-by: Jeff Carr --- cmds/buttonplugin/Makefile | 6 ++++- cmds/buttonplugin/main.go | 58 +++++++++++++++++++++++----------------------- cmds/textbox/Makefile | 3 ++- cmds/textbox/main.go | 2 +- 4 files changed, 37 insertions(+), 32 deletions(-) (limited to 'cmds') diff --git a/cmds/buttonplugin/Makefile b/cmds/buttonplugin/Makefile index 49d190c..12c23a8 100644 --- a/cmds/buttonplugin/Makefile +++ b/cmds/buttonplugin/Makefile @@ -8,7 +8,7 @@ run: build # ./buttonplugin >/tmp/buttonplugin.log 2>&1 - ./buttonplugin + ./buttonplugin >/tmp/witgui.log.stderr 2>&1 build-release: go get -v -u -x . @@ -21,3 +21,7 @@ build: update: GO111MODULE="off" go get -v -u -x . + +log: + reset + tail -f /tmp/witgui.* /tmp/guilogfile diff --git a/cmds/buttonplugin/main.go b/cmds/buttonplugin/main.go index 8a76a8b..b7f97d5 100644 --- a/cmds/buttonplugin/main.go +++ b/cmds/buttonplugin/main.go @@ -12,11 +12,7 @@ import ( var title string = "Demo Plugin Window" var outfile string = "/tmp/guilogfile" -// this is broken. delete this - func main() { - // this set the xterm and mate-terminal window title. maybe works generally? - fmt.Println("\033]0;" + title + "\007") // time.Sleep(5 * time.Second) // var w *gui.Node @@ -54,27 +50,49 @@ var counter int = 5 // This creates a window func buttonWindow() { - var w, g *gui.Node + var w, t, g, more, more2 *gui.Node gui.Config.Title = title gui.Config.Width = 640 gui.Config.Height = 480 w = gui.NewWindow() - g = w.NewGroup("buttonGroup") + t = w.NewTab("buttonTab") + g = t.NewGroup("buttonGroup") - g.NewButton("this app is old", func () { + g.NewButton("this app is useful for plugin debuggin", func () { }) g.NewLabel("STDOUT is set to: " + outfile) g.NewButton("hello", func () { log.Println("world") }) + more = g.NewGroup("more") + + g.NewButton("Load 'democui'", func () { + // this set the xterm and mate-terminal window title. maybe works generally? + fmt.Println("\033]0;" + title + "blah \007") + gui.StartS("democui") + }) + + g.NewButton("Redraw 'democui'", func () { + fmt.Println("\033]0;" + title + "blah2 \007") + gui.Redraw("democui") + }) + + g.NewButton("NewButton(more)", func () { + log.Println("new foobar 2. Adding button 'foobar 3'") + name := "foobar " + strconv.Itoa(counter) + counter += 1 + more.NewButton(name, func () { + log.Println("Got all the way to main() name =", name) + }) + }) - g.NewButton("NewButton()", func () { + g.NewButton("NewButton(more2)", func () { log.Println("new foobar 2. Adding button 'foobar 3'") name := "foobar " + strconv.Itoa(counter) counter += 1 - g.NewButton(name, func () { + more2.NewButton(name, func () { log.Println("Got all the way to main() name =", name) }) }) @@ -83,30 +101,12 @@ func buttonWindow() { log.Println("new foobar 2. Adding button 'foobar 3'") name := "neat " + strconv.Itoa(counter) counter += 1 - g.NewGroup(name) + more.NewGroup(name) }) g.NewButton("gui.DebugWindow()", func () { gui.DebugWindow() }) - g.NewButton("LoadToolkit(andlabs)", func () { - gui.LoadToolkit("andlabs") - }) - - g.NewButton("LoadToolkit(gocui)", func () { - gui.LoadToolkit("gocui") - }) - - g.NewButton("Init()", func () { - log.Println("gui.Init() is deprecated(?)") - //gui.Init() - }) - - g.NewButton("Main()", func () { - go gui.Main(func () { - w := gui.NewWindow() - w.NewGroup("buttonGroup") - }) - }) + more2 = g.NewGroup("more2") } diff --git a/cmds/textbox/Makefile b/cmds/textbox/Makefile index 6ca4329..5785c10 100644 --- a/cmds/textbox/Makefile +++ b/cmds/textbox/Makefile @@ -1,5 +1,6 @@ run: build - GOTRACEBACK=all ./textbox --gui-debug + # GOTRACEBACK=all ./textbox --gui-debug + GOTRACEBACK=all ./textbox --gui-debug >/tmp/witgui.log.stderr 2>&1 build-release: go get -v -u -x . diff --git a/cmds/textbox/main.go b/cmds/textbox/main.go index b2c7e6d..0dd17e6 100644 --- a/cmds/textbox/main.go +++ b/cmds/textbox/main.go @@ -24,7 +24,7 @@ func main() { arg.MustParse(&args) log.Println("Toolkit = ", args.Toolkit) - gui.SetDebug(true) + // gui.SetDebug(true) // gui.InitPlugins([]string{"gocui"}) // gui.InitPlugins([]string{"democui"}) gui.Main(initGUI) -- cgit v1.2.3