rearrange some code
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
b0da8996b3
commit
6cde27f608
33
gui.go
33
gui.go
|
@ -10,6 +10,8 @@ import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
// THIS IS CLEAN (all that is left is the 'createAddVmBox')
|
||||||
|
|
||||||
func InitColumns(mh *TableData, parts []TableColumnData) {
|
func InitColumns(mh *TableData, parts []TableColumnData) {
|
||||||
tmpBTindex := 0
|
tmpBTindex := 0
|
||||||
humanID := 0
|
humanID := 0
|
||||||
|
@ -284,3 +286,34 @@ func SetText(box *GuiBox, name string, value string) error {
|
||||||
log.Println("gui.SetText() END")
|
log.Println("gui.SetText() END")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// makeEntryBox(box, "hostname:", "blah.foo.org") {
|
||||||
|
func MakeEntryVbox(box *GuiBox, a string, startValue string, edit bool, action string) *GuiEntry {
|
||||||
|
// Start 'Nickname' vertical box
|
||||||
|
vboxN := ui.NewVerticalBox()
|
||||||
|
vboxN.SetPadded(true)
|
||||||
|
vboxN.Append(ui.NewLabel(a), false)
|
||||||
|
|
||||||
|
e := defaultMakeEntry(startValue, edit, action)
|
||||||
|
|
||||||
|
vboxN.Append(e.UiEntry, false)
|
||||||
|
box.UiBox.Append(vboxN, false)
|
||||||
|
// End 'Nickname' vertical box
|
||||||
|
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
func MakeEntryHbox(box *GuiBox, a string, startValue string, edit bool, action string) *GuiEntry {
|
||||||
|
// Start 'Nickname' vertical box
|
||||||
|
hboxN := ui.NewHorizontalBox()
|
||||||
|
hboxN.SetPadded(true)
|
||||||
|
hboxN.Append(ui.NewLabel(a), false)
|
||||||
|
|
||||||
|
e := defaultMakeEntry(startValue, edit, action)
|
||||||
|
hboxN.Append(e.UiEntry, false)
|
||||||
|
|
||||||
|
box.UiBox.Append(hboxN, false)
|
||||||
|
// End 'Nickname' vertical box
|
||||||
|
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
|
@ -249,20 +249,9 @@ func InitWindow(gw *GuiWindow) {
|
||||||
gw.UiWindow.Show()
|
gw.UiWindow.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
// makeEntryBox(box, "hostname:", "blah.foo.org") {
|
func AddBoxToTab(name string, tab *ui.Tab, box *ui.Box) {
|
||||||
func makeEntryVbox(hbox *ui.Box, a string, startValue string, edit bool, action string) *GuiEntry {
|
tab.Append(name, box)
|
||||||
// Start 'Nickname' vertical box
|
tab.SetMargined(0, true)
|
||||||
vboxN := ui.NewVerticalBox()
|
|
||||||
vboxN.SetPadded(true)
|
|
||||||
vboxN.Append(ui.NewLabel(a), false)
|
|
||||||
|
|
||||||
e := defaultMakeEntry(startValue, edit, action)
|
|
||||||
|
|
||||||
vboxN.Append(e.UiEntry, false)
|
|
||||||
hbox.Append(vboxN, false)
|
|
||||||
// End 'Nickname' vertical box
|
|
||||||
|
|
||||||
return e
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -341,7 +330,24 @@ func defaultMakeEntry(startValue string, edit bool, action string) *GuiEntry {
|
||||||
return &newEntry
|
return &newEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeEntryHbox(hbox *ui.Box, a string, startValue string, edit bool, action string) *GuiEntry {
|
/*
|
||||||
|
// makeEntryBox(box, "hostname:", "blah.foo.org") {
|
||||||
|
func makeEntryVbox(box *GuiBox, a string, startValue string, edit bool, action string) *GuiEntry {
|
||||||
|
// Start 'Nickname' vertical box
|
||||||
|
vboxN := ui.NewVerticalBox()
|
||||||
|
vboxN.SetPadded(true)
|
||||||
|
vboxN.Append(ui.NewLabel(a), false)
|
||||||
|
|
||||||
|
e := defaultMakeEntry(startValue, edit, action)
|
||||||
|
|
||||||
|
vboxN.Append(e.UiEntry, false)
|
||||||
|
box.UiBox.Append(vboxN, false)
|
||||||
|
// End 'Nickname' vertical box
|
||||||
|
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeEntryHbox(box *GuiBox, a string, startValue string, edit bool, action string) *GuiEntry {
|
||||||
// Start 'Nickname' vertical box
|
// Start 'Nickname' vertical box
|
||||||
hboxN := ui.NewHorizontalBox()
|
hboxN := ui.NewHorizontalBox()
|
||||||
hboxN.SetPadded(true)
|
hboxN.SetPadded(true)
|
||||||
|
@ -350,13 +356,9 @@ func makeEntryHbox(hbox *ui.Box, a string, startValue string, edit bool, action
|
||||||
e := defaultMakeEntry(startValue, edit, action)
|
e := defaultMakeEntry(startValue, edit, action)
|
||||||
hboxN.Append(e.UiEntry, false)
|
hboxN.Append(e.UiEntry, false)
|
||||||
|
|
||||||
hbox.Append(hboxN, false)
|
box.UiBox.Append(hboxN, false)
|
||||||
// End 'Nickname' vertical box
|
// End 'Nickname' vertical box
|
||||||
|
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
func AddBoxToTab(name string, tab *ui.Tab, box *ui.Box) {
|
|
||||||
tab.Append(name, box)
|
|
||||||
tab.SetMargined(0, true)
|
|
||||||
}
|
|
||||||
|
|
20
vmBox.go
20
vmBox.go
|
@ -36,13 +36,15 @@ func CreateVmBox(gw *GuiWindow, vm *pb.Event_VM) {
|
||||||
hboxAccount.SetPadded(true)
|
hboxAccount.SetPadded(true)
|
||||||
vbox.Append(hboxAccount, false)
|
vbox.Append(hboxAccount, false)
|
||||||
|
|
||||||
|
box.UiBox = hboxAccount
|
||||||
|
|
||||||
// Add hostname entry box
|
// Add hostname entry box
|
||||||
makeEntryVbox(hboxAccount, "hostname:", vm.Hostname, true, "Hostname")
|
MakeEntryVbox(box, "hostname:", vm.Hostname, true, "Hostname")
|
||||||
makeEntryVbox(hboxAccount, "IPv6:", vm.IPv6, true, "IPv6")
|
MakeEntryVbox(box, "IPv6:", vm.IPv6, true, "IPv6")
|
||||||
makeEntryVbox(hboxAccount, "RAM:", fmt.Sprintf("%d",vm.Memory), true, "Memory")
|
MakeEntryVbox(box, "RAM:", fmt.Sprintf("%d",vm.Memory), true, "Memory")
|
||||||
makeEntryVbox(hboxAccount, "CPU:", fmt.Sprintf("%d",vm.Cpus), true, "Cpus")
|
MakeEntryVbox(box, "CPU:", fmt.Sprintf("%d",vm.Cpus), true, "Cpus")
|
||||||
makeEntryVbox(hboxAccount, "Disk (GB):",fmt.Sprintf("%d",vm.Disk), true, "Disk")
|
MakeEntryVbox(box, "Disk (GB):",fmt.Sprintf("%d",vm.Disk), true, "Disk")
|
||||||
makeEntryVbox(hboxAccount, "OS Image:", vm.BaseImage, true, "BaseImage")
|
MakeEntryVbox(box, "OS Image:", vm.BaseImage, true, "BaseImage")
|
||||||
|
|
||||||
vbox.Append(ui.NewHorizontalSeparator(), false)
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
||||||
|
|
||||||
|
@ -86,9 +88,9 @@ func createAddVmBox(gw *GuiWindow, b *GuiButton) {
|
||||||
vbox.Append(hbox, false)
|
vbox.Append(hbox, false)
|
||||||
|
|
||||||
// Add hostname entry box
|
// Add hostname entry box
|
||||||
hostname := makeEntryHbox(vbox, "Hostname:", "testhost", true, "Hostname")
|
hostname := MakeEntryHbox(box, "Hostname:", "testhost", true, "Hostname")
|
||||||
memory := makeEntryHbox(vbox, "Memory:", "512", true, "Memory")
|
memory := MakeEntryHbox(box, "Memory:", "512", true, "Memory")
|
||||||
disk := makeEntryHbox(vbox, "Disk:", "20", true, "Disk")
|
disk := MakeEntryHbox(box, "Disk:", "20", true, "Disk")
|
||||||
|
|
||||||
log.Println("createAddVmBox() hostname, memory, disk =", hostname, memory, disk)
|
log.Println("createAddVmBox() hostname, memory, disk =", hostname, memory, disk)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue