more work on an add account screen
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
17ec92568d
commit
36d67d0d2e
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import "log"
|
||||
import "runtime"
|
||||
|
||||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
@ -9,7 +8,7 @@ import _ "github.com/andlabs/ui/winmanifest"
|
|||
// import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
func addAccountWindow() {
|
||||
accounthWin := ui.NewWindow("Create New Account", 400, 300, false)
|
||||
accounthWin := ui.NewWindow("Add Account", 400, 300, false)
|
||||
accounthWin.OnClosing(func(*ui.Window) bool {
|
||||
ui.Quit()
|
||||
return true
|
||||
|
@ -27,18 +26,96 @@ func addAccountWindow() {
|
|||
// This displays the window
|
||||
accounthWin.Show()
|
||||
|
||||
if runtime.GOOS == "linux" {
|
||||
vbox.Append(ui.NewLabel("OS: Linux"), false)
|
||||
} else if runtime.GOOS == "windows" {
|
||||
vbox.Append(ui.NewLabel("OS: Windows"), false)
|
||||
} else {
|
||||
vbox.Append(ui.NewLabel("OS: " + runtime.GOOS), false)
|
||||
}
|
||||
hboxAccount := ui.NewHorizontalBox()
|
||||
hboxAccount.SetPadded(true)
|
||||
vbox.Append(hboxAccount, false)
|
||||
|
||||
vbox.Append(ui.NewLabel("Version: v0.3"), false)
|
||||
// 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)
|
||||
|
||||
okButton := ui.NewButton("Add Account")
|
||||
okButton.OnClicked(func(*ui.Button) {
|
||||
okButton.OnClicked(func(*ui.Button) {
|
||||
log.Println("OK. Closing window.")
|
||||
accounthWin.Destroy()
|
||||
ui.Quit()
|
||||
|
|
|
@ -55,6 +55,9 @@ func makeAttributedString() {
|
|||
attrstr.AppendUnattributed("\n")
|
||||
appendWithAttributes("IPv6\n")
|
||||
appendWithAttributes("Your hostname in DNS\n")
|
||||
attrstr.AppendUnattributed("\n\n\n\n\n")
|
||||
|
||||
appendWithAttributes("<click or press any key>\n", ui.TextSize(10))
|
||||
}
|
||||
|
||||
type areaHandler struct{}
|
||||
|
|
|
@ -43,7 +43,7 @@ func makeSplashPage() ui.Control {
|
|||
}
|
||||
|
||||
func setupUI() {
|
||||
mainwin := ui.NewWindow("gui-example1", 300, 200, false)
|
||||
mainwin := ui.NewWindow("gui-example1", 300, 200, true)
|
||||
mainwin.OnClosing(func(*ui.Window) bool {
|
||||
ui.Quit()
|
||||
os.Exit(0)
|
||||
|
@ -65,10 +65,10 @@ func setupUI() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
ui.Main(showSplash)
|
||||
|
||||
ui.Main(addAccountWindow)
|
||||
|
||||
ui.Main(showSplash)
|
||||
|
||||
go ui.Main(setupUI)
|
||||
|
||||
// locks up GTK after a while (50 times)
|
||||
|
|
|
@ -13,7 +13,8 @@ import _ "github.com/andlabs/ui/winmanifest"
|
|||
var splashWin *ui.Window
|
||||
|
||||
func showSplash() {
|
||||
splashWin = ui.NewWindow("", 640, 480, false)
|
||||
splashWin = ui.NewWindow("", 640, 480, true)
|
||||
splashWin.SetBorderless(true)
|
||||
splashWin.OnClosing(func(*ui.Window) bool {
|
||||
ui.Quit()
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue