lots of changes to track windows and tabs
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
1ca8ef5f0d
commit
b5fe8f0684
|
@ -37,6 +37,7 @@ func AddAccountQuestionBox(gw *GuiWindow) *GuiBox {
|
|||
vbox.SetPadded(true)
|
||||
// gw.Box1 = vbox
|
||||
gb.UiBox = vbox
|
||||
gb.W = gw
|
||||
|
||||
hbox := ui.NewHorizontalBox()
|
||||
hbox.SetPadded(true)
|
||||
|
@ -44,7 +45,7 @@ func AddAccountQuestionBox(gw *GuiWindow) *GuiBox {
|
|||
|
||||
hbox.Append(ui.NewLabel("Enter your Subdomain or"), false)
|
||||
|
||||
button1 := CreateButton(gw, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
||||
button1 := CreateButton(gb, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
||||
button1.Box = gb
|
||||
hbox.Append(button1.B, false)
|
||||
|
||||
|
@ -53,7 +54,7 @@ func AddAccountQuestionBox(gw *GuiWindow) *GuiBox {
|
|||
|
||||
vbox.Append(ui.NewHorizontalSeparator(), false)
|
||||
|
||||
button2 := CreateButton(gw, nil, nil, "Create Subdomain Account", "ADD", nil)
|
||||
button2 := CreateButton(gb, nil, nil, "Create Subdomain Account", "ADD", nil)
|
||||
button2.Box = gb
|
||||
vbox.Append(button2.B, false)
|
||||
|
||||
|
@ -189,10 +190,10 @@ func AddAccountBox(gw *GuiWindow) *GuiBox {
|
|||
hboxButtons.SetPadded(true)
|
||||
vbox.Append(hboxButtons, false)
|
||||
|
||||
okButton := CreateButton(gw, nil, nil, "Add Account", "ADD", nil)
|
||||
okButton := CreateButton(gb, nil, nil, "Add Account", "ADD", nil)
|
||||
hboxButtons.Append(okButton.B, false)
|
||||
|
||||
backButton := CreateButton(gw, nil, nil, "Back", "BACK", nil)
|
||||
backButton := CreateButton(gb, nil, nil, "Back", "BACK", nil)
|
||||
hboxButtons.Append(backButton.B, false)
|
||||
|
||||
return gb
|
||||
|
|
23
area.go
23
area.go
|
@ -20,24 +20,31 @@ func findFB(button *GuiButton) *GuiButton {
|
|||
return a
|
||||
}
|
||||
|
||||
func makeSplashArea(wm *GuiWindow, ah *GuiArea) {
|
||||
func makeSplashArea(gb *GuiBox, newText *ui.AttributedString) {
|
||||
// make this button just to get the default font (but don't display the button)
|
||||
// There should be another way to do this (?)
|
||||
newB := CreateFontButton(wm, "AREA")
|
||||
var newB *GuiButton
|
||||
newB = CreateFontButton(gb, "AREA")
|
||||
|
||||
// initialize the GuiArea{}
|
||||
gb.Area = new(GuiArea)
|
||||
gb.Area.Window = gb.W
|
||||
gb.Area.UiAttrstr = newText
|
||||
|
||||
// ah.UiAttrstr = makeAttributedString()
|
||||
ah.UiArea = ui.NewArea(ah)
|
||||
newB.A = ah.UiArea
|
||||
newB.WM = wm
|
||||
gb.Area.UiArea = ui.NewArea(gb.Area)
|
||||
newB.A = gb.Area.UiArea
|
||||
newB.GW = gb.W
|
||||
newB.Box = gb
|
||||
// Data.AllButtons[1].A = ah.UiArea
|
||||
// ah.Button = &Data.AllButtons[1]
|
||||
ah.Button = newB
|
||||
gb.Area.Button = newB
|
||||
|
||||
if (Data.Debug) {
|
||||
spew.Dump(ah.UiArea)
|
||||
spew.Dump(gb.Area.UiArea)
|
||||
log.Println("DEBUGGING", Data.Debug)
|
||||
} else {
|
||||
log.Println("NOT DEBUGGING AREA mhAH.Button =", ah.Button)
|
||||
log.Println("NOT DEBUGGING AREA mhAH.Button =", gb.Area.Button)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
20
debug.go
20
debug.go
|
@ -56,13 +56,17 @@ func addTableTab() {
|
|||
// AddTableTab(Data.Window1.T, 1, "test seven", 7, parts, nil)
|
||||
}
|
||||
|
||||
func addDebuggingButtons(wm *GuiWindow, vbox *ui.Box) {
|
||||
func addDebuggingButtons(box *GuiBox) {
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
box.UiBox.Append(vbox, false)
|
||||
|
||||
vbox.Append(ui.NewLabel("Debugging:"), false)
|
||||
|
||||
vbox.Append(ui.NewColorButton(), false)
|
||||
a := CreateButton(wm, nil, nil, "Add Account", "ADD", nil)
|
||||
a := CreateButton(box, nil, nil, "Add Account", "ADD", nil)
|
||||
vbox.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, nil, "Quit", "QUIT", nil)
|
||||
a = CreateButton(box, nil, nil, "Quit", "QUIT", nil)
|
||||
vbox.Append(a.B, false)
|
||||
|
||||
// ATTEMPT TO ADD THE TABLE HERE
|
||||
|
@ -74,16 +78,16 @@ func addDebuggingButtons(wm *GuiWindow, vbox *ui.Box) {
|
|||
vbox.Append(add2button, false)
|
||||
// ATTEMPT TO ADD THE TABLE HERE END
|
||||
|
||||
a = CreateButton(wm, nil, nil, "Hide & Show Box1&2", "HIDE", runTestHide)
|
||||
a = CreateButton(box, nil, nil, "Hide & Show Box1&2", "HIDE", runTestHide)
|
||||
vbox.Append(a.B, false)
|
||||
|
||||
a = CreateButton(wm, nil, nil, "Close GUI", "QUIT", nil)
|
||||
a = CreateButton(box, nil, nil, "Close GUI", "QUIT", nil)
|
||||
vbox.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, nil, "DEBUG goroutines", "DEBUG", nil)
|
||||
a = CreateButton(box, nil, nil, "DEBUG goroutines", "DEBUG", nil)
|
||||
vbox.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, nil, "xterm", "XTERM", runTestExecClick)
|
||||
a = CreateButton(box, nil, nil, "xterm", "XTERM", runTestExecClick)
|
||||
vbox.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, nil, "Load test.json config file", "CONFIG", nil)
|
||||
a = CreateButton(box, nil, nil, "Load test.json config file", "CONFIG", nil)
|
||||
vbox.Append(a.B, false)
|
||||
}
|
||||
|
||||
|
|
58
gui.go
58
gui.go
|
@ -42,7 +42,7 @@ func InitColumns(mh *TableData, parts []TableColumnData) {
|
|||
}
|
||||
}
|
||||
|
||||
func AddTableTab(gw *GuiWindow, mytab *ui.Tab, junk int, name string, rowcount int, parts []TableColumnData, account *pb.Account) *TableData {
|
||||
func AddTableTab(gw *GuiWindow, junk int, name string, rowcount int, parts []TableColumnData, account *pb.Account) *TableData {
|
||||
mh := new(TableData)
|
||||
|
||||
mh.RowCount = rowcount
|
||||
|
@ -79,11 +79,20 @@ func AddTableTab(gw *GuiWindow, mytab *ui.Tab, junk int, name string, rowcount i
|
|||
}
|
||||
}
|
||||
|
||||
var gb *GuiBox
|
||||
gb = new(GuiBox)
|
||||
|
||||
gb.EntryMap = make(map[string]*GuiEntry)
|
||||
gb.EntryMap["test"] = nil
|
||||
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
gb.UiBox = vbox
|
||||
gb.W = gw
|
||||
gw.BoxMap[name] = gb
|
||||
|
||||
vbox.Append(table, true)
|
||||
mytab.Append(name, vbox)
|
||||
gw.UiTab.Append(name, vbox)
|
||||
// mytab.SetMargined(mytabcount, true)
|
||||
|
||||
vbox.Append(ui.NewVerticalSeparator(), false)
|
||||
|
@ -91,10 +100,8 @@ func AddTableTab(gw *GuiWindow, mytab *ui.Tab, junk int, name string, rowcount i
|
|||
hbox := ui.NewHorizontalBox()
|
||||
hbox.SetPadded(true)
|
||||
|
||||
a := CreateButton(gw, account, nil, "Add Virtual Machine", "createAddVmBox", nil)
|
||||
a := CreateButton(gb, account, nil, "Add Virtual Machine", "createAddVmBox", nil)
|
||||
hbox.Append(a.B, false)
|
||||
b := CreateButton(gw, account, nil, "Add Virtual Machine", "createAddVmBox", nil)
|
||||
hbox.Append(b.B, false)
|
||||
|
||||
vbox.Append(hbox, false)
|
||||
|
||||
|
@ -102,17 +109,17 @@ func AddTableTab(gw *GuiWindow, mytab *ui.Tab, junk int, name string, rowcount i
|
|||
}
|
||||
|
||||
func SocketError(gw *GuiWindow) {
|
||||
ui.MsgBoxError(gw.W,
|
||||
ui.MsgBoxError(gw.UiWindow,
|
||||
"There was a socket error",
|
||||
"More detailed information can be shown here.")
|
||||
}
|
||||
|
||||
func MessageWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
||||
ui.MsgBox(gw.W, msg1, msg2)
|
||||
ui.MsgBox(gw.UiWindow, msg1, msg2)
|
||||
}
|
||||
|
||||
func ErrorWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
||||
ui.MsgBoxError(gw.W, msg1, msg2)
|
||||
ui.MsgBoxError(gw.UiWindow, msg1, msg2)
|
||||
}
|
||||
|
||||
// This is the default mouse click handler
|
||||
|
@ -134,7 +141,7 @@ 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.WM, b.T, "Create New Virtual Machine", b)
|
||||
createAddVmBox(b.GW, b.T, "Create New Virtual Machine", b)
|
||||
return
|
||||
}
|
||||
/*
|
||||
|
@ -212,7 +219,7 @@ func AddButton(b *GuiButton, name string) *ui.Button {
|
|||
return newB
|
||||
}
|
||||
|
||||
func CreateButton(gw *GuiWindow, a *pb.Account, vm *pb.Event_VM,
|
||||
func CreateButton(box *GuiBox, a *pb.Account, vm *pb.Event_VM,
|
||||
name string, action string, custom func(*GuiButton)) *GuiButton {
|
||||
newUiB := ui.NewButton(name)
|
||||
newUiB.OnClicked(defaultButtonClick)
|
||||
|
@ -220,10 +227,15 @@ func CreateButton(gw *GuiWindow, a *pb.Account, vm *pb.Event_VM,
|
|||
var newB *GuiButton
|
||||
newB = new(GuiButton)
|
||||
newB.B = newUiB
|
||||
newB.T = gw.UiTab
|
||||
if (box.W == nil) {
|
||||
log.Println("CreateButton() box.W == nil")
|
||||
panic("crap")
|
||||
}
|
||||
newB.GW = box.W
|
||||
newB.T = box.W.UiTab
|
||||
newB.Account = a
|
||||
newB.VM = vm
|
||||
newB.WM = gw
|
||||
newB.Box = box
|
||||
newB.Action = action
|
||||
newB.custom = custom
|
||||
Data.AllButtons = append(Data.AllButtons, newB)
|
||||
|
@ -231,21 +243,21 @@ func CreateButton(gw *GuiWindow, a *pb.Account, vm *pb.Event_VM,
|
|||
return newB
|
||||
}
|
||||
|
||||
func CreateFontButton(gw *GuiWindow, action string) *GuiButton {
|
||||
newB := ui.NewFontButton()
|
||||
func CreateFontButton(box *GuiBox, action string) *GuiButton {
|
||||
|
||||
// create a 'fake' button entry for the mouse clicks
|
||||
var newBM GuiButton
|
||||
newBM.Action = action
|
||||
newBM.FB = newB
|
||||
newBM.Area = gw.Area
|
||||
Data.AllButtons = append(Data.AllButtons, &newBM)
|
||||
var newGB GuiButton
|
||||
newGB.Action = action
|
||||
newGB.FB = ui.NewFontButton()
|
||||
newGB.Box = box
|
||||
newGB.Area = box.Area
|
||||
Data.AllButtons = append(Data.AllButtons, &newGB)
|
||||
|
||||
newB.OnChanged(func (*ui.FontButton) {
|
||||
log.Println("FontButton.OnChanged() START mouseClick(&newBM)", newBM)
|
||||
mouseClick(&newBM)
|
||||
newGB.FB.OnChanged(func (*ui.FontButton) {
|
||||
log.Println("FontButton.OnChanged() START mouseClick(&newBM)", newGB)
|
||||
mouseClick(&newGB)
|
||||
})
|
||||
return &newBM
|
||||
return &newGB
|
||||
}
|
||||
|
||||
func GetText(box *GuiBox, name string) string {
|
||||
|
|
|
@ -16,6 +16,7 @@ import pb "git.wit.com/wit/witProtobuf"
|
|||
func makeCloudInfoBox(gw *GuiWindow) *GuiBox {
|
||||
var gb *GuiBox
|
||||
gb = new(GuiBox)
|
||||
gb.W = gw
|
||||
|
||||
gb.EntryMap = make(map[string]*GuiEntry)
|
||||
gb.EntryMap["test"] = nil
|
||||
|
@ -27,11 +28,13 @@ func makeCloudInfoBox(gw *GuiWindow) *GuiBox {
|
|||
|
||||
if (Data.Debug) {
|
||||
log.Println("makeCloudInfoBox() add debugging buttons")
|
||||
/*
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
hbox.Append(vbox, false)
|
||||
*/
|
||||
|
||||
addDebuggingButtons(gw, vbox)
|
||||
addDebuggingButtons(gb)
|
||||
|
||||
hbox.Append(ui.NewVerticalSeparator(), false)
|
||||
}
|
||||
|
@ -54,7 +57,7 @@ func makeCloudInfoBox(gw *GuiWindow) *GuiBox {
|
|||
hostnameEntry.SetText(tmp)
|
||||
hostnameEntry.SetReadOnly(true)
|
||||
|
||||
anew := CreateButton(gw, nil, nil, "Edit", "EDIT", nil)
|
||||
anew := CreateButton(gb, nil, nil, "Edit", "EDIT", nil)
|
||||
hostnamebox.Append(anew.B, false)
|
||||
|
||||
vbox.Append(ui.NewHorizontalSeparator(), false)
|
||||
|
@ -79,11 +82,11 @@ func makeCloudInfoBox(gw *GuiWindow) *GuiBox {
|
|||
agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Email), 2, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||
|
||||
name := "Login " + Data.Config.Accounts[key].Nick
|
||||
l := CreateButton(gw, Data.Config.Accounts[key], nil, name, "LOGIN", nil)
|
||||
l := CreateButton(gb, Data.Config.Accounts[key], nil, name, "LOGIN", nil)
|
||||
agrid.Append(l.B, 3, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||
|
||||
name = "Show " + Data.Config.Accounts[key].Nick
|
||||
b := CreateButton(gw, Data.Config.Accounts[key], nil, name, "SHOW", nil)
|
||||
b := CreateButton(gb, Data.Config.Accounts[key], nil, name, "SHOW", nil)
|
||||
agrid.Append(b.B, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||
|
||||
row += 1
|
||||
|
@ -92,9 +95,9 @@ func makeCloudInfoBox(gw *GuiWindow) *GuiBox {
|
|||
row += 1
|
||||
agrid.Append(ui.NewLabel(""), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||
row += 1
|
||||
a := CreateButton(gw, nil, nil, "Add Account", "ADD TAB", nil)
|
||||
a := CreateButton(gb, nil, nil, "Add Account", "ADD TAB", nil)
|
||||
agrid.Append(a.B, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||
q := CreateButton(gw, nil, nil, "Quit", "QUIT", nil)
|
||||
q := CreateButton(gb, nil, nil, "Quit", "QUIT", nil)
|
||||
agrid.Append(q.B, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||
|
||||
vbox.Append(agrid, false)
|
||||
|
@ -164,7 +167,7 @@ func AddVmsTab(gw *GuiWindow, name string, count int, a *pb.Account) *TableData
|
|||
parts = append(parts, tmp)
|
||||
human += 1
|
||||
|
||||
mh := AddTableTab(gw, gw.UiTab, 1, name, count, parts, a)
|
||||
mh := AddTableTab(gw, 1, name, count, parts, a)
|
||||
return mh
|
||||
}
|
||||
|
||||
|
@ -237,7 +240,8 @@ func GuiInit() {
|
|||
func StartNewWindow(c *pb.Config, bg bool, action string) {
|
||||
log.Println("InitNewWindow() Create a new window")
|
||||
var newGuiWindow GuiWindow
|
||||
newGuiWindow.C = c
|
||||
newGuiWindow.Width = int(c.Width)
|
||||
newGuiWindow.Height = int(c.Height)
|
||||
newGuiWindow.Action = action
|
||||
Data.Windows = append(Data.Windows, &newGuiWindow)
|
||||
|
||||
|
@ -264,22 +268,20 @@ func getSplashText(a string) *ui.AttributedString {
|
|||
return aText
|
||||
}
|
||||
|
||||
|
||||
func InitWindow(gw *GuiWindow) {
|
||||
log.Println("InitWindow() THIS WINDOW IS NOT YET SHOWN")
|
||||
|
||||
c := gw.C
|
||||
gw.W = ui.NewWindow("", int(c.Width), int(c.Height), true)
|
||||
gw.W.SetBorderless(false)
|
||||
gw.UiWindow = ui.NewWindow("", int(gw.Width), int(gw.Height), true)
|
||||
gw.UiWindow.SetBorderless(false)
|
||||
|
||||
// create a 'fake' button entry for the mouse clicks
|
||||
var newBM GuiButton
|
||||
newBM.Action = "QUIT"
|
||||
newBM.W = gw.W
|
||||
newBM.WM = gw
|
||||
newBM.W = gw.UiWindow
|
||||
newBM.GW = gw
|
||||
Data.AllButtons = append(Data.AllButtons, &newBM)
|
||||
|
||||
gw.W.OnClosing(func(*ui.Window) bool {
|
||||
gw.UiWindow.OnClosing(func(*ui.Window) bool {
|
||||
log.Println("InitWindow() OnClosing() THIS WINDOW IS CLOSING gw=", gw)
|
||||
// mouseClick(&newBM)
|
||||
ui.Quit()
|
||||
|
@ -287,15 +289,15 @@ func InitWindow(gw *GuiWindow) {
|
|||
})
|
||||
|
||||
gw.UiTab = ui.NewTab()
|
||||
gw.W.SetChild(gw.UiTab)
|
||||
gw.W.SetMargined(true)
|
||||
gw.UiWindow.SetChild(gw.UiTab)
|
||||
gw.UiWindow.SetMargined(true)
|
||||
|
||||
log.Println("InitWindow() gw =", gw)
|
||||
log.Println("InitWindow() gw.Action =", gw.Action)
|
||||
|
||||
if (gw.Action == "SPLASH") {
|
||||
log.Println("InitWindow() TRYING SPLASH")
|
||||
damnit := "click" + string(c.Hostname)
|
||||
damnit := "click" + string(Data.Config.Hostname)
|
||||
tmp := getSplashText(damnit)
|
||||
log.Println("InitWindow() TRYING SPLASH tmp =", tmp)
|
||||
abox := ShowSplashBox(gw, tmp)
|
||||
|
@ -305,7 +307,7 @@ func InitWindow(gw *GuiWindow) {
|
|||
}
|
||||
|
||||
Data.State = "splash"
|
||||
gw.W.Show()
|
||||
gw.UiWindow.Show()
|
||||
}
|
||||
|
||||
// makeEntryBox(box, "hostname:", "blah.foo.org") {
|
||||
|
|
28
splash.go
28
splash.go
|
@ -11,10 +11,10 @@ import "runtime"
|
|||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *GuiBox {
|
||||
func ShowSplashBox(gw *GuiWindow, newText *ui.AttributedString) *GuiBox {
|
||||
log.Println("ShowSplashBox() START")
|
||||
log.Println("ShowSplashBox() START wm =", wm)
|
||||
if (wm == nil) {
|
||||
log.Println("ShowSplashBox() START gw =", gw)
|
||||
if (gw == nil) {
|
||||
log.Println("ShowSplashBox() WE ARE FUCKED BECAUSE WE DON'T KNOW WHAT WINDOW TO DO THIS IN")
|
||||
os.Exit(0)
|
||||
return nil
|
||||
|
@ -29,15 +29,19 @@ func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *GuiBox {
|
|||
newbox.SetPadded(true)
|
||||
// gw.Box1 = hbox
|
||||
gb.UiBox = newbox
|
||||
gb.W = gw
|
||||
gw.BoxMap["Splash"] = gb
|
||||
|
||||
/*
|
||||
// initialize the GuiArea{}
|
||||
wm.Area = new(GuiArea)
|
||||
wm.Area.Window = wm
|
||||
wm.Area.UiAttrstr = newText
|
||||
makeSplashArea(wm, wm.Area)
|
||||
gb.Area = wm.Area
|
||||
gb.Area = new(GuiArea)
|
||||
gb.Area.Window = gw
|
||||
gb.Area.UiAttrstr = newText
|
||||
*/
|
||||
|
||||
newbox.Append(wm.Area.UiArea, true)
|
||||
makeSplashArea(gb, newText)
|
||||
|
||||
newbox.Append(gb.Area.UiArea, true)
|
||||
|
||||
if runtime.GOOS == "linux" {
|
||||
newbox.Append(ui.NewLabel("OS: Linux"), false)
|
||||
|
@ -65,12 +69,12 @@ func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *GuiBox {
|
|||
}
|
||||
}
|
||||
|
||||
log.Println("ShowSplashBox() START wm =", wm)
|
||||
log.Println("ShowSplashBox() START gb =", gb)
|
||||
|
||||
okButton := CreateButton(wm, nil, nil, "OK", "AREA", nil)
|
||||
okButton := CreateButton(gb, nil, nil, "OK", "AREA", nil)
|
||||
newbox.Append(okButton.B, false)
|
||||
|
||||
okButton = CreateButton(wm, nil, nil, "NEWTEXT", "NEWTEXT", nil)
|
||||
okButton = CreateButton(gb, nil, nil, "NEWTEXT", "NEWTEXT", nil)
|
||||
newbox.Append(okButton.B, false)
|
||||
|
||||
// os.Exit(0)
|
||||
|
|
16
structs.go
16
structs.go
|
@ -71,15 +71,13 @@ type GuiData struct {
|
|||
//
|
||||
type GuiWindow struct {
|
||||
Action string
|
||||
Area *GuiArea // should be moved to GuiBox
|
||||
|
||||
C *pb.Config
|
||||
|
||||
W *ui.Window
|
||||
UiTab *ui.Tab // if this != nil, the window is 'tabbed'
|
||||
// Area *GuiArea // should be moved to GuiBox
|
||||
BoxMap map[string]*GuiBox
|
||||
// Box1 *ui.Box
|
||||
// Box2 *ui.Box
|
||||
Width int
|
||||
Height int
|
||||
|
||||
UiWindow *ui.Window
|
||||
UiTab *ui.Tab // if this != nil, the window is 'tabbed'
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +89,7 @@ type GuiButton struct {
|
|||
Action string // what type of button
|
||||
Box *GuiBox // what box the button click was in
|
||||
Area *GuiArea // indicates the button click was in an Area
|
||||
WM *GuiWindow // what window the button click was in (redundant?)
|
||||
GW *GuiWindow // what window the button click was in (redundant?)
|
||||
|
||||
Account *pb.Account // associated with what account?
|
||||
VM *pb.Event_VM // associated with which VM?
|
||||
|
|
53
vmBox.go
53
vmBox.go
|
@ -14,15 +14,27 @@ func AddVmConfigureTab(wm *GuiWindow, name string, pbVM *pb.Event_VM) {
|
|||
CreateVmBox(wm, wm.UiTab, pbVM)
|
||||
}
|
||||
|
||||
func CreateVmBox(wm *GuiWindow, tab *ui.Tab, vm *pb.Event_VM) {
|
||||
func CreateVmBox(gw *GuiWindow, junk *ui.Tab, vm *pb.Event_VM) {
|
||||
log.Println("CreateVmBox() START")
|
||||
log.Println("CreateVmBox() vm.Name", vm.Name)
|
||||
|
||||
var gb *GuiBox
|
||||
gb = new(GuiBox)
|
||||
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
gb.UiBox = vbox
|
||||
gb.W = gw
|
||||
gw.BoxMap[vm.Name] = gb
|
||||
|
||||
// gw.UiTab.Append(vm.Name, vbox)
|
||||
|
||||
|
||||
|
||||
spew.Dump(vm)
|
||||
if (Data.Debug) {
|
||||
spew.Dump(vm)
|
||||
}
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
|
||||
hboxAccount := ui.NewHorizontalBox()
|
||||
hboxAccount.SetPadded(true)
|
||||
|
@ -42,28 +54,39 @@ func CreateVmBox(wm *GuiWindow, tab *ui.Tab, vm *pb.Event_VM) {
|
|||
hboxButtons.SetPadded(true)
|
||||
vbox.Append(hboxButtons, false)
|
||||
|
||||
a := CreateButton(wm, nil, vm, "Power On", "POWERON", nil)
|
||||
a := CreateButton(gb, nil, vm, "Power On", "POWERON", nil)
|
||||
hboxButtons.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, vm, "Power Off", "POWEROFF", nil)
|
||||
a = CreateButton(gb, nil, vm, "Power Off", "POWEROFF", nil)
|
||||
hboxButtons.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, vm, "Destroy", "DESTROY", nil)
|
||||
a = CreateButton(gb, nil, vm, "Destroy", "DESTROY", nil)
|
||||
hboxButtons.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, vm, "ping", "PING", runPingClick)
|
||||
a = CreateButton(gb, nil, vm, "ping", "PING", runPingClick)
|
||||
hboxButtons.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, vm, "Console", "XTERM", runTestExecClick)
|
||||
a = CreateButton(gb, nil, vm, "Console", "XTERM", runTestExecClick)
|
||||
hboxButtons.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, vm, "Save", "SAVE", nil)
|
||||
a = CreateButton(gb, nil, vm, "Save", "SAVE", nil)
|
||||
hboxButtons.Append(a.B, false)
|
||||
a = CreateButton(wm, nil, vm, "Done", "DONE", nil)
|
||||
a = CreateButton(gb, nil, vm, "Done", "DONE", nil)
|
||||
hboxButtons.Append(a.B, false)
|
||||
|
||||
AddBoxToTab(vm.Name, tab, vbox)
|
||||
AddBoxToTab(vm.Name, gw.UiTab, vbox)
|
||||
}
|
||||
|
||||
func createAddVmBox(wm *GuiWindow, tab *ui.Tab, name string, b *GuiButton) {
|
||||
func createAddVmBox(gw *GuiWindow, junk *ui.Tab, name string, b *GuiButton) {
|
||||
log.Println("createAddVmBox() START")
|
||||
|
||||
var gb *GuiBox
|
||||
gb = new(GuiBox)
|
||||
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
gb.UiBox = vbox
|
||||
gb.W = gw
|
||||
gw.BoxMap[name] = gb
|
||||
|
||||
// gw.UiTab.Append(vm.Name, vbox)
|
||||
|
||||
|
||||
|
||||
hbox := ui.NewHorizontalBox()
|
||||
hbox.SetPadded(true)
|
||||
|
@ -86,16 +109,16 @@ func createAddVmBox(wm *GuiWindow, tab *ui.Tab, name string, b *GuiButton) {
|
|||
newb.Action = "CREATE"
|
||||
newb.VM = b.VM
|
||||
newb.Account = b.Account
|
||||
newb.T = tab
|
||||
newb.T = gw.UiTab
|
||||
hostname.B = &newb
|
||||
memory.B = &newb
|
||||
disk.B = &newb
|
||||
hboxButtons.Append(AddButton(&newb, "Add Virtual Machine"), false)
|
||||
|
||||
// hboxButtons.Append(CreateButton(nil, nil, "Add Virtual Machine","CREATE",nil), false)
|
||||
a := CreateButton(wm, nil, nil, "Cancel", "CLOSE", nil)
|
||||
a := CreateButton(gb, nil, nil, "Cancel", "CLOSE", nil)
|
||||
hboxButtons.Append(a.B, false)
|
||||
|
||||
name += " (" + b.Account.Nick + ")"
|
||||
AddBoxToTab(name, tab, vbox)
|
||||
AddBoxToTab(name, gw.UiTab, vbox)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue