more code cleanups of 'gui'

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-01 02:12:46 -07:00
parent 74f28daf0a
commit d2942f7e2d
2 changed files with 58 additions and 32 deletions

View File

@ -214,6 +214,7 @@ func mainMouseClick(b *gui.GuiButton) {
}
}
if (gui.Data.State == "splash") {
gw.MakeTab = addSubdomainQuestionBox
gui.ShowAccountQuestionTab(gw)
gui.Data.State = "account1"
return

View File

@ -8,38 +8,7 @@ import "git.wit.com/wit/gui"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
/*
func getSplashText() *ui.AttributedString {
var aText *ui.AttributedString
aText = ui.NewAttributedString("Click to continue")
return aText
}
*/
func getNEWTEXT() *ui.AttributedString {
var aText *ui.AttributedString
aText = ui.NewAttributedString("")
gui.AreaAppendText(aText, "Welcome to the Cloud Control Panel\n", ui.TextSize(16), ui.TextColor{0.0, 0.0, 0.8, .8})
gui.AreaAppendText(aText, "(alpha)\n\n", ui.TextSize(10))
gui.AreaAppendText(aText, "This control panel was designed to be an interface to your 'private' cloud. ", ui.TextWeightBold)
gui.AreaAppendText(aText, "The concept of a private cloud means that you can use a providers system, or, seemlessly, use your own hardware in your own datacenter. ", ui.TextWeightBold)
aText.AppendUnattributed("\n")
aText.AppendUnattributed("\n")
gui.AreaAppendText(aText, "This control panel requires:\n")
aText.AppendUnattributed("\n")
gui.AreaAppendText(aText, "IPv6\n")
gui.AreaAppendText(aText, "Your hostname in DNS\n")
aText.AppendUnattributed("\n\n\n\n\n")
gui.AreaAppendText(aText, "<click or press any key>\n", ui.TextSize(10))
return aText
}
func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox{
func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox {
log.Println("ShowSplashBox() START")
text := getNEWTEXT()
box := gui.ShowTextBox(gw, text)
@ -66,3 +35,59 @@ func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox{
log.Println("ShowSplashBox() END box =", box)
return box
}
func getNEWTEXT() *ui.AttributedString {
var aText *ui.AttributedString
aText = ui.NewAttributedString("")
gui.AreaAppendText(aText, "Welcome to the Cloud Control Panel\n", ui.TextSize(16), ui.TextColor{0.0, 0.0, 0.8, .8})
gui.AreaAppendText(aText, "(alpha)\n\n", ui.TextSize(10))
gui.AreaAppendText(aText, "This control panel was designed to be an interface to your 'private' cloud. ", ui.TextWeightBold)
gui.AreaAppendText(aText, "The concept of a private cloud means that you can use a providers system, or, seemlessly, use your own hardware in your own datacenter. ", ui.TextWeightBold)
aText.AppendUnattributed("\n")
aText.AppendUnattributed("\n")
gui.AreaAppendText(aText, "This control panel requires:\n")
aText.AppendUnattributed("\n")
gui.AreaAppendText(aText, "IPv6\n")
gui.AreaAppendText(aText, "Your hostname in DNS\n")
aText.AppendUnattributed("\n\n\n\n\n")
gui.AreaAppendText(aText, "<click or press any key>\n", ui.TextSize(10))
return aText
}
func addSubdomainQuestionBox(gw *gui.GuiWindow) *gui.GuiBox {
log.Println("addSubdomainQuestionBox() START")
box := gui.AddGenericBox(gw)
gui.NewLabel(box, "Enter your Subdomain or")
button := gui.CreateButton(box, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
gui.AddButtonToBox(box, button)
gui.AddEntry(box, "SUBDOMAIN")
gui.HorizontalBreak(box)
button2 := gui.CreateButton(box, nil, nil, "Create Subdomain Account", "ADD", nil)
gui.AddButtonToBox(box, button2)
log.Println("addSubdomainQuestionBox() END box =", box)
return box
}
func generateSubdomain(b *gui.GuiButton) {
log.Println("generateSubdomain START")
if (b == nil) {
log.Println("generateSubdomain ERROR b == nil")
return
}
// subdomain.SetText("cust00013.wit.dev")
txt := gui.SetText(b.Box, "SUBDOMAIN", "cust001.testing.com.customers.wprod.wit.com")
log.Println("generateSubdomain subdomain = ", txt)
log.Println("generateSubdomain END")
}