CLEAN: clean up labels
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
9a07e2b2af
commit
e907164e17
|
@ -0,0 +1,35 @@
|
||||||
|
package gui
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
// "github.com/andlabs/ui"
|
||||||
|
// _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
// "github.com/davecgh/go-spew/spew"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func FindWindow(s string) *GuiWindow {
|
||||||
|
for name, window := range Data.WindowMap {
|
||||||
|
if name == s {
|
||||||
|
return window
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Printf("COULD NOT FIND WINDOW", s)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindBox(s string) *GuiBox {
|
||||||
|
for name, window := range Data.WindowMap {
|
||||||
|
if name != s {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for name, abox := range window.BoxMap {
|
||||||
|
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
||||||
|
return abox
|
||||||
|
}
|
||||||
|
log.Println("gui.FindBox() NEED TO INIT WINDOW name =", name)
|
||||||
|
}
|
||||||
|
log.Println("gui.FindBox() COULD NOT FIND BOX", s)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -26,10 +26,13 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initGUI() {
|
func initGUI() {
|
||||||
n := gui.NewWindow("jcarr start", 640, 480)
|
n := gui.NewWindow("WIT GUI Example Window", 640, 480)
|
||||||
n.AddDemoTab("up the rabbit hole")
|
n.AddDemoTab("A Simple Tab Demo")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This demonstrates how to properly interact with the GUI
|
||||||
|
// You can not involke the GUI from external goroutines in most cases.
|
||||||
|
|
||||||
func watchGUI() {
|
func watchGUI() {
|
||||||
var i = 1
|
var i = 1
|
||||||
for {
|
for {
|
||||||
|
@ -37,7 +40,7 @@ func watchGUI() {
|
||||||
i += 1
|
i += 1
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
if i == 4 {
|
if i == 4 {
|
||||||
log.Println("Sending ExampleWindow to gui.Queue()")
|
log.Println("Opening a Debug Window via the gui.Queue()")
|
||||||
gui.Queue(gui.DebugWindow)
|
gui.Queue(gui.DebugWindow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
gui.go
2
gui.go
|
@ -23,7 +23,7 @@ func init() {
|
||||||
Data.NodeSlice = make([]*Node, 0)
|
Data.NodeSlice = make([]*Node, 0)
|
||||||
|
|
||||||
Config.counter = 0
|
Config.counter = 0
|
||||||
Config.prefix = "jwc"
|
Config.prefix = "wit"
|
||||||
Config.DebugNode = false
|
Config.DebugNode = false
|
||||||
Config.DebugTabs = false
|
Config.DebugTabs = false
|
||||||
}
|
}
|
||||||
|
|
14
main.go
14
main.go
|
@ -40,17 +40,3 @@ func ExampleWindow() {
|
||||||
|
|
||||||
window.UiWindow.Show()
|
window.UiWindow.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
func DebugWindow() {
|
|
||||||
log.Println("START gui.ExampleWindow()")
|
|
||||||
|
|
||||||
title := "Debug Window"
|
|
||||||
node := InitWindow(nil, nil, title, 0)
|
|
||||||
box := node.box
|
|
||||||
window := box.Window
|
|
||||||
log.Println("box =", box)
|
|
||||||
log.Println("window =", window)
|
|
||||||
node.AddDebugTab("jcarr Debug")
|
|
||||||
|
|
||||||
window.UiWindow.Show()
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,6 +11,20 @@ import (
|
||||||
var names = make([]string, 100)
|
var names = make([]string, 100)
|
||||||
var nodeNames = make([]string, 100)
|
var nodeNames = make([]string, 100)
|
||||||
|
|
||||||
|
func DebugWindow() {
|
||||||
|
log.Println("START gui.DebugWindow()")
|
||||||
|
|
||||||
|
title := "WIT GUI Debug Window"
|
||||||
|
node := InitWindow(nil, nil, title, 0)
|
||||||
|
box := node.box
|
||||||
|
window := box.Window
|
||||||
|
log.Println("box =", box)
|
||||||
|
log.Println("window =", window)
|
||||||
|
node.AddDebugTab("WIT GUI Debug Tab")
|
||||||
|
|
||||||
|
window.UiWindow.Show()
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: remove this crap
|
// TODO: remove this crap
|
||||||
// What does this actually do?
|
// What does this actually do?
|
||||||
// It populates the nodeNames in a map. No, not a map, an array. What is the difference again?
|
// It populates the nodeNames in a map. No, not a map, an array. What is the difference again?
|
||||||
|
@ -278,31 +292,6 @@ func addGroup(b *ui.Box, name string) *ui.Box {
|
||||||
return vbox
|
return vbox
|
||||||
}
|
}
|
||||||
|
|
||||||
func FindWindow(s string) *GuiWindow {
|
|
||||||
for name, window := range Data.WindowMap {
|
|
||||||
if name == s {
|
|
||||||
return window
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Printf("COULD NOT FIND WINDOW", s)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func FindBox(s string) *GuiBox {
|
|
||||||
for name, window := range Data.WindowMap {
|
|
||||||
if name != s {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for name, abox := range window.BoxMap {
|
|
||||||
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
|
||||||
return abox
|
|
||||||
}
|
|
||||||
log.Println("gui.FindBox() NEED TO INIT WINDOW name =", name)
|
|
||||||
}
|
|
||||||
log.Println("gui.FindBox() COULD NOT FIND BOX", s)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func dumpBox(s string) {
|
func dumpBox(s string) {
|
||||||
var name string
|
var name string
|
||||||
var window *GuiWindow
|
var window *GuiWindow
|
||||||
|
|
Loading…
Reference in New Issue