generate subdomain

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-30 01:58:05 -07:00
parent cb8b97650e
commit 49e3887aa6
4 changed files with 27 additions and 9 deletions

View File

@ -10,24 +10,27 @@ var subdomain *ui.Entry
func AddAccountQuestionBox(wm *WindowMap) *ui.Box { func AddAccountQuestionBox(wm *WindowMap) *ui.Box {
vbox := ui.NewVerticalBox() vbox := ui.NewVerticalBox()
vbox.SetPadded(true) vbox.SetPadded(true)
wm.Box1 = vbox
vboxN := ui.NewVerticalBox() hbox := ui.NewHorizontalBox()
vboxN.SetPadded(true) hbox.SetPadded(true)
vboxN.Append(ui.NewLabel("Enter your Subdomain:"), false) vbox.Append(hbox, false)
hbox.Append(ui.NewLabel("Enter your Subdomain or"), false)
generate := CreateButton(wm, nil, nil, "Make me a Subdomain", "SUBDOMAIN", generateSubdomain)
hbox.Append(generate, false)
subdomain = ui.NewEntry() subdomain = ui.NewEntry()
subdomain.SetReadOnly(false) subdomain.SetReadOnly(false)
vboxN.Append(subdomain, false)
subdomain.OnChanged(func(*ui.Entry) { subdomain.OnChanged(func(*ui.Entry) {
log.Println("OK. subdomain =", subdomain.Text()) log.Println("OK. subdomain =", subdomain.Text())
}) })
vbox.Append(vboxN, false) vbox.Append(subdomain, false)
vbox.Append(ui.NewHorizontalSeparator(), false) vbox.Append(ui.NewHorizontalSeparator(), false)
okButton := CreateButton(wm, nil, nil, "Make me a Subdomain", "SUBDOMAIN", generateSubdomain) okButton := CreateButton(wm, nil, nil, "Create Subdomain Account", "SUBDOMAIN", addSubdomain)
vbox.Append(okButton, false) vbox.Append(okButton, false)
return vbox return vbox
@ -39,6 +42,13 @@ func generateSubdomain(b *ButtonMap) {
log.Println("generateSubdomain END") log.Println("generateSubdomain END")
} }
func addSubdomain(b *ButtonMap) {
log.Println("generateSubdomain START")
sub := subdomain.Text()
log.Println("generateSubdomain subdomain =", sub)
log.Println("generateSubdomain END")
}
func AddAccountBox(wm *WindowMap) *ui.Box { func AddAccountBox(wm *WindowMap) *ui.Box {
vbox := ui.NewVerticalBox() vbox := ui.NewVerticalBox()
vbox.SetPadded(true) vbox.SetPadded(true)

View File

@ -28,6 +28,7 @@ func makeSplashArea(wm *WindowMap, ah *AreaHandler) {
// ah.Attrstr = makeAttributedString() // ah.Attrstr = makeAttributedString()
ah.Area = ui.NewArea(ah) ah.Area = ui.NewArea(ah)
newB.A = ah.Area newB.A = ah.Area
newB.WM = wm
// Data.AllButtons[1].A = ah.Area // Data.AllButtons[1].A = ah.Area
// ah.Button = &Data.AllButtons[1] // ah.Button = &Data.AllButtons[1]
ah.Button = newB ah.Button = newB

3
gui.go
View File

@ -175,6 +175,7 @@ func defaultButtonClick(button *ui.Button) {
for key, foo := range Data.AllButtons { for key, foo := range Data.AllButtons {
if (Data.Debug) { if (Data.Debug) {
log.Println("defaultButtonClick() Data.AllButtons =", key, foo) log.Println("defaultButtonClick() Data.AllButtons =", key, foo)
spew.Dump(foo)
} }
if Data.AllButtons[key].B == button { if Data.AllButtons[key].B == button {
log.Println("\tdefaultButtonClick() BUTTON MATCHED") log.Println("\tdefaultButtonClick() BUTTON MATCHED")
@ -184,7 +185,7 @@ func defaultButtonClick(button *ui.Button) {
log.Println("\tdefaultButtonClick() DOING CUSTOM FUNCTION") log.Println("\tdefaultButtonClick() DOING CUSTOM FUNCTION")
var tmp ButtonMap var tmp ButtonMap
tmp = Data.AllButtons[key] tmp = Data.AllButtons[key]
spew.Dump(tmp) // spew.Dump(tmp)
Data.AllButtons[key].custom(&tmp) Data.AllButtons[key].custom(&tmp)
return return
} }

View File

@ -3,6 +3,7 @@ package gui
import "log" import "log"
import "time" import "time"
import "regexp" import "regexp"
import "os"
// import "reflect" // import "reflect"
import "github.com/andlabs/ui" import "github.com/andlabs/ui"
@ -161,6 +162,11 @@ func AddVmsTab(wm *WindowMap, name string, count int, a *pb.Account) *TableData
} }
func ShowAccountQuestionTab(wm *WindowMap) { func ShowAccountQuestionTab(wm *WindowMap) {
log.Println("ShowAccountQuestionTab() wm =", wm)
if (wm.T == nil) {
log.Println("ShowAccountQuestionTab() wm.T = nil THIS IS BAD")
os.Exit(-1)
}
wm.T.Delete(0) wm.T.Delete(0)
log.Println("Sleep(200)") log.Println("Sleep(200)")