change CreateButton to rerturn *GuiButton
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
30fc964c5e
commit
403e7d089c
|
@ -41,14 +41,14 @@ func AddAccountQuestionBox(wm *GuiWindow) *ui.Box {
|
||||||
hbox.Append(ui.NewLabel("Enter your Subdomain or"), false)
|
hbox.Append(ui.NewLabel("Enter your Subdomain or"), false)
|
||||||
|
|
||||||
generate := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
generate := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
||||||
hbox.Append(generate, false)
|
hbox.Append(generate.B, false)
|
||||||
|
|
||||||
AddEntry(gb, "SUBDOMAIN")
|
AddEntry(gb, "SUBDOMAIN")
|
||||||
|
|
||||||
vbox.Append(ui.NewHorizontalSeparator(), false)
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
||||||
|
|
||||||
okButton := CreateButton(wm, nil, nil, "Create Subdomain Account", "SUBDOMAIN", addSubdomain)
|
okButton := CreateButton(wm, nil, nil, "Create Subdomain Account", "SUBDOMAIN", addSubdomain)
|
||||||
vbox.Append(okButton, false)
|
vbox.Append(okButton.B, false)
|
||||||
|
|
||||||
return vbox
|
return vbox
|
||||||
}
|
}
|
||||||
|
@ -179,10 +179,10 @@ func AddAccountBox(wm *GuiWindow) *ui.Box {
|
||||||
vbox.Append(hboxButtons, false)
|
vbox.Append(hboxButtons, false)
|
||||||
|
|
||||||
okButton := CreateButton(wm, nil, nil, "Add Account", "ADD", nil)
|
okButton := CreateButton(wm, nil, nil, "Add Account", "ADD", nil)
|
||||||
hboxButtons.Append(okButton, false)
|
hboxButtons.Append(okButton.B, false)
|
||||||
|
|
||||||
backButton := CreateButton(wm, nil, nil, "Back", "BACK", nil)
|
backButton := CreateButton(wm, nil, nil, "Back", "BACK", nil)
|
||||||
hboxButtons.Append(backButton, false)
|
hboxButtons.Append(backButton.B, false)
|
||||||
|
|
||||||
return vbox
|
return vbox
|
||||||
}
|
}
|
||||||
|
|
21
debug.go
21
debug.go
|
@ -60,8 +60,10 @@ func addDebuggingButtons(wm *GuiWindow, vbox *ui.Box) {
|
||||||
vbox.Append(ui.NewLabel("Debugging:"), false)
|
vbox.Append(ui.NewLabel("Debugging:"), false)
|
||||||
|
|
||||||
vbox.Append(ui.NewColorButton(), false)
|
vbox.Append(ui.NewColorButton(), false)
|
||||||
vbox.Append(CreateButton(wm, nil, nil, "Add Account", "ADD", nil), false)
|
a := CreateButton(wm, nil, nil, "Add Account", "ADD", nil)
|
||||||
vbox.Append(CreateButton(wm, nil, nil, "Quit", "QUIT", nil), false)
|
vbox.Append(a.B, false)
|
||||||
|
a = CreateButton(wm, nil, nil, "Quit", "QUIT", nil)
|
||||||
|
vbox.Append(a.B, false)
|
||||||
|
|
||||||
// ATTEMPT TO ADD THE TABLE HERE
|
// ATTEMPT TO ADD THE TABLE HERE
|
||||||
add2button := ui.NewButton("Add a Test Table")
|
add2button := ui.NewButton("Add a Test Table")
|
||||||
|
@ -72,12 +74,17 @@ func addDebuggingButtons(wm *GuiWindow, vbox *ui.Box) {
|
||||||
vbox.Append(add2button, false)
|
vbox.Append(add2button, false)
|
||||||
// ATTEMPT TO ADD THE TABLE HERE END
|
// ATTEMPT TO ADD THE TABLE HERE END
|
||||||
|
|
||||||
vbox.Append(CreateButton(wm, nil, nil, "Hide & Show Box1&2", "HIDE", runTestHide), false)
|
a = CreateButton(wm, nil, nil, "Hide & Show Box1&2", "HIDE", runTestHide)
|
||||||
|
vbox.Append(a.B, false)
|
||||||
|
|
||||||
vbox.Append(CreateButton(wm, nil, nil, "Close GUI", "QUIT", nil), false)
|
a = CreateButton(wm, nil, nil, "Close GUI", "QUIT", nil)
|
||||||
vbox.Append(CreateButton(wm, nil, nil, "DEBUG goroutines", "DEBUG", nil), false)
|
vbox.Append(a.B, false)
|
||||||
vbox.Append(CreateButton(wm, nil, nil, "xterm", "XTERM", runTestExecClick), false)
|
a = CreateButton(wm, nil, nil, "DEBUG goroutines", "DEBUG", nil)
|
||||||
vbox.Append(CreateButton(wm, nil, nil, "Load test.json config file", "CONFIG", nil), false)
|
vbox.Append(a.B, false)
|
||||||
|
a = CreateButton(wm, nil, nil, "xterm", "XTERM", runTestExecClick)
|
||||||
|
vbox.Append(a.B, false)
|
||||||
|
a = CreateButton(wm, nil, nil, "Load test.json config file", "CONFIG", nil)
|
||||||
|
vbox.Append(a.B, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runTestHide(b *GuiButton) {
|
func runTestHide(b *GuiButton) {
|
||||||
|
|
15
gui.go
15
gui.go
|
@ -90,8 +90,10 @@ func AddTableTab(wm *GuiWindow, mytab *ui.Tab, junk int, name string, rowcount i
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
|
||||||
hbox.Append(CreateButton(wm, account, nil, "Add Virtual Machine", "createAddVmBox", nil), false)
|
a := CreateButton(wm, account, nil, "Add Virtual Machine", "createAddVmBox", nil)
|
||||||
hbox.Append(CreateButton(wm, account, nil, "Close", "CLOSE", nil), false)
|
hbox.Append(a.B, false)
|
||||||
|
b := CreateButton(wm, account, nil, "Add Virtual Machine", "createAddVmBox", nil)
|
||||||
|
hbox.Append(b.B, false)
|
||||||
|
|
||||||
vbox.Append(hbox, false)
|
vbox.Append(hbox, false)
|
||||||
|
|
||||||
|
@ -210,11 +212,12 @@ func AddButton(b *GuiButton, name string) *ui.Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateButton(wm *GuiWindow, a *pb.Account, vm *pb.Event_VM,
|
func CreateButton(wm *GuiWindow, a *pb.Account, vm *pb.Event_VM,
|
||||||
name string, action string, custom func(*GuiButton)) *ui.Button {
|
name string, action string, custom func(*GuiButton)) *GuiButton {
|
||||||
newUiB := ui.NewButton(name)
|
newUiB := ui.NewButton(name)
|
||||||
newUiB.OnClicked(defaultButtonClick)
|
newUiB.OnClicked(defaultButtonClick)
|
||||||
|
|
||||||
var newB GuiButton
|
var newB *GuiButton
|
||||||
|
newB = new(GuiButton)
|
||||||
newB.B = newUiB
|
newB.B = newUiB
|
||||||
newB.T = wm.T
|
newB.T = wm.T
|
||||||
newB.Account = a
|
newB.Account = a
|
||||||
|
@ -222,9 +225,9 @@ func CreateButton(wm *GuiWindow, a *pb.Account, vm *pb.Event_VM,
|
||||||
newB.WM = wm
|
newB.WM = wm
|
||||||
newB.Action = action
|
newB.Action = action
|
||||||
newB.custom = custom
|
newB.custom = custom
|
||||||
Data.AllButtons = append(Data.AllButtons, newB)
|
Data.AllButtons = append(Data.AllButtons, *newB)
|
||||||
|
|
||||||
return newUiB
|
return newB
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateFontButton(wm *GuiWindow, action string) *GuiButton {
|
func CreateFontButton(wm *GuiWindow, action string) *GuiButton {
|
||||||
|
|
|
@ -46,7 +46,8 @@ func makeCloudInfoBox(wm *GuiWindow) *ui.Box {
|
||||||
hostnameEntry.SetText(tmp)
|
hostnameEntry.SetText(tmp)
|
||||||
hostnameEntry.SetReadOnly(true)
|
hostnameEntry.SetReadOnly(true)
|
||||||
|
|
||||||
hostnamebox.Append(CreateButton(wm, nil, nil, "Edit", "EDIT", nil), false)
|
anew := CreateButton(wm, nil, nil, "Edit", "EDIT", nil)
|
||||||
|
hostnamebox.Append(anew.B, false)
|
||||||
|
|
||||||
vbox.Append(ui.NewHorizontalSeparator(), false)
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
||||||
|
|
||||||
|
@ -73,11 +74,11 @@ func makeCloudInfoBox(wm *GuiWindow) *ui.Box {
|
||||||
|
|
||||||
name := "Login " + Data.Config.Accounts[key].Nick
|
name := "Login " + Data.Config.Accounts[key].Nick
|
||||||
l := CreateButton(wm, Data.Config.Accounts[key], nil, name, "LOGIN", nil)
|
l := CreateButton(wm, Data.Config.Accounts[key], nil, name, "LOGIN", nil)
|
||||||
agrid.Append(l, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
agrid.Append(l.B, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
|
|
||||||
name = "Show " + Data.Config.Accounts[key].Nick
|
name = "Show " + Data.Config.Accounts[key].Nick
|
||||||
b := CreateButton(wm, Data.Config.Accounts[key], nil, name, "SHOW", nil)
|
b := CreateButton(wm, Data.Config.Accounts[key], nil, name, "SHOW", nil)
|
||||||
agrid.Append(b, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
agrid.Append(b.B, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
|
|
||||||
row += 1
|
row += 1
|
||||||
}
|
}
|
||||||
|
@ -86,9 +87,9 @@ func makeCloudInfoBox(wm *GuiWindow) *ui.Box {
|
||||||
agrid.Append(ui.NewLabel(""), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
agrid.Append(ui.NewLabel(""), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
row += 1
|
row += 1
|
||||||
a := CreateButton(wm, nil, nil, "Add Account", "ADD TAB", nil)
|
a := CreateButton(wm, nil, nil, "Add Account", "ADD TAB", nil)
|
||||||
agrid.Append(a, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
agrid.Append(a.B, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
q := CreateButton(wm, nil, nil, "Quit", "QUIT", nil)
|
q := CreateButton(wm, nil, nil, "Quit", "QUIT", nil)
|
||||||
agrid.Append(q, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
agrid.Append(q.B, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
|
|
||||||
vbox.Append(agrid, false)
|
vbox.Append(agrid, false)
|
||||||
return hbox
|
return hbox
|
||||||
|
|
|
@ -57,9 +57,12 @@ func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *ui.Box {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("ShowSplashBox() START wm =", wm)
|
log.Println("ShowSplashBox() START wm =", wm)
|
||||||
|
|
||||||
okButton := CreateButton(wm, nil, nil, "OK", "AREA", nil)
|
okButton := CreateButton(wm, nil, nil, "OK", "AREA", nil)
|
||||||
newbox.Append(okButton, false)
|
newbox.Append(okButton.B, false)
|
||||||
newbox.Append(CreateButton(wm, nil, nil, "NEWTEXT", "NEWTEXT", nil), false)
|
|
||||||
|
okButton = CreateButton(wm, nil, nil, "NEWTEXT", "NEWTEXT", nil)
|
||||||
|
newbox.Append(okButton.B, false)
|
||||||
|
|
||||||
// os.Exit(0)
|
// os.Exit(0)
|
||||||
return newbox
|
return newbox
|
||||||
|
|
24
vmBox.go
24
vmBox.go
|
@ -42,13 +42,20 @@ func CreateVmBox(wm *GuiWindow, tab *ui.Tab, vm *pb.Event_VM) {
|
||||||
hboxButtons.SetPadded(true)
|
hboxButtons.SetPadded(true)
|
||||||
vbox.Append(hboxButtons, false)
|
vbox.Append(hboxButtons, false)
|
||||||
|
|
||||||
hboxButtons.Append(CreateButton(wm, nil, vm, "Power On", "POWERON", nil), false)
|
a := CreateButton(wm, nil, vm, "Power On", "POWERON", nil)
|
||||||
hboxButtons.Append(CreateButton(wm, nil, vm, "Power Off", "POWEROFF", nil), false)
|
hboxButtons.Append(a.B, false)
|
||||||
hboxButtons.Append(CreateButton(wm, nil, vm, "Destroy", "DESTROY", nil), false)
|
a = CreateButton(wm, nil, vm, "Power Off", "POWEROFF", nil)
|
||||||
hboxButtons.Append(CreateButton(wm, nil, vm, "ping", "PING", runPingClick), false)
|
hboxButtons.Append(a.B, false)
|
||||||
hboxButtons.Append(CreateButton(wm, nil, vm, "Console", "XTERM", runTestExecClick), false)
|
a = CreateButton(wm, nil, vm, "Destroy", "DESTROY", nil)
|
||||||
hboxButtons.Append(CreateButton(wm, nil, vm, "Save", "SAVE", nil), false)
|
hboxButtons.Append(a.B, false)
|
||||||
hboxButtons.Append(CreateButton(wm, nil, vm, "Done", "DONE", nil), false)
|
a = CreateButton(wm, nil, vm, "ping", "PING", runPingClick)
|
||||||
|
hboxButtons.Append(a.B, false)
|
||||||
|
a = CreateButton(wm, nil, vm, "Console", "XTERM", runTestExecClick)
|
||||||
|
hboxButtons.Append(a.B, false)
|
||||||
|
a = CreateButton(wm, nil, vm, "Save", "SAVE", nil)
|
||||||
|
hboxButtons.Append(a.B, false)
|
||||||
|
a = CreateButton(wm, nil, vm, "Done", "DONE", nil)
|
||||||
|
hboxButtons.Append(a.B, false)
|
||||||
|
|
||||||
AddBoxToTab(vm.Name, tab, vbox)
|
AddBoxToTab(vm.Name, tab, vbox)
|
||||||
}
|
}
|
||||||
|
@ -86,7 +93,8 @@ func createAddVmBox(wm *GuiWindow, tab *ui.Tab, name string, b *GuiButton) {
|
||||||
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)
|
// hboxButtons.Append(CreateButton(nil, nil, "Add Virtual Machine","CREATE",nil), false)
|
||||||
hboxButtons.Append(CreateButton(wm, nil, nil, "Cancel", "CLOSE", nil), false)
|
a := CreateButton(wm, nil, nil, "Cancel", "CLOSE", nil)
|
||||||
|
hboxButtons.Append(a.B, false)
|
||||||
|
|
||||||
name += " (" + b.Account.Nick + ")"
|
name += " (" + b.Account.Nick + ")"
|
||||||
AddBoxToTab(name, tab, vbox)
|
AddBoxToTab(name, tab, vbox)
|
||||||
|
|
Loading…
Reference in New Issue