remove more code
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
ccba007256
commit
462813cf36
74
gui.go
74
gui.go
|
@ -5,7 +5,7 @@ import "log"
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
import "github.com/gookit/config"
|
// import "github.com/gookit/config"
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
func InitColumns(mh *TableData, parts []TableColumnData) {
|
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 := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
|
||||||
myAddVM := addVmButton("Add Virtual Machine")
|
hbox.Append(CreateButton("Add Virtual Machine", "createAddVmBox", mouseClick), false)
|
||||||
hbox.Append(myAddVM, false)
|
hbox.Append(CreateButton("Close", "CLOSE", mouseClick), false)
|
||||||
|
|
||||||
myClose := closeButton("Close", mytab)
|
|
||||||
hbox.Append(myClose, false)
|
|
||||||
|
|
||||||
vbox.Append(hbox, false)
|
vbox.Append(hbox, false)
|
||||||
|
|
||||||
return mh
|
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
|
// This is the default mouse click handler
|
||||||
// Every mouse click that hasn't been assigned to
|
// Every mouse click that hasn't been assigned to
|
||||||
// something specific will fall into this routine
|
// 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) {
|
func mouseClick(b *ButtonMap) {
|
||||||
log.Println("gui.mouseClick() START b =", b)
|
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) {
|
if (Data.MouseClick == nil) {
|
||||||
log.Println("Data.MouseClick() IS nil. NOT DOING ANYTHING")
|
log.Println("Data.MouseClick() IS nil. NOT DOING ANYTHING")
|
||||||
} else {
|
} else {
|
||||||
|
@ -167,7 +186,7 @@ func defaultButtonClick(button *ui.Button) {
|
||||||
// (this has to be different for FontButtons)
|
// (this has to be different for FontButtons)
|
||||||
// TODO; merge the logic with the function above
|
// TODO; merge the logic with the function above
|
||||||
func defaultFontButtonClick(button *ui.FontButton) {
|
func defaultFontButtonClick(button *ui.FontButton) {
|
||||||
log.Println("defaultButtonClick() button =", button)
|
log.Println("defaultFontButtonClick() button =", button)
|
||||||
for key, foo := range Data.AllButtons {
|
for key, foo := range Data.AllButtons {
|
||||||
log.Println("Data.AllButtons =", key, foo)
|
log.Println("Data.AllButtons =", key, foo)
|
||||||
}
|
}
|
||||||
|
@ -235,44 +254,3 @@ func CreateFontButton(name string, note string, custom func(*ButtonMap)) *ui.Fon
|
||||||
|
|
||||||
return newB
|
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)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue