diff options
Diffstat (limited to 'cmds/buttonplugin')
| -rw-r--r-- | cmds/buttonplugin/Makefile | 26 | ||||
| -rw-r--r-- | cmds/buttonplugin/log.go | 78 | ||||
| -rw-r--r-- | cmds/buttonplugin/main.go | 104 |
3 files changed, 0 insertions, 208 deletions
diff --git a/cmds/buttonplugin/Makefile b/cmds/buttonplugin/Makefile deleted file mode 100644 index 74486e5..0000000 --- a/cmds/buttonplugin/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# with andlabs plugin loaded: -# PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND -# 180006 jcarr 20 0 1918460 41688 31152 S 0.7 0.3 0:00.27 buttonplugin - -# with gocui plugin loaded: -# 180365 jcarr 20 0 1392668 24364 12596 S 2.0 0.2 0:00.09 buttonplugin -# - -run: build - ./buttonplugin --gui gocui >/tmp/witgui.log.stderr 2>&1 - -build-release: - go get -v -u -x . - go build - ./buttonplugin - -build: - GO111MODULE="off" go get -v -x . - GO111MODULE="off" go build - -update: - GO111MODULE="off" go get -v -u -x . - -log: - reset - tail -f /tmp/witgui.* /tmp/guilogfile diff --git a/cmds/buttonplugin/log.go b/cmds/buttonplugin/log.go deleted file mode 100644 index 7d65d05..0000000 --- a/cmds/buttonplugin/log.go +++ /dev/null @@ -1,78 +0,0 @@ -// This creates a simple hello world window -package main - -import ( - "fmt" - arg "github.com/alexflint/go-arg" - "git.wit.org/wit/gui" - log "git.wit.org/wit/gui/log" -) - - -var args struct { - Foo string - Bar bool - User string `arg:"env:USER"` - Demo bool `help:"run a demo"` - gui.GuiArgs - log.LogArgs -} - -/* -var f1 *os.File -var f2 *os.File -var err error -*/ - -func init() { - arg.MustParse(&args) - fmt.Println(args.Foo, args.Bar, args.User) - - if (args.Gui != "") { - gui.GuiArg.Gui = args.Gui - } - log.Log(true, "INIT() args.GuiArg.Gui =", gui.GuiArg.Gui) - -/* - log.Println() - log.Println("STDOUT is now at /tmp/guilogfile") - log.Println("STDOUT is now at /tmp/guilogfile") - log.Println() - f1, err = os.OpenFile(outfile, os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666) - if err != nil { - log.Fatalf("error opening file: %v", err) - } - // hmm. is there a trick here or must this be in main() - // defer f.Close() - - log.SetOutput(f1) - log.Println("This is a test log entry") -*/ -} - -/* -func captureSTDOUT() { - f2, _ = os.OpenFile("/tmp/my.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0664) - multiWriter := io.MultiWriter(os.Stderr, f2) - rd, wr, err := os.Pipe() - if err != nil { - os.Exit(1) - } - - // overwrite os.Stdout - os.Stderr = wr - - go func() { - scanner := bufio.NewScanner(rd) - for scanner.Scan() { - stdoutLine := scanner.Text() - multiWriter.Write([]byte(stdoutLine + "\n")) - } - }() - - fmt.Println("foobar") - - // hacky sleep to ensure the go routine can write before program exits - time.Sleep(time.Second) -} -*/ diff --git a/cmds/buttonplugin/main.go b/cmds/buttonplugin/main.go deleted file mode 100644 index 3200e9e..0000000 --- a/cmds/buttonplugin/main.go +++ /dev/null @@ -1,104 +0,0 @@ -// This is a simple example -package main - -import ( - "fmt" - "log" - "strconv" - "git.wit.org/wit/gui" -) - -var title string = "Demo Plugin Window" -var outfile string = "/tmp/guilogfile" -var myGui *gui.Node - -var buttonCounter int = 5 -var gridW int = 5 -var gridH int = 3 - -func main() { - // This will turn on all debugging - // gui.SetDebug(true) - - myGui = gui.New().Default() - buttonWindow() - - // This is just a optional goroutine to watch that things are alive - gui.Watchdog() - gui.StandardExit() -} - -// This creates a window -func buttonWindow() { - var w, t, g, more, more2 *gui.Node - - log.Println("buttonWindow() START") - - w = myGui.NewWindow(title).SetText("Nueva Ventana de Botones") - t = w.NewTab("buttonTab is this thing") - g = t.NewGroup("buttonGroup") - g1 := t.NewGroup("buttonGroup 2") - more = g1.NewGroup("more") - g1.NewButton("hello2", func () { - log.Println("world2") - }) - more2 = g1.NewGrid("gridnuts", gridW, gridH) - - more2.NewLabel("more2") - - g.NewButton("this app is useful for plugin debuggin", func () { - }) - g.NewLabel("STDOUT is set to: " + outfile) - - g.NewButton("hello", func () { - log.Println("world") - }) - - g.NewButton("Load 'gocui'", func () { - // this set the xterm and mate-terminal window title. maybe works generally? - fmt.Println("\033]0;" + title + "blah \007") - myGui.LoadToolkit("gocui") - }) - - g.NewButton("Load 'andlabs'", func () { - myGui.LoadToolkit("andlabs") - }) - - g.NewButton("NewButton(more)", func () { - name := "foobar " + strconv.Itoa(buttonCounter) - log.Println("NewButton(more) Adding button", name) - buttonCounter += 1 - more.NewButton(name, func () { - log.Println("Got all the way to main() name =", name) - }) - }) - - g.NewButton("NewButton(more2)", func () { - name := "foobar " + strconv.Itoa(buttonCounter) - log.Println("NewButton(more2) Adding button", name) - buttonCounter += 1 - more2.NewButton(name, func () { - log.Println("Got all the way to main() name =", name) - }) - }) - - g.NewButton("NewButton(more2 d)", func () { - name := "d" + strconv.Itoa(buttonCounter) - log.Println("NewButton(more2 d) Adding button", name) - buttonCounter += 1 - more2.NewButton(name, func () { - log.Println("Got all the way to main() name =", name) - }) - }) - - g.NewButton("NewGroup()", func () { - name := "neat " + strconv.Itoa(buttonCounter) - log.Println("NewGroup() Adding button", name) - buttonCounter += 1 - more.NewGroup(name) - }) - - g.NewButton("gui.DebugWindow()", func () { - gui.DebugWindow() - }) -} |
