diff options
| author | Jeff Carr <[email protected]> | 2019-05-24 16:19:22 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-05-24 16:19:22 -0700 |
| commit | 462813cf36fca0f7197af5dea7c682f4d0e01532 (patch) | |
| tree | e305cd381beef78f516b4249dac4d368d98f281b /gui.go | |
| parent | ccba007256bf14a2bea871c181855e4c4741a382 (diff) | |
remove more code
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui.go')
| -rw-r--r-- | gui.go | 74 |
1 files changed, 26 insertions, 48 deletions
@@ -5,7 +5,7 @@ import "log" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -import "github.com/gookit/config" +// import "github.com/gookit/config" import "github.com/davecgh/go-spew/spew" func InitColumns(mh *TableData, parts []TableColumnData) { @@ -89,17 +89,28 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts hbox := ui.NewHorizontalBox() hbox.SetPadded(true) - myAddVM := addVmButton("Add Virtual Machine") - hbox.Append(myAddVM, false) - - myClose := closeButton("Close", mytab) - hbox.Append(myClose, false) + hbox.Append(CreateButton("Add Virtual Machine", "createAddVmBox", mouseClick), false) + hbox.Append(CreateButton("Close", "CLOSE", mouseClick), false) vbox.Append(hbox, false) return mh } +func SocketError() { + ui.MsgBoxError(Data.cloudWindow, + "There was a socket error", + "More detailed information can be shown here.") +} + +func MessageWindow(msg1 string, msg2 string) { + ui.MsgBox(Data.cloudWindow, msg1, msg2) +} + +func ErrorWindow(msg1 string, msg2 string) { + ui.MsgBoxError(Data.cloudWindow, msg1, msg2) +} + // This is the default mouse click handler // Every mouse click that hasn't been assigned to // something specific will fall into this routine @@ -113,6 +124,14 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts func mouseClick(b *ButtonMap) { log.Println("gui.mouseClick() START b =", b) + if (b != nil) { + if (b.Note == "createAddVmBox") { + log.Println("gui.mouseClick() createAddVmBox for b.AccNick =", b.AccNick) + createAddVmBox(Data.cloudTab, "Create New Virtual Machine", mouseClick) + return + } + } + if (Data.MouseClick == nil) { log.Println("Data.MouseClick() IS nil. NOT DOING ANYTHING") } else { @@ -167,7 +186,7 @@ func defaultButtonClick(button *ui.Button) { // (this has to be different for FontButtons) // TODO; merge the logic with the function above func defaultFontButtonClick(button *ui.FontButton) { - log.Println("defaultButtonClick() button =", button) + log.Println("defaultFontButtonClick() button =", button) for key, foo := range Data.AllButtons { log.Println("Data.AllButtons =", key, foo) } @@ -235,44 +254,3 @@ func CreateFontButton(name string, note string, custom func(*ButtonMap)) *ui.Fon return newB } - -func closeButtonClick(button *ui.Button) { - log.Println("closeButtonClick() hostname =", config.String("hostname"), button) - spew.Dump(button) -} - -func closeButton(name string, mytab *ui.Tab) ui.Control { - tmpButton := ui.NewButton(name) - tmpButton.OnClicked(defaultButtonClick) - - return tmpButton -} - -func addVmButtonClick(button *ui.Button) { - log.Println("addVMButtonClick()") - if (Data.Debug) { - spew.Dump(button) - } - createAddVmBox(Data.cloudTab, "Create New Virtual Machine", mouseClick) -} - -func addVmButton(name string) ui.Control { - tmpButton := ui.NewButton(name) - tmpButton.OnClicked(addVmButtonClick) - - return tmpButton -} - -func SocketError() { - ui.MsgBoxError(Data.cloudWindow, - "There was a socket error", - "More detailed information can be shown here.") -} - -func MessageWindow(msg1 string, msg2 string) { - ui.MsgBox(Data.cloudWindow, msg1, msg2) -} - -func ErrorWindow(msg1 string, msg2 string) { - ui.MsgBoxError(Data.cloudWindow, msg1, msg2) -} |
