more tab tracking
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
5c707c2f85
commit
63c818217a
|
@ -20,10 +20,11 @@ func AddAccountQuestionBox() *ui.Box {
|
|||
return newbox
|
||||
}
|
||||
|
||||
func AddAccountBox(aTab *GuiTabStructure) {
|
||||
// func AddAccountBox(aTab *GuiTabStructure) {
|
||||
func AddAccountBox() *ui.Box {
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
aTab.firstBox = vbox
|
||||
// aTab.firstBox = vbox
|
||||
|
||||
hboxAccount := ui.NewHorizontalBox()
|
||||
hboxAccount.SetPadded(true)
|
||||
|
@ -68,13 +69,13 @@ func AddAccountBox(aTab *GuiTabStructure) {
|
|||
vboxN.SetPadded(true)
|
||||
vboxN.Append(ui.NewLabel("Account Nickname:"), false)
|
||||
|
||||
aTab.EntryNick = ui.NewEntry()
|
||||
aTab.EntryNick.SetReadOnly(false)
|
||||
Data.EntryNick = ui.NewEntry()
|
||||
Data.EntryNick.SetReadOnly(false)
|
||||
|
||||
vboxN.Append(aTab.EntryNick, false)
|
||||
vboxN.Append(Data.EntryNick, false)
|
||||
|
||||
aTab.EntryNick.OnChanged(func(*ui.Entry) {
|
||||
log.Println("OK. nickname =", aTab.EntryNick.Text())
|
||||
Data.EntryNick.OnChanged(func(*ui.Entry) {
|
||||
log.Println("OK. nickname =", Data.EntryNick.Text())
|
||||
// Data.AccNick = entryNick.Text()
|
||||
})
|
||||
hboxAccount.Append(vboxN, false)
|
||||
|
@ -85,13 +86,13 @@ func AddAccountBox(aTab *GuiTabStructure) {
|
|||
vboxU.SetPadded(true)
|
||||
vboxU.Append(ui.NewLabel("Account Username:"), false)
|
||||
|
||||
aTab.EntryUser = ui.NewEntry()
|
||||
aTab.EntryUser.SetReadOnly(false)
|
||||
Data.EntryUser = ui.NewEntry()
|
||||
Data.EntryUser.SetReadOnly(false)
|
||||
|
||||
vboxU.Append(aTab.EntryUser, false)
|
||||
vboxU.Append(Data.EntryUser, false)
|
||||
|
||||
aTab.EntryUser.OnChanged(func(*ui.Entry) {
|
||||
log.Println("OK. username =", aTab.EntryUser.Text())
|
||||
Data.EntryUser.OnChanged(func(*ui.Entry) {
|
||||
log.Println("OK. username =", Data.EntryUser.Text())
|
||||
// Data.AccUser = entryUser.Text()
|
||||
})
|
||||
hboxAccount.Append(vboxU, false)
|
||||
|
@ -102,13 +103,13 @@ func AddAccountBox(aTab *GuiTabStructure) {
|
|||
vboxP.SetPadded(true)
|
||||
vboxP.Append(ui.NewLabel("Account Password:"), false)
|
||||
|
||||
aTab.EntryPass = ui.NewEntry()
|
||||
aTab.EntryPass.SetReadOnly(false)
|
||||
Data.EntryPass = ui.NewEntry()
|
||||
Data.EntryPass.SetReadOnly(false)
|
||||
|
||||
vboxP.Append(aTab.EntryPass, false)
|
||||
vboxP.Append(Data.EntryPass, false)
|
||||
|
||||
aTab.EntryPass.OnChanged(func(*ui.Entry) {
|
||||
log.Println("OK. password =", aTab.EntryPass.Text())
|
||||
Data.EntryPass.OnChanged(func(*ui.Entry) {
|
||||
log.Println("OK. password =", Data.EntryPass.Text())
|
||||
// Data.AccPass = entryPass.Text()
|
||||
})
|
||||
hboxAccount.Append(vboxP, false)
|
||||
|
@ -125,4 +126,6 @@ func AddAccountBox(aTab *GuiTabStructure) {
|
|||
|
||||
backButton := CreateButton(nil, nil, "Back", "BACK", nil)
|
||||
hboxButtons.Append(backButton, false)
|
||||
|
||||
return vbox
|
||||
}
|
||||
|
|
|
@ -170,22 +170,27 @@ func ShowAccountQuestionTab() {
|
|||
Data.cloudTab.SetMargined(0, true)
|
||||
}
|
||||
|
||||
func ShowAccountTab() {
|
||||
func ShowAccountTab(i int) {
|
||||
Data.cloudTab.Delete(0)
|
||||
|
||||
log.Println("Sleep(200)")
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
// Create the things for the Account Tab
|
||||
var aTab GuiTabStructure
|
||||
AddAccountBox(&aTab)
|
||||
abox := AddAccountBox()
|
||||
|
||||
// Set the parents and data structure links
|
||||
aTab.me = Data.cloudTab
|
||||
aTab.parentWindow = Data.cloudWindow
|
||||
aTab.tabOffset = 0
|
||||
// aTab.me = Data.cloudTab
|
||||
// aTab.parentWindow = Data.cloudWindow
|
||||
// aTab.tabOffset = 0
|
||||
|
||||
Data.cloudTab.InsertAt("Add Account", 0, aTab.firstBox)
|
||||
if (i >= 0) {
|
||||
Data.cloudTab.InsertAt("Add Account", 0, abox)
|
||||
} else {
|
||||
// this is going to crash, see TODO. This means index is -1
|
||||
// TODO: Do append here and discover tab index #
|
||||
Data.cloudTab.InsertAt("Add Account", 0, abox)
|
||||
}
|
||||
Data.cloudTab.SetMargined(0, true)
|
||||
}
|
||||
|
||||
|
@ -374,7 +379,7 @@ func createAddVmBox(tab *ui.Tab, name string, b *ButtonMap) {
|
|||
hboxButtons.SetPadded(true)
|
||||
vbox.Append(hboxButtons, false)
|
||||
|
||||
hboxButtons.Append(CreateButton(nil, nil, "Add Virtual Machine","ADD", nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, nil, "Add Virtual Machine","CREATE",nil), false)
|
||||
hboxButtons.Append(CreateButton(nil, nil, "Cancel", "CLOSE", nil), false)
|
||||
|
||||
name += " (" + b.Account.Nick + ")"
|
||||
|
|
12
structs.go
12
structs.go
|
@ -15,16 +15,13 @@ import pb "git.wit.com/wit/witProtobuf"
|
|||
var Data GuiDataStructure
|
||||
var myAH areaHandler
|
||||
|
||||
/*
|
||||
type GuiTabStructure struct {
|
||||
me *ui.Tab
|
||||
parentWindow *ui.Window
|
||||
firstBox *ui.Box
|
||||
tabOffset int
|
||||
|
||||
EntryNick *ui.Entry
|
||||
EntryUser *ui.Entry
|
||||
EntryPass *ui.Entry
|
||||
|
||||
// this means only one table per tab
|
||||
mh *TableData
|
||||
|
||||
|
@ -34,6 +31,7 @@ type GuiTabStructure struct {
|
|||
attrstr *ui.AttributedString
|
||||
splashArea *ui.Area
|
||||
}
|
||||
*/
|
||||
|
||||
type GuiDataStructure struct {
|
||||
State string
|
||||
|
@ -71,7 +69,11 @@ type GuiDataStructure struct {
|
|||
CurrentVM *pb.Event_VM
|
||||
|
||||
// All the tabs
|
||||
Tabs []GuiTabStructure
|
||||
// Tabs []GuiTabStructure
|
||||
|
||||
EntryNick *ui.Entry
|
||||
EntryUser *ui.Entry
|
||||
EntryPass *ui.Entry
|
||||
|
||||
// stuff for the splash screen / setup tabs
|
||||
cloudWindow *ui.Window
|
||||
|
|
Loading…
Reference in New Issue