move create VM tab back into GUI goroutine
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
6557b04af5
commit
daca095873
|
@ -16,6 +16,8 @@ import "git.wit.com/wit/gui"
|
||||||
|
|
||||||
var mychannel chan *pb.Event
|
var mychannel chan *pb.Event
|
||||||
|
|
||||||
|
var currentMessage *pb.Event
|
||||||
|
|
||||||
func initChannel() {
|
func initChannel() {
|
||||||
mychannel = make(chan *pb.Event)
|
mychannel = make(chan *pb.Event)
|
||||||
}
|
}
|
||||||
|
@ -23,16 +25,19 @@ func initChannel() {
|
||||||
// func processEvents(mychannel chan *pb.Event) {
|
// func processEvents(mychannel chan *pb.Event) {
|
||||||
func processEvents() {
|
func processEvents() {
|
||||||
for {
|
for {
|
||||||
message := <-mychannel
|
currentMessage = <-mychannel
|
||||||
log.Println("processEvents() START on channel recieved a message = ", message)
|
log.Println("processEvents() START on channel recieved a message = ", currentMessage)
|
||||||
if (message.Type == pb.Event_DEMO) {
|
if (currentMessage.Type == pb.Event_DEMO) {
|
||||||
log.Println("processEvents() do Event DEMO")
|
log.Println("processEvents() do Event DEMO")
|
||||||
// figure out how to interact with the GUI here
|
// figure out how to interact with the GUI here
|
||||||
// go ui.Main(gui.SetupDemoUI)
|
// go ui.Main(gui.SetupDemoUI)
|
||||||
} else {
|
} else {
|
||||||
|
gui.Data.State = "bmath done"
|
||||||
|
/*
|
||||||
count := countVMS(message)
|
count := countVMS(message)
|
||||||
mh := addVmsTab(count)
|
mh := addVmsTab(count)
|
||||||
ReadReceivedData(message, mh)
|
ReadReceivedData(message, mh)
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
log.Println("processEvents() END on channel")
|
log.Println("processEvents() END on channel")
|
||||||
}
|
}
|
||||||
|
|
83
main.go
83
main.go
|
@ -7,9 +7,6 @@ import "time"
|
||||||
|
|
||||||
import "github.com/gookit/config"
|
import "github.com/gookit/config"
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
|
||||||
|
|
||||||
import "git.wit.com/wit/gui"
|
import "git.wit.com/wit/gui"
|
||||||
|
|
||||||
// import "github.com/davecgh/go-spew/spew"
|
// import "github.com/davecgh/go-spew/spew"
|
||||||
|
@ -63,26 +60,74 @@ func main() {
|
||||||
go processEvents()
|
go processEvents()
|
||||||
|
|
||||||
go gorillaDial("v000185.testing.com.customers.wprod.wit.com:9000")
|
go gorillaDial("v000185.testing.com.customers.wprod.wit.com:9000")
|
||||||
|
go watchGUI()
|
||||||
|
|
||||||
gui.Data.Width = config.Int("width")
|
gui.Data.Width = config.Int("width")
|
||||||
gui.Data.Height = config.Int("height")
|
gui.Data.Height = config.Int("height")
|
||||||
|
|
||||||
|
gui.Data.ButtonClickNew = buttonClickNew
|
||||||
|
|
||||||
// make this the main loop in an attempt to figure out the crashes
|
// make this the main loop in an attempt to figure out the crashes
|
||||||
// do not change this until the GUI is stable
|
// do not change this until the GUI is stable
|
||||||
ui.Main(setupCloudUI)
|
gui.GoMainWindow()
|
||||||
|
}
|
||||||
/*
|
|
||||||
for account, _ := range config.StringMap("cloud") {
|
func buttonClickNew(b *gui.ButtonMap) {
|
||||||
port := config.String("cloud." + account + ".port")
|
log.Println("buttonClickNew() b =", b)
|
||||||
proto := config.String("cloud." + account + ".proto")
|
log.Println("\tb.Name", b.Name)
|
||||||
hostname := config.String("cloud." + account + ".hostname")
|
log.Println("\tb.Note", b.Note)
|
||||||
rows := config.Int("cloud." + account + ".rows")
|
|
||||||
fmt.Println(hostname, port, proto, rows)
|
if (b.Note == "BACK") {
|
||||||
|
gui.Data.State = "splash"
|
||||||
gui.AddTableTab(account, rows, parts)
|
}
|
||||||
|
if (b.Note == "BMATH") {
|
||||||
log.Println("Sleep for 10 seconds, then add next table")
|
log.Println("\tTRIGGER BMATH HERE")
|
||||||
time.Sleep(10 * 1000 * 1000 * 1000)
|
log.Println("\tTRIGGER BMATH HERE")
|
||||||
}
|
log.Println("\tTRIGGER BMATH HERE")
|
||||||
*/
|
gui.Data.State = "bmath"
|
||||||
|
for {
|
||||||
|
log.Println("Sleep() in buttonClickNew() gui.Data.State =", gui.Data.State)
|
||||||
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
if (gui.Data.State == "bmath done") {
|
||||||
|
count := countVMS(currentMessage)
|
||||||
|
mh := gui.AddVmsTab(count)
|
||||||
|
ReadReceivedData(currentMessage, mh)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gui.Data.State == "splash") {
|
||||||
|
gui.ShowAccountQuestionTab()
|
||||||
|
gui.Data.State = "account1"
|
||||||
|
return
|
||||||
|
} else if (gui.Data.State == "account1") {
|
||||||
|
gui.ShowAccountTab()
|
||||||
|
gui.Data.State = "main"
|
||||||
|
} else if (gui.Data.State == "main") {
|
||||||
|
gui.ShowMainTab()
|
||||||
|
gui.Data.State = "done"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func watchGUI() {
|
||||||
|
log.Println("Sleep(2000)")
|
||||||
|
time.Sleep(2000 * time.Millisecond)
|
||||||
|
|
||||||
|
for {
|
||||||
|
log.Println("Sleep() in watchGUI() gui.Data.State =", gui.Data.State)
|
||||||
|
time.Sleep(2000 * time.Millisecond)
|
||||||
|
|
||||||
|
if (gui.Data.State == "bmath") {
|
||||||
|
log.Println("\tTRIGGERING BMATH HERE")
|
||||||
|
log.Println("\tTRIGGERING BMATH HERE")
|
||||||
|
log.Println("\tTRIGGERING BMATH HERE")
|
||||||
|
gorillaSendProtobuf()
|
||||||
|
}
|
||||||
|
if (gui.Data.State == "kill") {
|
||||||
|
log.Println("gui.State = kill")
|
||||||
|
log.Println("gui.State = kill")
|
||||||
|
log.Println("gui.State = kill")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue