trying to fix 'SHOW VM'
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
b5fe8f0684
commit
881859d079
15
gui.go
15
gui.go
|
@ -42,7 +42,7 @@ func InitColumns(mh *TableData, parts []TableColumnData) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddTableTab(gw *GuiWindow, junk int, name string, rowcount int, parts []TableColumnData, account *pb.Account) *TableData {
|
func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData, account *pb.Account) *TableData {
|
||||||
mh := new(TableData)
|
mh := new(TableData)
|
||||||
|
|
||||||
mh.RowCount = rowcount
|
mh.RowCount = rowcount
|
||||||
|
@ -90,6 +90,7 @@ func AddTableTab(gw *GuiWindow, junk int, name string, rowcount int, parts []Tab
|
||||||
gb.UiBox = vbox
|
gb.UiBox = vbox
|
||||||
gb.W = gw
|
gb.W = gw
|
||||||
gw.BoxMap[name] = gb
|
gw.BoxMap[name] = gb
|
||||||
|
mh.Box = gb
|
||||||
|
|
||||||
vbox.Append(table, true)
|
vbox.Append(table, true)
|
||||||
gw.UiTab.Append(name, vbox)
|
gw.UiTab.Append(name, vbox)
|
||||||
|
@ -141,19 +142,9 @@ func mouseClick(b *GuiButton) {
|
||||||
log.Println("\tgui.mouseClick() START b.Action =", b.Action)
|
log.Println("\tgui.mouseClick() START b.Action =", b.Action)
|
||||||
if (b.Action == "createAddVmBox") {
|
if (b.Action == "createAddVmBox") {
|
||||||
log.Println("\tgui.mouseClick() createAddVmBox for b =", b)
|
log.Println("\tgui.mouseClick() createAddVmBox for b =", b)
|
||||||
createAddVmBox(b.GW, b.T, "Create New Virtual Machine", b)
|
createAddVmBox(b.GW, b)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (b.Action == "SHOW VM") {
|
|
||||||
Data.CurrentVM = b.VM
|
|
||||||
if (Data.Debug) {
|
|
||||||
go ui.Main(ShowVM)
|
|
||||||
} else {
|
|
||||||
CreateVmBox(Data.Window1.T, b.VM)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (b.Action == "WINDOW CLOSE") {
|
if (b.Action == "WINDOW CLOSE") {
|
||||||
b.W.Hide()
|
b.W.Hide()
|
||||||
// TODO: fix this (seems to crash? maybe because we are in the button here?)
|
// TODO: fix this (seems to crash? maybe because we are in the button here?)
|
||||||
|
|
|
@ -167,7 +167,8 @@ func AddVmsTab(gw *GuiWindow, name string, count int, a *pb.Account) *TableData
|
||||||
parts = append(parts, tmp)
|
parts = append(parts, tmp)
|
||||||
human += 1
|
human += 1
|
||||||
|
|
||||||
mh := AddTableTab(gw, 1, name, count, parts, a)
|
mh := AddTableTab(gw, name, count, parts, a)
|
||||||
|
// mh :=
|
||||||
return mh
|
return mh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,7 @@ type TableData struct {
|
||||||
Human [20]HumanMap
|
Human [20]HumanMap
|
||||||
|
|
||||||
Account *pb.Account // what account this table is for
|
Account *pb.Account // what account this table is for
|
||||||
|
Box *GuiBox
|
||||||
|
|
||||||
lastRow int
|
lastRow int
|
||||||
lastColumn int
|
lastColumn int
|
||||||
|
|
24
vmBox.go
24
vmBox.go
|
@ -10,21 +10,28 @@ import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
/*
|
||||||
func AddVmConfigureTab(wm *GuiWindow, name string, pbVM *pb.Event_VM) {
|
func AddVmConfigureTab(wm *GuiWindow, name string, pbVM *pb.Event_VM) {
|
||||||
CreateVmBox(wm, wm.UiTab, pbVM)
|
CreateVmBox(wm, pbVM)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func CreateVmBox(gw *GuiWindow, junk *ui.Tab, vm *pb.Event_VM) {
|
func CreateVmBox(gw *GuiWindow, vm *pb.Event_VM) {
|
||||||
log.Println("CreateVmBox() START")
|
log.Println("CreateVmBox() START")
|
||||||
log.Println("CreateVmBox() vm.Name", vm.Name)
|
log.Println("CreateVmBox() vm.Name =", vm.Name)
|
||||||
|
log.Println("CreateVmBox() gw =", gw)
|
||||||
|
|
||||||
var gb *GuiBox
|
var gb *GuiBox
|
||||||
gb = new(GuiBox)
|
gb = new(GuiBox)
|
||||||
|
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
|
log.Println("CreateVmBox() vbox =", vbox)
|
||||||
|
log.Println("CreateVmBox() gb.UiBox =", gb.UiBox)
|
||||||
gb.UiBox = vbox
|
gb.UiBox = vbox
|
||||||
|
log.Println("CreateVmBox() gb.W =", gb.W)
|
||||||
gb.W = gw
|
gb.W = gw
|
||||||
|
log.Println("CreateVmBox() gw.BoxMap =", gw.BoxMap)
|
||||||
gw.BoxMap[vm.Name] = gb
|
gw.BoxMap[vm.Name] = gb
|
||||||
|
|
||||||
// gw.UiTab.Append(vm.Name, vbox)
|
// gw.UiTab.Append(vm.Name, vbox)
|
||||||
|
@ -72,8 +79,9 @@ func CreateVmBox(gw *GuiWindow, junk *ui.Tab, vm *pb.Event_VM) {
|
||||||
AddBoxToTab(vm.Name, gw.UiTab, vbox)
|
AddBoxToTab(vm.Name, gw.UiTab, vbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createAddVmBox(gw *GuiWindow, junk *ui.Tab, name string, b *GuiButton) {
|
func createAddVmBox(gw *GuiWindow, b *GuiButton) {
|
||||||
log.Println("createAddVmBox() START")
|
log.Println("createAddVmBox() START")
|
||||||
|
name := "(" + b.Account.Nick + ")"
|
||||||
|
|
||||||
var gb *GuiBox
|
var gb *GuiBox
|
||||||
gb = new(GuiBox)
|
gb = new(GuiBox)
|
||||||
|
@ -82,11 +90,7 @@ func createAddVmBox(gw *GuiWindow, junk *ui.Tab, name string, b *GuiButton) {
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
gb.UiBox = vbox
|
gb.UiBox = vbox
|
||||||
gb.W = gw
|
gb.W = gw
|
||||||
gw.BoxMap[name] = gb
|
gw.BoxMap["ADD VM" + name] = gb
|
||||||
|
|
||||||
// gw.UiTab.Append(vm.Name, vbox)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
@ -115,10 +119,8 @@ func createAddVmBox(gw *GuiWindow, junk *ui.Tab, name string, b *GuiButton) {
|
||||||
disk.B = &newb
|
disk.B = &newb
|
||||||
hboxButtons.Append(AddButton(&newb, "Add Virtual Machine"), false)
|
hboxButtons.Append(AddButton(&newb, "Add Virtual Machine"), false)
|
||||||
|
|
||||||
// hboxButtons.Append(CreateButton(nil, nil, "Add Virtual Machine","CREATE",nil), false)
|
|
||||||
a := CreateButton(gb, nil, nil, "Cancel", "CLOSE", nil)
|
a := CreateButton(gb, nil, nil, "Cancel", "CLOSE", nil)
|
||||||
hboxButtons.Append(a.B, false)
|
hboxButtons.Append(a.B, false)
|
||||||
|
|
||||||
name += " (" + b.Account.Nick + ")"
|
|
||||||
AddBoxToTab(name, gw.UiTab, vbox)
|
AddBoxToTab(name, gw.UiTab, vbox)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue