From 3a28ded3e83d89d92c838b2a67d8cd034c5202c7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 1 Sep 2021 21:05:06 -0500 Subject: [PATCH] GUI: add a example for wit/gui Signed-off-by: Jeff Carr --- Makefile | 6 ++++- {test4 => example-gui}/Makefile | 0 {test4 => example-gui}/config.go | 0 {test4 => example-gui}/main.go | 5 ++-- {test2 => example-protobuf}/Makefile | 0 example-protobuf/cloud-control-panel.json | 28 +++++++++++++++++++++++ {test2 => example-protobuf}/config.go | 2 +- 7 files changed, 37 insertions(+), 4 deletions(-) rename {test4 => example-gui}/Makefile (100%) rename {test4 => example-gui}/config.go (100%) rename {test4 => example-gui}/main.go (94%) rename {test2 => example-protobuf}/Makefile (100%) create mode 100644 example-protobuf/cloud-control-panel.json rename {test2 => example-protobuf}/config.go (93%) diff --git a/Makefile b/Makefile index b2e36bb..37a34b1 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,9 @@ build: cd example-ui-table; go install # spreadsheet cd example-ui-show-hide; go install # toggle hide, show + # wit/gui things + cd example-gui; go install # an example using the wit/gui wrapper + # misc cd example-lookupAAAA; go install # nslookup cd example-json-decode; go install # raw golang byte handling @@ -34,8 +37,9 @@ build: # golang things cd example-flag; go install # process argv cd example-pprof; go install # dump out go process internals + cd example-protobuf; go install # convert json into golang protobuf struct cd example-bench-fast-timer; go install # time golang channels - cd example-bench-readWriteOps; go install # + cd example-bench-readWriteOps; go install # uses channels to time select # witgoget='-v -t' make prep # witgoget='-v -t -u' make prep # to update diff --git a/test4/Makefile b/example-gui/Makefile similarity index 100% rename from test4/Makefile rename to example-gui/Makefile diff --git a/test4/config.go b/example-gui/config.go similarity index 100% rename from test4/config.go rename to example-gui/config.go diff --git a/test4/main.go b/example-gui/main.go similarity index 94% rename from test4/main.go rename to example-gui/main.go index d38e0ed..b3294cf 100644 --- a/test4/main.go +++ b/example-gui/main.go @@ -65,10 +65,11 @@ func main() { gui.StartNewWindow(false, "test5", 2, showBox) } -func showBox(gw *gui.GuiWindow) *gui.GuiBox { +// func showBox(gw *gui.GuiWindow) *gui.GuiBox { +func showBox(gw *gui.GuiBox) *gui.GuiBox { log.Println("ShowSplashBox() START") - box := gui.HardBox(gw, gui.Yaxis, "Cloud Accounts") + box := gui.HardBox(gw.Window, gui.Yaxis, "Cloud Accounts") log.Println("showBox() START GW IS NOW: gw =", gw) log.Println("showBox() box =", box) diff --git a/test2/Makefile b/example-protobuf/Makefile similarity index 100% rename from test2/Makefile rename to example-protobuf/Makefile diff --git a/example-protobuf/cloud-control-panel.json b/example-protobuf/cloud-control-panel.json new file mode 100644 index 0000000..b9288fd --- /dev/null +++ b/example-protobuf/cloud-control-panel.json @@ -0,0 +1,28 @@ +{ + "width": 800, + "height": 600, + "accounts": [ + { + "ID": 42, + "nick": "Alpha jcarr", + "username": "jcarr@wit.com", + "email": "jcarr@wit.com", + "token": "alksjdf", + "hostname": "jcarr.customers.wprod.wit.com", + "password": "witbadpass", + "URL": "http://stackapi-api1.stackapi.customers.wprod.wit.com:4000/", + "domain": "jcarr.customers.wprod.wit.com" + }, + { + "ID": 44, + "nick": "Alpha alfonso", + "username": "alfonso@wit.com", + "email": "alfonso@wit.com", + "token": "aklsdjf", + "hostname": "alfonso.customers.wprod.wit.com", + "password": "witbadpass", + "URL": "http://stackapi-api1.stackapi.customers.wprod.wit.com:4000/", + "domain": "alfonso.customers.wprod.wit.com" + } + ] +} diff --git a/test2/config.go b/example-protobuf/config.go similarity index 93% rename from test2/config.go rename to example-protobuf/config.go index 77463f6..70cfc45 100644 --- a/test2/config.go +++ b/example-protobuf/config.go @@ -25,7 +25,7 @@ import "github.com/davecgh/go-spew/spew" func loadDefaultConfig(a string) pb.Config { sets := pb.Config{} - b, err := ioutil.ReadFile("../resources/cloud-control-panel.json") + b, err := ioutil.ReadFile("cloud-control-panel.json") if err != nil { log.Println("ioutil.ReadFile() ERROR =", err) }