diff options
Diffstat (limited to 'cmds')
| -rw-r--r-- | cmds/buttonplugin/Makefile | 6 | ||||
| -rw-r--r-- | cmds/buttonplugin/main.go | 58 | ||||
| -rw-r--r-- | cmds/textbox/Makefile | 3 | ||||
| -rw-r--r-- | cmds/textbox/main.go | 12 |
4 files changed, 43 insertions, 36 deletions
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 33d0cae..0dd17e6 100644 --- a/cmds/textbox/main.go +++ b/cmds/textbox/main.go @@ -24,7 +24,9 @@ func main() { arg.MustParse(&args) log.Println("Toolkit = ", args.Toolkit) - // gui.InitPlugins([]string{"andlabs"}) + // gui.SetDebug(true) + // gui.InitPlugins([]string{"gocui"}) + // gui.InitPlugins([]string{"democui"}) gui.Main(initGUI) } @@ -68,10 +70,10 @@ func addDemoTab(window *gui.Node, title string) { dd.AddDropdownName("more 2") dd.AddDropdownName("more 3") - g.SetNext(3,1) - g1.NewLabel("label (3,1)") - g.SetNext(3,2) - g1.NewLabel("label (3,2)") + // g.SetNext(3,1) + // g1.NewLabel("label (3,1)") + // g.SetNext(3,2) + // g1.NewLabel("label (3,2)") g2 := newNode.NewGroup("group 2") tb := g2.NewTextbox("tb") |
