make a buttonMap
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
1abf8279f2
commit
26bcac9b85
|
@ -39,7 +39,7 @@ func processEvents() {
|
||||||
log.Println("processEvents() do Event DEMO")
|
log.Println("processEvents() do Event DEMO")
|
||||||
} else {
|
} else {
|
||||||
log.Println("processEvents() NEW PROTOBUF")
|
log.Println("processEvents() NEW PROTOBUF")
|
||||||
gui.Data.State = "NEW PROTOBUF"
|
State = "NEW PROTOBUF"
|
||||||
}
|
}
|
||||||
log.Println("processEvents() END on channel")
|
log.Println("processEvents() END on channel")
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
log.Println("\tTRY TO ADD A NEW VIRTUAL MACHINE")
|
log.Println("\tTRY TO ADD A NEW VIRTUAL MACHINE")
|
||||||
/*
|
/*
|
||||||
log.Println("\tTRIGGER CREATE VM")
|
log.Println("\tTRIGGER CREATE VM")
|
||||||
gui.Data.State = "CREATE"
|
State = "CREATE"
|
||||||
event := pb.MakeAddVmEvent()
|
event := pb.MakeAddVmEvent()
|
||||||
for key, entry := range gui.Data.AllEntries {
|
for key, entry := range gui.Data.AllEntries {
|
||||||
log.Println("\tdefaultEntryChange() Data.AllEntries =", key, entry)
|
log.Println("\tdefaultEntryChange() Data.AllEntries =", key, entry)
|
||||||
|
@ -76,7 +76,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
} else if (values.Action == "CONFIG") {
|
} else if (values.Action == "CONFIG") {
|
||||||
newConfig := loadDefaultConfig()
|
newConfig := loadDefaultConfig()
|
||||||
config.Accounts = newConfig.Accounts
|
config.Accounts = newConfig.Accounts
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
} else if (values.Action == "DEBUG") {
|
} else if (values.Action == "DEBUG") {
|
||||||
log.Println("\tdebug.PrintStack() (SHOULD BE JUST THIS goroutine)")
|
log.Println("\tdebug.PrintStack() (SHOULD BE JUST THIS goroutine)")
|
||||||
debug.PrintStack()
|
debug.PrintStack()
|
||||||
|
@ -98,7 +98,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
*/
|
*/
|
||||||
} else if (values.Action == "SHOW") {
|
} else if (values.Action == "SHOW") {
|
||||||
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
log.Println("\tTRIGGER DISPLAY ACCOUNT")
|
||||||
gui.Data.State = "SEND WEBSOCKET"
|
State = "SEND WEBSOCKET"
|
||||||
|
|
||||||
event := pb.MakeGetEvent()
|
event := pb.MakeGetEvent()
|
||||||
event.Account = values.Account
|
event.Account = values.Account
|
||||||
|
@ -106,14 +106,14 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
|
|
||||||
count := 0
|
count := 0
|
||||||
for {
|
for {
|
||||||
log.Println("\tSleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
log.Println("\tSleep() in buttonClick() State =", State)
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
if (gui.Data.State == "NEW PROTOBUF") {
|
if (State == "NEW PROTOBUF") {
|
||||||
if (currentMessage == nil) {
|
if (currentMessage == nil) {
|
||||||
gui.ErrorWindow(gw,
|
gui.ErrorWindow(gw,
|
||||||
"There was a socket error",
|
"There was a socket error",
|
||||||
"More detailed information can be shown here.")
|
"More detailed information can be shown here.")
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
} else {
|
} else {
|
||||||
count := countVMS(currentMessage)
|
count := countVMS(currentMessage)
|
||||||
log.Println("\tSHOW VMS currentMessage =", currentMessage)
|
log.Println("\tSHOW VMS currentMessage =", currentMessage)
|
||||||
|
@ -125,7 +125,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
ReadReceivedData(currentMessage, mh, b.Box)
|
ReadReceivedData(currentMessage, mh, b.Box)
|
||||||
// }
|
// }
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ func mainMouseClick(b *gui.GuiButton) {
|
||||||
if (count > 10) {
|
if (count > 10) {
|
||||||
log.Println("\tERROR: waited too long for a resposne")
|
log.Println("\tERROR: waited too long for a resposne")
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,5 +159,5 @@ func makeGuiButtonValues(box *gui.GuiBox, a *pb.Account, vm *pb.Event_VM,
|
||||||
func makeButton(box *gui.GuiBox, a *pb.Account, vm *pb.Event_VM,
|
func makeButton(box *gui.GuiBox, a *pb.Account, vm *pb.Event_VM,
|
||||||
name string, action string, custom func(*gui.GuiButton)) *gui.GuiButton {
|
name string, action string, custom func(*gui.GuiButton)) *gui.GuiButton {
|
||||||
val := makeGuiButtonValues(box, a, vm, name, action, custom)
|
val := makeGuiButtonValues(box, a, vm, name, action, custom)
|
||||||
return gui.NewCreateButton(box, custom, name, val)
|
return gui.CreateButton(box, custom, name, val)
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ func addSubdomainButton(b *gui.GuiButton) {
|
||||||
config.Accounts = append(config.Accounts, acc)
|
config.Accounts = append(config.Accounts, acc)
|
||||||
|
|
||||||
makeCloudInfoBox(b.Box.Window)
|
makeCloudInfoBox(b.Box.Window)
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
log.Println("addSubdomainButton() END")
|
log.Println("addSubdomainButton() END")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
login.go
12
login.go
|
@ -13,7 +13,7 @@ import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
func login(b *gui.GuiButton) {
|
func login(b *gui.GuiButton) {
|
||||||
log.Println("login() START")
|
log.Println("login() START")
|
||||||
gui.Data.State = "SEND LOGIN"
|
State = "SEND LOGIN"
|
||||||
|
|
||||||
// TODO: move this into a seperate goroutine
|
// TODO: move this into a seperate goroutine
|
||||||
// note: this may never be possible because of cross platform
|
// note: this may never be possible because of cross platform
|
||||||
|
@ -28,14 +28,14 @@ func login(b *gui.GuiButton) {
|
||||||
|
|
||||||
count := 0
|
count := 0
|
||||||
for {
|
for {
|
||||||
log.Println("\tSleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
log.Println("\tSleep() in buttonClick() State =", State)
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
if (gui.Data.State == "NEW PROTOBUF") {
|
if (State == "NEW PROTOBUF") {
|
||||||
if (currentMessage == nil) {
|
if (currentMessage == nil) {
|
||||||
gui.ErrorWindow(b.Box.Window,
|
gui.ErrorWindow(b.Box.Window,
|
||||||
"There was a socket error",
|
"There was a socket error",
|
||||||
"More detailed information can be shown here.")
|
"More detailed information can be shown here.")
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
} else {
|
} else {
|
||||||
log.Println("LOGIN currentMessage =", currentMessage)
|
log.Println("LOGIN currentMessage =", currentMessage)
|
||||||
if (currentMessage.Type == pb.Event_OK) {
|
if (currentMessage.Type == pb.Event_OK) {
|
||||||
|
@ -64,7 +64,7 @@ func login(b *gui.GuiButton) {
|
||||||
gui.ErrorWindow(b.Box.Window, "Login Failed", msg)
|
gui.ErrorWindow(b.Box.Window, "Login Failed", msg)
|
||||||
}
|
}
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ func login(b *gui.GuiButton) {
|
||||||
if (count > 10) {
|
if (count > 10) {
|
||||||
log.Println("\tERROR: waited too long for a resposne")
|
log.Println("\tERROR: waited too long for a resposne")
|
||||||
currentMessage = nil
|
currentMessage = nil
|
||||||
gui.Data.State = "done"
|
State = "done"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
main.go
2
main.go
|
@ -20,6 +20,8 @@ var GOVERSION string // this is passed in as an ldflag
|
||||||
var BUILDTIME string // this is passed in as an ldflag
|
var BUILDTIME string // this is passed in as an ldflag
|
||||||
var VERSION string // this is passed in as an ldflag
|
var VERSION string // this is passed in as an ldflag
|
||||||
|
|
||||||
|
var State string // used as a State machine
|
||||||
|
|
||||||
type myButtonInfo struct {
|
type myButtonInfo struct {
|
||||||
Account *pb.Account // associated with what account?
|
Account *pb.Account // associated with what account?
|
||||||
Accounts []*pb.Account // associated with what account?
|
Accounts []*pb.Account // associated with what account?
|
||||||
|
|
Loading…
Reference in New Issue