2019-05-24 02:53:34 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
import "time"
|
|
|
|
import "fmt"
|
2019-06-02 15:40:44 -05:00
|
|
|
// import "reflect"
|
2019-05-24 02:53:34 -05:00
|
|
|
|
2019-06-02 08:39:48 -05:00
|
|
|
// import "github.com/andlabs/ui"
|
|
|
|
// import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
// import "github.com/davecgh/go-spew/spew"
|
2019-05-24 17:35:41 -05:00
|
|
|
// import pb "git.wit.com/wit/witProtobuf"
|
2019-05-24 02:53:34 -05:00
|
|
|
|
2019-06-01 23:15:55 -05:00
|
|
|
//
|
|
|
|
// this watches the GUI primarily to process protobuf's
|
|
|
|
// this is pointless or wrong but I use it for debugging
|
|
|
|
//
|
|
|
|
func WatchGUI() {
|
|
|
|
count := 0
|
|
|
|
|
|
|
|
for {
|
|
|
|
if (count > 20) {
|
2019-06-03 00:22:04 -05:00
|
|
|
log.Println("Sleep() in watchGUI()")
|
2019-06-03 14:56:33 -05:00
|
|
|
if (Config.Debug) {
|
|
|
|
DumpBoxes()
|
2019-06-01 23:15:55 -05:00
|
|
|
}
|
|
|
|
count = 0
|
|
|
|
}
|
|
|
|
count += 1
|
|
|
|
time.Sleep(200 * time.Millisecond)
|
|
|
|
}
|
|
|
|
}
|
2019-06-02 14:08:53 -05:00
|
|
|
|
2019-06-03 14:56:33 -05:00
|
|
|
func DumpBoxes() {
|
2019-06-03 17:45:40 -05:00
|
|
|
for name, window := range Data.WindowMap {
|
|
|
|
log.Println("gui.DumpBoxes() Data.WindowMap name =", name, "Window.Name =", window.Name)
|
|
|
|
}
|
2019-06-03 14:56:33 -05:00
|
|
|
for i, window := range Data.Windows {
|
2019-06-03 17:45:40 -05:00
|
|
|
log.Println("gui.DumpBoxes() Data.Windows", i, "Name =", window.Name)
|
2019-06-03 14:56:33 -05:00
|
|
|
for name, abox := range window.BoxMap {
|
2019-06-03 17:45:40 -05:00
|
|
|
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
2019-06-03 14:56:33 -05:00
|
|
|
/*
|
|
|
|
if (name == "DEBUG") {
|
|
|
|
log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
|
|
|
|
win := abox.Window
|
|
|
|
log.Println("\t\twatchGUI() BOX win =", reflect.TypeOf(win))
|
|
|
|
area := win.Area
|
|
|
|
log.Println("\t\twatchGUI() BOX area =", reflect.TypeOf(area), area.UiArea)
|
|
|
|
// spew.Dump(area.UiArea)
|
|
|
|
// area.UiArea.Show()
|
|
|
|
// time.Sleep(2000 * time.Millisecond)
|
|
|
|
// os.Exit(0)
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-02 14:08:53 -05:00
|
|
|
func addTableTab() {
|
|
|
|
var parts []TableColumnData
|
|
|
|
|
|
|
|
for key, foo := range []string{"BG", "TEXTCOLOR", "BUTTON", "TEXTCOLOR", "TEXTCOLOR", "TEXT", "BUTTON", "TEXT", "BUTTON"} {
|
|
|
|
log.Println(key, foo)
|
|
|
|
|
|
|
|
var b TableColumnData
|
|
|
|
b.CellType = foo
|
|
|
|
b.Heading = fmt.Sprintf("heading%d", key)
|
|
|
|
parts = append(parts, b)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Println("Sleep for 2 seconds, then try to add new tabs")
|
|
|
|
time.Sleep(1 * 1000 * 1000 * 1000)
|
|
|
|
// AddTableTab(Data.Window1.T, 1, "test seven", 7, parts, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
func runTestHide(b *GuiButton) {
|
|
|
|
log.Println("runTestHide START")
|
|
|
|
Data.Window1.Box1.Hide()
|
|
|
|
Data.Window1.Box2.Hide()
|
|
|
|
// time.Sleep(2000 * time.Millisecond)
|
|
|
|
Data.State = "HIDE"
|
|
|
|
log.Println("runTestHide END")
|
|
|
|
}
|
|
|
|
*/
|