2019-05-17 16:25:40 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
|
|
|
// import "github.com/davecgh/go-spew/spew"
|
|
|
|
|
|
|
|
func addAccountWindow() {
|
2019-05-19 21:21:35 -05:00
|
|
|
accounthWin := ui.NewWindow("Add Account", 400, 300, false)
|
2019-05-17 16:25:40 -05:00
|
|
|
accounthWin.OnClosing(func(*ui.Window) bool {
|
|
|
|
ui.Quit()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
ui.OnShouldQuit(func() bool {
|
|
|
|
accounthWin.Destroy()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
|
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
|
|
|
accounthWin.SetChild(vbox)
|
|
|
|
accounthWin.SetMargined(true)
|
|
|
|
|
|
|
|
// This displays the window
|
|
|
|
accounthWin.Show()
|
|
|
|
|
2019-05-19 22:18:42 -05:00
|
|
|
// START create new account button
|
|
|
|
newAccountButton := ui.NewButton("Create New Account")
|
|
|
|
newAccountButton.OnClicked(func(*ui.Button) {
|
|
|
|
log.Println("OK. Closing window.")
|
|
|
|
accounthWin.Destroy()
|
|
|
|
ui.Quit()
|
|
|
|
})
|
|
|
|
vbox.Append(newAccountButton, false)
|
|
|
|
// END create new account button
|
|
|
|
|
|
|
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
|
|
|
vbox.Append(ui.NewLabel("or"), false)
|
|
|
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
|
|
|
|
|
|
|
// START add account hbox
|
2019-05-19 21:21:35 -05:00
|
|
|
hboxAccount := ui.NewHorizontalBox()
|
|
|
|
hboxAccount.SetPadded(true)
|
|
|
|
vbox.Append(hboxAccount, false)
|
2019-05-17 16:25:40 -05:00
|
|
|
|
2019-05-19 21:21:35 -05:00
|
|
|
// Start 'Provider' vertical box
|
|
|
|
vboxC := ui.NewVerticalBox()
|
|
|
|
vboxC.SetPadded(true)
|
|
|
|
vboxC.Append(ui.NewLabel("Cloud Provider:"), false)
|
|
|
|
|
|
|
|
cbox := ui.NewCombobox()
|
|
|
|
cbox.Append("WIT")
|
|
|
|
cbox.Append("Evocative")
|
|
|
|
vboxC.Append(cbox, false)
|
|
|
|
cbox.SetSelected(0)
|
|
|
|
|
|
|
|
cbox.OnSelected(func(*ui.Combobox) {
|
|
|
|
log.Println("OK. Selected Cloud Provider =", cbox.Selected())
|
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxC, false)
|
|
|
|
// End 'Cloud Provider' vertical box
|
|
|
|
|
|
|
|
// Start 'Region' vertical box
|
|
|
|
vboxR := ui.NewVerticalBox()
|
|
|
|
vboxR.SetPadded(true)
|
|
|
|
vboxR.Append(ui.NewLabel("Region:"), false)
|
|
|
|
|
|
|
|
regbox := ui.NewCombobox()
|
|
|
|
regbox.Append("Any")
|
|
|
|
regbox.Append("SF")
|
|
|
|
vboxR.Append(regbox, false)
|
|
|
|
regbox.SetSelected(0)
|
|
|
|
|
|
|
|
regbox.OnSelected(func(*ui.Combobox) {
|
|
|
|
log.Println("OK. Selected something =", regbox.Selected())
|
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxR, false)
|
|
|
|
// End 'Region' vertical box
|
|
|
|
|
|
|
|
// Start 'Nickname' vertical box
|
|
|
|
vboxN := ui.NewVerticalBox()
|
|
|
|
vboxN.SetPadded(true)
|
|
|
|
vboxN.Append(ui.NewLabel("Account Nickname:"), false)
|
|
|
|
|
|
|
|
entryNick := ui.NewEntry()
|
|
|
|
entryNick.SetReadOnly(false)
|
|
|
|
|
|
|
|
vboxN.Append(entryNick, false)
|
|
|
|
|
|
|
|
entryNick.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. nickname =", entryNick.Text())
|
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxN, false)
|
|
|
|
// End 'Nickname' vertical box
|
|
|
|
|
|
|
|
// Start 'Username' vertical box
|
|
|
|
vboxU := ui.NewVerticalBox()
|
|
|
|
vboxU.SetPadded(true)
|
|
|
|
vboxU.Append(ui.NewLabel("Account Username:"), false)
|
|
|
|
|
|
|
|
entryUser := ui.NewEntry()
|
|
|
|
entryUser.SetReadOnly(false)
|
|
|
|
|
|
|
|
vboxU.Append(entryUser, false)
|
|
|
|
|
|
|
|
entryUser.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. username =", entryUser.Text())
|
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxU, false)
|
|
|
|
// End 'Username' vertical box
|
|
|
|
|
|
|
|
// Start 'Password' vertical box
|
|
|
|
vboxP := ui.NewVerticalBox()
|
|
|
|
vboxP.SetPadded(true)
|
|
|
|
vboxP.Append(ui.NewLabel("Account Password:"), false)
|
|
|
|
|
|
|
|
entryPass := ui.NewEntry()
|
|
|
|
entryPass.SetReadOnly(false)
|
|
|
|
|
|
|
|
vboxP.Append(entryPass, false)
|
|
|
|
|
|
|
|
entryPass.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. password =", entryPass.Text())
|
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxP, false)
|
|
|
|
// End 'Password' vertical box
|
|
|
|
|
|
|
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
2019-05-17 16:25:40 -05:00
|
|
|
|
|
|
|
okButton := ui.NewButton("Add Account")
|
2019-05-19 21:21:35 -05:00
|
|
|
okButton.OnClicked(func(*ui.Button) {
|
2019-05-17 16:25:40 -05:00
|
|
|
log.Println("OK. Closing window.")
|
|
|
|
accounthWin.Destroy()
|
|
|
|
ui.Quit()
|
|
|
|
})
|
|
|
|
vbox.Append(okButton, false)
|
2019-05-19 22:18:42 -05:00
|
|
|
// END add account hbox
|
2019-05-17 16:25:40 -05:00
|
|
|
}
|