diff options
| author | Jeff Carr <[email protected]> | 2019-05-22 20:03:17 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-05-22 20:03:17 -0700 |
| commit | 23f110b5a271ea6b300536cc5189635f42c40b96 (patch) | |
| tree | 3bc523e5019c36a41cda475d8fccf02e8e55bc4f | |
| parent | 72c316dc990ca42faa23704ccf924ed0abd4e2c2 (diff) | |
goes to the 'add account' tab now
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | addAccount.go | 145 | ||||
| -rw-r--r-- | tabWindow.go | 28 |
2 files changed, 117 insertions, 56 deletions
diff --git a/addAccount.go b/addAccount.go index e9799f6..d9c3d24 100644 --- a/addAccount.go +++ b/addAccount.go @@ -5,61 +5,122 @@ import "log" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -// import "github.com/davecgh/go-spew/spew" +func AddAccountQuestionBox(junk *ui.Box, custom func(int, string)) *ui.Box { + newbox := ui.NewVerticalBox() + newbox.SetPadded(true) -func AddAccountWindow() { - accounthWin := ui.NewWindow("Add Account", 400, 300, false) - accounthWin.OnClosing(func(*ui.Window) bool { - ui.Quit() - return true - }) - ui.OnShouldQuit(func() bool { - accounthWin.Destroy() - return true - }) + newButton := CreateButton("Create New Account", "CLOSE", custom) + newbox.Append(newButton, false) + + newbox.Append(ui.NewHorizontalSeparator(), false) + + okButton := CreateButton("I Have an Account", "CLOSE", custom) + newbox.Append(okButton, false) + return newbox +} + +func AddAccountBox(custom func(int, string)) *ui.Box { vbox := ui.NewVerticalBox() vbox.SetPadded(true) - accounthWin.SetChild(vbox) - accounthWin.SetMargined(true) - // This displays the window - accounthWin.Show() + hboxAccount := ui.NewHorizontalBox() + hboxAccount.SetPadded(true) + vbox.Append(hboxAccount, false) - // 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() + // 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()) }) - vbox.Append(newAccountButton, false) - // END create new account button + hboxAccount.Append(vboxC, false) + // End 'Cloud Provider' vertical box - vbox.Append(ui.NewHorizontalSeparator(), false) + // Start 'Region' vertical box + vboxR := ui.NewVerticalBox() + vboxR.SetPadded(true) + vboxR.Append(ui.NewLabel("Region:"), false) - okButton := ui.NewButton("I Have an Account") - okButton.OnClicked(func(*ui.Button) { - log.Println("OK. Closing window.") - accounthWin.Destroy() - ui.Quit() + 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()) }) - vbox.Append(okButton, false) - // END add account hbox -} + hboxAccount.Append(vboxR, false) + // End 'Region' vertical box -func AddAccountBox(junk *ui.Box, custom func(int, string)) *ui.Box { - newbox := ui.NewVerticalBox() - newbox.SetPadded(true) + // Start 'Nickname' vertical box + vboxN := ui.NewVerticalBox() + vboxN.SetPadded(true) + vboxN.Append(ui.NewLabel("Account Nickname:"), false) - // create new account button - newButton := CreateButton("Create New Account", "CLOSE", custom) - newbox.Append(newButton, false) + entryNick := ui.NewEntry() + entryNick.SetReadOnly(false) - newbox.Append(ui.NewHorizontalSeparator(), false) + vboxN.Append(entryNick, false) - okButton := CreateButton("I Have an Account", "CLOSE", custom) - newbox.Append(okButton, false) + entryNick.OnChanged(func(*ui.Entry) { + log.Println("OK. nickname =", entryNick.Text()) + }) + hboxAccount.Append(vboxN, false) + // End 'Nickname' vertical box - return newbox + // 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) + + hboxButtons := ui.NewHorizontalBox() + hboxButtons.SetPadded(true) + vbox.Append(hboxButtons, false) + + okButton := CreateButton("Add Account", "ADD", custom) + hboxButtons.Append(okButton, false) + + backButton := CreateButton("Back", "BACK", custom) + hboxButtons.Append(backButton, false) + + return vbox } diff --git a/tabWindow.go b/tabWindow.go index 876944b..5543e8e 100644 --- a/tabWindow.go +++ b/tabWindow.go @@ -14,17 +14,6 @@ var cloudBox *ui.Box var smallBox *ui.Box var state string -func splashClose(a int, b string) { - log.Println("GOT splashClose(a,b) =", a, b) - - log.Println("cloudBox Delete(0) START") - cloudBox.Delete(0) - log.Println("smallBox.Hide() START") - smallBox.Hide() - - state = "kill" -} - func buttonClick(i int, s string) { log.Println("gui.buttonClick() i, s =", i, s) log.Println("Figure out what to do here") @@ -37,14 +26,25 @@ func buttonClick(i int, s string) { } } +func ShowAccountQuestionTab() { + cloudTab.Delete(0) + + log.Println("Sleep(1000)") + time.Sleep(1000 * time.Millisecond) + + smallBox = AddAccountQuestionBox(nil, buttonClick) + cloudTab.InsertAt("New Account?", 0, smallBox) + cloudTab.SetMargined(0, true) +} + func ShowAccountTab() { cloudTab.Delete(0) log.Println("Sleep(1000)") time.Sleep(1000 * time.Millisecond) - smallBox = AddAccountBox(nil, splashClose) - cloudTab.InsertAt("Intro", 0, smallBox) + smallBox = AddAccountBox(buttonClick) + cloudTab.InsertAt("Add Account", 0, smallBox) cloudTab.SetMargined(0, true) } @@ -74,5 +74,5 @@ func makeCloudWindow() { cloudTab.SetMargined(0, true) Data.cloudWindow.Show() - Data.State = "splash done" + Data.State = "splash" } |
