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) { if (b.Account != nil) {
log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick) log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick)
} }
if (b.Action == "BACK") { if (b.Action == "AREA") {
gui.Data.State = "splash" 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") { } else if (b.Action == "QUIT") {
onExit(nil) onExit(nil)
} else if (b.Action == "CREATE") { } else if (b.Action == "CREATE") {
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" gui.Data.State = "CREATE"
log.Println("\tTRIGGERING CREATE")
event := pb.MakeAddVmEvent()
prepareAndSend(event)
} else if (b.Action == "CONFIG") { } else if (b.Action == "CONFIG") {
loadDefaultConfig() loadDefaultConfig()
gui.Data.State = "done" gui.Data.State = "done"
@ -193,25 +214,21 @@ func mainMouseClick(b *gui.ButtonMap) {
log.Println("\tFINISHED FULL STACK DUMP") log.Println("\tFINISHED FULL STACK DUMP")
} else if (b.Action == "ADD") { } else if (b.Action == "ADD") {
log.Println("\tSHOULD ADD ACCOUNT HERE") log.Println("\tSHOULD ADD ACCOUNT HERE")
/* if (gui.Data.EntryNick != nil) {
if (gui.Data.CurrentTab != nil) { nick := gui.Data.EntryNick.Text()
if (gui.Data.CurrentTab.EntryNick != nil) { username := gui.Data.EntryUser.Text()
nick := gui.Data.CurrentTab.EntryNick.Text() password := gui.Data.EntryPass.Text()
username := gui.Data.CurrentTab.EntryUser.Text() log.Println("\tEntryNick =", nick)
password := gui.Data.CurrentTab.EntryPass.Text() log.Println("\tEntryName =", username)
log.Println("\tEntryNick =", nick) log.Println("\tEntryPass =", password)
log.Println("\tEntryName =", username)
log.Println("\tEntryPass =", password)
acc := new(pb.Account) acc := new(pb.Account)
acc.Nick = nick acc.Nick = nick
acc.Username = username acc.Username = username
acc.Password = password acc.Password = password
config.Accounts = append(config.Accounts, acc) config.Accounts = append(config.Accounts, acc)
}
} }
*/
} else if (b.Action == "LOGIN") { } else if (b.Action == "LOGIN") {
log.Println("\tTRIGGER LOGIN ACCOUNT") log.Println("\tTRIGGER LOGIN ACCOUNT")
gui.Data.State = "SEND LOGIN" gui.Data.State = "SEND LOGIN"
@ -320,11 +337,11 @@ func mainMouseClick(b *gui.ButtonMap) {
} }
if (gui.Data.State == "splash") { if (gui.Data.State == "splash") {
gui.ShowAccountQuestionTab()
gui.Data.State = "account1" gui.Data.State = "account1"
return return
} else if (gui.Data.State == "account1") { } else if (gui.Data.State == "account1") {
gui.ShowAccountTab() // gui.ShowAccountTab(-1, b.B)
gui.ShowAccountTab(-1)
gui.Data.State = "main" gui.Data.State = "main"
} else if (gui.Data.State == "main") { } else if (gui.Data.State == "main") {
gui.ShowMainTab() gui.ShowMainTab()
@ -376,11 +393,6 @@ func watchGUI() {
count += 1 count += 1
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
if (gui.Data.State == "CREATE") {
log.Println("\tTRIGGERING CREATE")
event := pb.MakeAddVmEvent()
prepareAndSend(event)
}
if (gui.Data.State == "kill") { if (gui.Data.State == "kill") {
log.Println("gui.State = kill") log.Println("gui.State = kill")
log.Println("gui.State = kill") log.Println("gui.State = kill")
@ -388,21 +400,6 @@ func watchGUI() {
onExit(nil) onExit(nil)
} }
if (gui.Data.State == "splash") { 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)
}
}
} }
} }
} }