trap window close and exit

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-23 13:45:11 -07:00
parent 41679c718b
commit 87ee1e2be2
1 changed files with 40 additions and 34 deletions

74
main.go
View File

@ -114,42 +114,46 @@ func main() {
func buttonClickNew(b *gui.ButtonMap) {
log.Println("buttonClickNew() b =", b)
log.Println("\tb.Name", b.Name)
log.Println("\tb.Note", b.Note)
if (b.Note == "BACK") {
gui.Data.State = "splash"
}
if (b.Note == "QUIT") {
onExit(nil)
}
if (b.Note == "ADD") {
log.Println("\tSHOULD ADD ACCOUNT HERE")
if (gui.Data.AccNick != "") {
log.Println("\tADDING ACCOUNT HERE")
log.Println("\tADDING ACCOUNT HERE")
log.Println("\tADDING ACCOUNT HERE")
log.Println("\tData.AccNick = ", gui.Data.AccNick)
log.Println("\tData.AccUser = ", gui.Data.AccUser)
log.Println("\tData.AccPass = ", gui.Data.AccPass)
config.Set("accounts." + gui.Data.AccNick + ".username", gui.Data.AccUser)
config.Set("accounts." + gui.Data.AccNick + ".password", gui.Data.AccPass)
config.Set("accounts." + gui.Data.AccNick + ".hostname", "v000185.testing.com.customers.wprod.wit.com")
if (b == nil) {
log.Println("THIS MOUSE EVENT WAS NOT FROM A BUTTON")
} else {
log.Println("\tb.Name", b.Name)
log.Println("\tb.Note", b.Note)
if (b.Note == "BACK") {
gui.Data.State = "splash"
}
}
if (b.Note == "BMATH") {
log.Println("\tTRIGGER BMATH HERE")
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 (b.Note == "QUIT") {
onExit(nil)
}
if (b.Note == "ADD") {
log.Println("\tSHOULD ADD ACCOUNT HERE")
if (gui.Data.AccNick != "") {
log.Println("\tADDING ACCOUNT HERE")
log.Println("\tADDING ACCOUNT HERE")
log.Println("\tADDING ACCOUNT HERE")
log.Println("\tData.AccNick = ", gui.Data.AccNick)
log.Println("\tData.AccUser = ", gui.Data.AccUser)
log.Println("\tData.AccPass = ", gui.Data.AccPass)
config.Set("accounts." + gui.Data.AccNick + ".username", gui.Data.AccUser)
config.Set("accounts." + gui.Data.AccNick + ".password", gui.Data.AccPass)
config.Set("accounts." + gui.Data.AccNick + ".hostname", "v000185.testing.com.customers.wprod.wit.com")
}
}
if (b.Note == "BMATH") {
log.Println("\tTRIGGER BMATH HERE")
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
}
}
}
}
@ -163,6 +167,8 @@ func buttonClickNew(b *gui.ButtonMap) {
} else if (gui.Data.State == "main") {
gui.ShowMainTab()
gui.Data.State = "done"
} else if (gui.Data.State == "QUIT") {
onExit(nil)
}
}