almost complete obviewscation of the buttons

yes, I can't spell. I like it this way better anyway

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-26 12:40:07 -07:00
parent 679f01341e
commit 9894f31264
6 changed files with 30 additions and 30 deletions

View File

@ -5,16 +5,16 @@ import "log"
import "github.com/andlabs/ui" import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest" import _ "github.com/andlabs/ui/winmanifest"
func AddAccountQuestionBox(junk *ui.Box, custom func(*ButtonMap)) *ui.Box { func AddAccountQuestionBox() *ui.Box {
newbox := ui.NewVerticalBox() newbox := ui.NewVerticalBox()
newbox.SetPadded(true) newbox.SetPadded(true)
newButton := CreateButton(nil, nil, "Create New Account", "DONE", custom) newButton := CreateButton(nil, nil, "Create New Account", "DONE", nil)
newbox.Append(newButton, false) newbox.Append(newButton, false)
newbox.Append(ui.NewHorizontalSeparator(), false) newbox.Append(ui.NewHorizontalSeparator(), false)
okButton := CreateButton(nil, nil, "I Have an Account", "DONE", custom) okButton := CreateButton(nil, nil, "I Have an Account", "DONE", nil)
newbox.Append(okButton, false) newbox.Append(okButton, false)
return newbox return newbox
@ -120,9 +120,9 @@ func AddAccountBox(aTab *GuiTabStructure) {
hboxButtons.SetPadded(true) hboxButtons.SetPadded(true)
vbox.Append(hboxButtons, false) vbox.Append(hboxButtons, false)
okButton := CreateButton(nil, nil, "Add Account", "ADD", mouseClick) okButton := CreateButton(nil, nil, "Add Account", "ADD", nil)
hboxButtons.Append(okButton, false) hboxButtons.Append(okButton, false)
backButton := CreateButton(nil, nil, "Back", "BACK", mouseClick) backButton := CreateButton(nil, nil, "Back", "BACK", nil)
hboxButtons.Append(backButton, false) hboxButtons.Append(backButton, false)
} }

View File

@ -10,7 +10,7 @@ import "github.com/davecgh/go-spew/spew"
func makeSplashArea() *ui.Area { func makeSplashArea() *ui.Area {
// make this button just to get the default font (but don't display the button) // make this button just to get the default font (but don't display the button)
// There should be another way to do this (?) // There should be another way to do this (?)
Data.fontButton = CreateFontButton("SplashFont", "DONE", mouseClick) Data.fontButton = CreateFontButton("SplashFont", "DONE")
makeAttributedString() makeAttributedString()
splashArea := ui.NewArea(myAH) splashArea := ui.NewArea(myAH)

View File

@ -54,12 +54,12 @@ func addTableTab() {
AddTableTab(Data.cloudTab, 1, "test seven", 7, parts, nil) AddTableTab(Data.cloudTab, 1, "test seven", 7, parts, nil)
} }
func addDebuggingButtons(vbox *ui.Box, custom func(*ButtonMap)) { func addDebuggingButtons(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(nil, nil, "Add Account", "ADD", custom), false) vbox.Append(CreateButton(nil, nil, "Add Account", "ADD", nil), false)
vbox.Append(CreateButton(nil, nil, "Quit", "QUIT", custom), false) vbox.Append(CreateButton(nil, nil, "Quit", "QUIT", nil), 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")
@ -70,11 +70,11 @@ func addDebuggingButtons(vbox *ui.Box, custom func(*ButtonMap)) {
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(nil, nil, "Close GUI", "QUIT", custom), false) vbox.Append(CreateButton(nil, nil, "Close GUI", "QUIT", nil), false)
vbox.Append(CreateButton(nil, nil, "DEBUG goroutines", "DEBUG", custom), false) vbox.Append(CreateButton(nil, nil, "DEBUG goroutines", "DEBUG", nil), false)
// vbox.Append(CreateButton("ping", "PING", runPingClick), false) // vbox.Append(CreateButton("ping", "PING", runPingClick), false)
vbox.Append(CreateButton(nil, nil, "xterm", "XTERM", runTestExecClick), false) vbox.Append(CreateButton(nil, nil, "xterm", "XTERM", runTestExecClick), false)
vbox.Append(CreateButton(nil, nil, "Load test.json config file", "CONFIG", custom), false) vbox.Append(CreateButton(nil, nil, "Load test.json config file", "CONFIG", nil), false)
} }
func runPingClick(b *ButtonMap) { func runPingClick(b *ButtonMap) {

6
gui.go
View File

@ -90,8 +90,8 @@ func AddTableTab(mytab *ui.Tab, mytabcount int, name string, rowcount int, parts
hbox := ui.NewHorizontalBox() hbox := ui.NewHorizontalBox()
hbox.SetPadded(true) hbox.SetPadded(true)
hbox.Append(CreateButton(account, nil, "Add Virtual Machine", "createAddVmBox", mouseClick), false) hbox.Append(CreateButton(account, nil, "Add Virtual Machine", "createAddVmBox", nil), false)
hbox.Append(CreateButton(account, nil, "Close", "CLOSE", mouseClick), false) hbox.Append(CreateButton(account, nil, "Close", "CLOSE", nil), false)
vbox.Append(hbox, false) vbox.Append(hbox, false)
@ -214,7 +214,7 @@ func CreateButton(a *pb.Account, vm *pb.Event_VM,
return newB return newB
} }
func CreateFontButton(action string, note string, custom func(*ButtonMap)) *ui.FontButton { func CreateFontButton(action string, note string) *ui.FontButton {
newB := ui.NewFontButton() newB := ui.NewFontButton()
// create a 'fake' button entry for the mouse clicks // create a 'fake' button entry for the mouse clicks

View File

@ -21,7 +21,7 @@ func makeCloudInfoBox() *ui.Box {
vbox.SetPadded(true) vbox.SetPadded(true)
hbox.Append(vbox, false) hbox.Append(vbox, false)
addDebuggingButtons(vbox, mouseClick) addDebuggingButtons(vbox)
hbox.Append(ui.NewVerticalSeparator(), false) hbox.Append(ui.NewVerticalSeparator(), false)
} }
@ -44,7 +44,7 @@ func makeCloudInfoBox() *ui.Box {
hostnameEntry.SetText(tmp) hostnameEntry.SetText(tmp)
hostnameEntry.SetReadOnly(true) hostnameEntry.SetReadOnly(true)
hostnamebox.Append(CreateButton(nil, nil, "Edit", "EDIT", mouseClick), false) hostnamebox.Append(CreateButton(nil, nil, "Edit", "EDIT", nil), false)
vbox.Append(ui.NewHorizontalSeparator(), false) vbox.Append(ui.NewHorizontalSeparator(), false)
@ -70,11 +70,11 @@ func makeCloudInfoBox() *ui.Box {
agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Domain), 3, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Domain), 3, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
name := "Login " + Data.Config.Accounts[key].Nick name := "Login " + Data.Config.Accounts[key].Nick
l := CreateButton(Data.Config.Accounts[key], nil, name, "LOGIN", mouseClick) l := CreateButton(Data.Config.Accounts[key], nil, name, "LOGIN", nil)
agrid.Append(l, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) agrid.Append(l, 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(Data.Config.Accounts[key], nil, name, "SHOW", mouseClick) b := CreateButton(Data.Config.Accounts[key], nil, name, "SHOW", nil)
agrid.Append(b, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) agrid.Append(b, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
row += 1 row += 1
@ -83,9 +83,9 @@ func makeCloudInfoBox() *ui.Box {
row += 1 row += 1
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(nil, nil, "Add Account", "ADD", mouseClick) a := CreateButton(nil, nil, "Add Account", "ADD", nil)
agrid.Append(a, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) agrid.Append(a, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
q := CreateButton(nil, nil, "Quit", "QUIT", mouseClick) q := CreateButton(nil, nil, "Quit", "QUIT", nil)
agrid.Append(q, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) agrid.Append(q, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
vbox.Append(agrid, false) vbox.Append(agrid, false)
@ -165,7 +165,7 @@ func ShowAccountQuestionTab() {
log.Println("Sleep(200)") log.Println("Sleep(200)")
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
Data.smallBox = AddAccountQuestionBox(nil, mouseClick) Data.smallBox = AddAccountQuestionBox()
Data.cloudTab.InsertAt("New Account?", 0, Data.smallBox) Data.cloudTab.InsertAt("New Account?", 0, Data.smallBox)
Data.cloudTab.SetMargined(0, true) Data.cloudTab.SetMargined(0, true)
} }
@ -336,13 +336,13 @@ func createVmBox(tab *ui.Tab, pbVM *pb.Event_VM) {
vbox.Append(hboxButtons, false) vbox.Append(hboxButtons, false)
log.Println("pbVM =", pbVM) log.Println("pbVM =", pbVM)
hboxButtons.Append(CreateButton(nil, pbVM, "Power On", "POWERON", mouseClick), false) hboxButtons.Append(CreateButton(nil, pbVM, "Power On", "POWERON", nil), false)
hboxButtons.Append(CreateButton(nil, pbVM, "Power Off", "POWEROFF", mouseClick), false) hboxButtons.Append(CreateButton(nil, pbVM, "Power Off", "POWEROFF", nil), false)
hboxButtons.Append(CreateButton(nil, pbVM, "Destroy", "DESTROY", mouseClick), false) hboxButtons.Append(CreateButton(nil, pbVM, "Destroy", "DESTROY", nil), false)
hboxButtons.Append(CreateButton(nil, pbVM, "ping", "PING", runPingClick), false) hboxButtons.Append(CreateButton(nil, pbVM, "ping", "PING", runPingClick), false)
hboxButtons.Append(CreateButton(nil, pbVM, "Console", "XTERM", runTestExecClick), false) hboxButtons.Append(CreateButton(nil, pbVM, "Console", "XTERM", runTestExecClick), false)
hboxButtons.Append(CreateButton(nil, pbVM, "Save", "SAVE", mouseClick), false) hboxButtons.Append(CreateButton(nil, pbVM, "Save", "SAVE", nil), false)
hboxButtons.Append(CreateButton(nil, pbVM, "Done", "DONE", mouseClick), false) hboxButtons.Append(CreateButton(nil, pbVM, "Done", "DONE", nil), false)
tab.Append(Data.CurrentVM.Name, vbox) tab.Append(Data.CurrentVM.Name, vbox)
tab.SetMargined(0, true) tab.SetMargined(0, true)
@ -366,8 +366,8 @@ func createAddVmBox(tab *ui.Tab, name string) {
hboxButtons.SetPadded(true) hboxButtons.SetPadded(true)
vbox.Append(hboxButtons, false) vbox.Append(hboxButtons, false)
hboxButtons.Append(CreateButton(nil, nil, "Add Virtual Machine", "CREATE", mouseClick), false) hboxButtons.Append(CreateButton(nil, nil, "Add Virtual Machine", "CREATE", nil), false)
hboxButtons.Append(CreateButton(nil, nil, "Cancel", "DONE", mouseClick), false) hboxButtons.Append(CreateButton(nil, nil, "Cancel", "DONE", nil), false)
tab.Append(name, vbox) tab.Append(name, vbox)
tab.SetMargined(0, true) tab.SetMargined(0, true)

View File

@ -45,7 +45,7 @@ func ShowSplashBox() *ui.Box {
} }
} }
okButton := CreateButton(nil, nil, "OK", "DONE", mouseClick) okButton := CreateButton(nil, nil, "OK", "DONE", nil)
newbox.Append(okButton, false) newbox.Append(okButton, false)
return newbox return newbox