cleaner comments
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
e09e613347
commit
def1e8a109
|
@ -82,7 +82,6 @@ func parseFlags() {
|
|||
width := flag.Int ("width", 0, "Width of the Window")
|
||||
debugging = flag.Bool("debugging", false, "Enable debugging")
|
||||
debugtable = flag.Bool("debugtable", false, "Enable GUI table debugging")
|
||||
nogui := flag.Bool("nogui", false, "Do not display the GUI")
|
||||
|
||||
// Set the output if something fails to stdout rather than stderr
|
||||
flag.CommandLine.SetOutput(os.Stdout)
|
||||
|
|
45
main.go
45
main.go
|
@ -143,40 +143,45 @@ func main() {
|
|||
}
|
||||
|
||||
// This is the handler for all mosue clicks (buttons, areas, etc))
|
||||
//
|
||||
// This is massive for a reason. EVERY MOUSE CLICK COMES HERE
|
||||
// the 'gui' code is kinda just a holder. It will pass everything
|
||||
// here and we have to sort out what to do with the click
|
||||
// at least, that is the current design because I thought it
|
||||
// might be a good approach. Time will tell...
|
||||
//
|
||||
func mainMouseClick(b *gui.ButtonMap) {
|
||||
log.Println("mainMouseClick() b =", b)
|
||||
|
||||
if (b == nil) {
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||
onExit("mainMouseClick() got b = nil")
|
||||
onExit(fmt.Errorf("mainMouseClick() got b = nil"))
|
||||
}
|
||||
|
||||
gui.Data.Current = b.Account
|
||||
log.Println("mainMouseClick() setting current account = ", b.Account)
|
||||
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button =", b, ")")
|
||||
log.Println("\tmainMouseClick() setting current account = ", b.Account)
|
||||
if (b.Action == "BACK") {
|
||||
gui.Data.State = "splash"
|
||||
} else if (b.Action == "QUIT") {
|
||||
onExit(nil)
|
||||
} else if (b.Action == "CREATE") {
|
||||
log.Println("TRY TO ADD A NEW VIRTUAL MACHINE")
|
||||
log.Println("\tTRY TO ADD A NEW VIRTUAL MACHINE")
|
||||
log.Println("\tTRIGGER CREATE VM")
|
||||
gui.Data.State = "CREATE"
|
||||
} else if (b.Action == "CONFIG") {
|
||||
loadDefaultConfig()
|
||||
gui.Data.State = "done"
|
||||
} else if (b.Action == "DEBUG") {
|
||||
log.Println("debug.PrintStack() (SHOULD BE JUST THIS goroutine)")
|
||||
log.Println("\tdebug.PrintStack() (SHOULD BE JUST THIS goroutine)")
|
||||
debug.PrintStack()
|
||||
} else if (b.Action == "DEBUG FULL") {
|
||||
log.Println("ATTEMPT FULL STACK DUMP")
|
||||
log.Println("\tATTEMPT FULL STACK DUMP")
|
||||
buf := make([]byte, 1<<16)
|
||||
runtime.Stack(buf, true)
|
||||
log.Printf("%s", buf)
|
||||
log.Println("FINISHED FULL STACK DUMP")
|
||||
log.Println("\tFINISHED FULL STACK DUMP")
|
||||
} else if (b.Action == "ADD") {
|
||||
log.Println("\tSHOULD ADD ACCOUNT HERE")
|
||||
if (gui.Data.CurrentTab != nil) {
|
||||
|
@ -201,7 +206,7 @@ func mainMouseClick(b *gui.ButtonMap) {
|
|||
gui.Data.State = "SEND LOGIN"
|
||||
count := 0
|
||||
for {
|
||||
log.Println("Sleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
||||
log.Println("\tSleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
if (gui.Data.State == "NEW PROTOBUF") {
|
||||
if (currentMessage == nil) {
|
||||
|
@ -210,16 +215,16 @@ func mainMouseClick(b *gui.ButtonMap) {
|
|||
} else {
|
||||
log.Println("LOGIN currentMessage =", currentMessage)
|
||||
if (currentMessage.Type == pb.Event_OK) {
|
||||
log.Println("LOGIN WAS OK!")
|
||||
log.Println("LOGIN WAS OK!")
|
||||
log.Println("LOGIN WAS OK!")
|
||||
log.Println("\tLOGIN WAS OK!")
|
||||
log.Println("\tLOGIN WAS OK!")
|
||||
log.Println("\tLOGIN WAS OK!")
|
||||
msg := "On account " + b.Account.Nick + "\n"
|
||||
gui.MessageWindow("Login OK", msg)
|
||||
}
|
||||
if (currentMessage.Type == pb.Event_FAIL) {
|
||||
log.Println("LOGIN FAILED")
|
||||
log.Println("LOGIN FAILED")
|
||||
log.Println("LOGIN FAILED")
|
||||
log.Println("\tLOGIN FAILED")
|
||||
log.Println("\tLOGIN FAILED")
|
||||
log.Println("\tLOGIN FAILED")
|
||||
msg := "On account " + b.Account.Nick + "\n"
|
||||
msg += "pb.Comment = " + currentMessage.Comment + "\n"
|
||||
msg += "pb.Id = " + fmt.Sprintf("%d", currentMessage.Id) + "\n"
|
||||
|
@ -234,7 +239,7 @@ func mainMouseClick(b *gui.ButtonMap) {
|
|||
}
|
||||
count += 1
|
||||
if (count > 10) {
|
||||
log.Println("ERROR: waited too long for a resposne")
|
||||
log.Println("\tERROR: waited too long for a resposne")
|
||||
currentMessage = nil
|
||||
gui.Data.State = "done"
|
||||
return
|
||||
|
@ -245,7 +250,7 @@ func mainMouseClick(b *gui.ButtonMap) {
|
|||
gui.Data.State = "SEND WEBSOCKET"
|
||||
count := 0
|
||||
for {
|
||||
log.Println("Sleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
||||
log.Println("\tSleep() in buttonClick() gui.Data.State =", gui.Data.State)
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
if (gui.Data.State == "NEW PROTOBUF") {
|
||||
if (currentMessage == nil) {
|
||||
|
@ -253,8 +258,8 @@ func mainMouseClick(b *gui.ButtonMap) {
|
|||
gui.Data.State = "done"
|
||||
} else {
|
||||
count := countVMS(currentMessage)
|
||||
log.Println("SHOW VMS currentMessage =", currentMessage)
|
||||
log.Println("SHOW VMS count =", count)
|
||||
log.Println("\tSHOW VMS currentMessage =", currentMessage)
|
||||
log.Println("\tSHOW VMS count =", count)
|
||||
if (count != 0) {
|
||||
name := "Virtual Machines (" + b.Account.Nick + ")"
|
||||
mh := gui.AddVmsTab(name, count, b.Account)
|
||||
|
@ -267,7 +272,7 @@ func mainMouseClick(b *gui.ButtonMap) {
|
|||
}
|
||||
count += 1
|
||||
if (count > 10) {
|
||||
log.Println("ERROR: waited too long for a resposne")
|
||||
log.Println("\tERROR: waited too long for a resposne")
|
||||
currentMessage = nil
|
||||
gui.Data.State = "done"
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue