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.RowCount = rowcount
|
||||
|
@ -90,6 +90,7 @@ func AddTableTab(gw *GuiWindow, junk int, name string, rowcount int, parts []Tab
|
|||
gb.UiBox = vbox
|
||||
gb.W = gw
|
||||
gw.BoxMap[name] = gb
|
||||
mh.Box = gb
|
||||
|
||||
vbox.Append(table, true)
|
||||
gw.UiTab.Append(name, vbox)
|
||||
|
@ -141,19 +142,9 @@ func mouseClick(b *GuiButton) {
|
|||
log.Println("\tgui.mouseClick() START b.Action =", b.Action)
|
||||
if (b.Action == "createAddVmBox") {
|
||||
log.Println("\tgui.mouseClick() createAddVmBox for b =", b)
|
||||
createAddVmBox(b.GW, b.T, "Create New Virtual Machine", b)
|
||||
createAddVmBox(b.GW, b)
|
||||
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") {
|
||||
b.W.Hide()
|
||||
// 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)
|
||||
human += 1
|
||||
|
||||
mh := AddTableTab(gw, 1, name, count, parts, a)
|
||||
mh := AddTableTab(gw, name, count, parts, a)
|
||||
// mh :=
|
||||
return mh
|
||||
}
|
||||
|
||||
|
|
|
@ -174,6 +174,7 @@ type TableData struct {
|
|||
Human [20]HumanMap
|
||||
|
||||
Account *pb.Account // what account this table is for
|
||||
Box *GuiBox
|
||||
|
||||
lastRow 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"
|
||||
|
||||
/*
|
||||
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() vm.Name", vm.Name)
|
||||
log.Println("CreateVmBox() vm.Name =", vm.Name)
|
||||
log.Println("CreateVmBox() gw =", gw)
|
||||
|
||||
var gb *GuiBox
|
||||
gb = new(GuiBox)
|
||||
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
log.Println("CreateVmBox() vbox =", vbox)
|
||||
log.Println("CreateVmBox() gb.UiBox =", gb.UiBox)
|
||||
gb.UiBox = vbox
|
||||
log.Println("CreateVmBox() gb.W =", gb.W)
|
||||
gb.W = gw
|
||||
log.Println("CreateVmBox() gw.BoxMap =", gw.BoxMap)
|
||||
gw.BoxMap[vm.Name] = gb
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
func createAddVmBox(gw *GuiWindow, junk *ui.Tab, name string, b *GuiButton) {
|
||||
func createAddVmBox(gw *GuiWindow, b *GuiButton) {
|
||||
log.Println("createAddVmBox() START")
|
||||
name := "(" + b.Account.Nick + ")"
|
||||
|
||||
var gb *GuiBox
|
||||
gb = new(GuiBox)
|
||||
|
@ -82,11 +90,7 @@ func createAddVmBox(gw *GuiWindow, junk *ui.Tab, name string, b *GuiButton) {
|
|||
vbox.SetPadded(true)
|
||||
gb.UiBox = vbox
|
||||
gb.W = gw
|
||||
gw.BoxMap[name] = gb
|
||||
|
||||
// gw.UiTab.Append(vm.Name, vbox)
|
||||
|
||||
|
||||
gw.BoxMap["ADD VM" + name] = gb
|
||||
|
||||
hbox := ui.NewHorizontalBox()
|
||||
hbox.SetPadded(true)
|
||||
|
@ -115,10 +119,8 @@ func createAddVmBox(gw *GuiWindow, junk *ui.Tab, name string, b *GuiButton) {
|
|||
disk.B = &newb
|
||||
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)
|
||||
hboxButtons.Append(a.B, false)
|
||||
|
||||
name += " (" + b.Account.Nick + ")"
|
||||
AddBoxToTab(name, gw.UiTab, vbox)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue