more fixes for the mouse click in the spash area

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-27 10:55:28 -07:00
parent c82e8eb6ad
commit 258152f94c
1 changed files with 36 additions and 39 deletions

75
main.go
View File

@ -171,14 +171,35 @@ func mainMouseClick(b *gui.ButtonMap) {
if (b.Account != nil) {
log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick)
}
if (b.Action == "BACK") {
if (b.Action == "AREA") {
gui.Data.State = "splash"
gui.Data.State = "account1"
// gui.ShowAccountQuestionTab(0, b.B)
gui.ShowAccountQuestionTab()
if (config == nil) {
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
log.Println("gui.State = splash config = nil")
os.Exit(-1)
}
for key, _ := range config.Accounts {
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Account = ", config.Accounts[key])
// log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Username = ", config.Accounts[key])
log.Println("SETTING gui.State = main")
gui.Data.State = "main";
if (config.Accounts[key] == nil) {
log.Println("THIS IS LAME. CONFIG FILE MADE NULL ACCOUNTS key =", key)
}
}
} else if (b.Action == "QUIT") {
onExit(nil)
} else if (b.Action == "CREATE") {
log.Println("\tTRY TO ADD A NEW VIRTUAL MACHINE")
log.Println("\tTRIGGER CREATE VM")
gui.Data.State = "CREATE"
log.Println("\tTRIGGERING CREATE")
event := pb.MakeAddVmEvent()
prepareAndSend(event)
} else if (b.Action == "CONFIG") {
loadDefaultConfig()
gui.Data.State = "done"
@ -193,25 +214,21 @@ func mainMouseClick(b *gui.ButtonMap) {
log.Println("\tFINISHED FULL STACK DUMP")
} else if (b.Action == "ADD") {
log.Println("\tSHOULD ADD ACCOUNT HERE")
/*
if (gui.Data.CurrentTab != nil) {
if (gui.Data.CurrentTab.EntryNick != nil) {
nick := gui.Data.CurrentTab.EntryNick.Text()
username := gui.Data.CurrentTab.EntryUser.Text()
password := gui.Data.CurrentTab.EntryPass.Text()
log.Println("\tEntryNick =", nick)
log.Println("\tEntryName =", username)
log.Println("\tEntryPass =", password)
if (gui.Data.EntryNick != nil) {
nick := gui.Data.EntryNick.Text()
username := gui.Data.EntryUser.Text()
password := gui.Data.EntryPass.Text()
log.Println("\tEntryNick =", nick)
log.Println("\tEntryName =", username)
log.Println("\tEntryPass =", password)
acc := new(pb.Account)
acc.Nick = nick
acc.Username = username
acc.Password = password
acc := new(pb.Account)
acc.Nick = nick
acc.Username = username
acc.Password = password
config.Accounts = append(config.Accounts, acc)
}
config.Accounts = append(config.Accounts, acc)
}
*/
} else if (b.Action == "LOGIN") {
log.Println("\tTRIGGER LOGIN ACCOUNT")
gui.Data.State = "SEND LOGIN"
@ -320,11 +337,11 @@ func mainMouseClick(b *gui.ButtonMap) {
}
if (gui.Data.State == "splash") {
gui.ShowAccountQuestionTab()
gui.Data.State = "account1"
return
} else if (gui.Data.State == "account1") {
gui.ShowAccountTab()
// gui.ShowAccountTab(-1, b.B)
gui.ShowAccountTab(-1)
gui.Data.State = "main"
} else if (gui.Data.State == "main") {
gui.ShowMainTab()
@ -376,11 +393,6 @@ func watchGUI() {
count += 1
time.Sleep(200 * time.Millisecond)
if (gui.Data.State == "CREATE") {
log.Println("\tTRIGGERING CREATE")
event := pb.MakeAddVmEvent()
prepareAndSend(event)
}
if (gui.Data.State == "kill") {
log.Println("gui.State = kill")
log.Println("gui.State = kill")
@ -388,21 +400,6 @@ func watchGUI() {
onExit(nil)
}
if (gui.Data.State == "splash") {
if (config == nil) {
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
log.Println("gui.State = splash config = nil")
os.Exit(-1)
}
for key, _ := range config.Accounts {
log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Account = ", config.Accounts[key])
// log.Println("gui.State = splash BUT THERE IS AN ACCOUNT Username = ", config.Accounts[key])
log.Println("SETTING gui.State = main")
gui.Data.State = "main";
if (config.Accounts[key] == nil) {
log.Println("THIS IS LAME. CONFIG FILE MADE NULL ACCOUNTS key =", key)
}
}
}
}
}