start moving the area text to here

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-29 15:46:37 -07:00
parent 1f59cabaa8
commit 37046dd791
2 changed files with 50 additions and 6 deletions

20
main.go
View File

@ -144,6 +144,10 @@ func main() {
// make this the main loop in an attempt to figure out the crashes
// do not change this until the GUI is stable
gui.Data.Window1 = new(gui.WindowMap)
gui.Data.Window1.AreaText = getSplashText()
// this crashes here. crazy!
// gui.Data.Window1.AreaText = getNEWTEXT()
gui.GoMainWindow()
}
@ -172,7 +176,11 @@ func mainMouseClick(b *gui.ButtonMap) {
if (b.Account != nil) {
log.Println("\tmainMouseClick() setting current account = ", b.Account.Nick)
}
if (b.Action == "AREA") {
if (b.Action == "NEWTEXT") {
gui.Data.Window1.AH.Attrstr = getNEWTEXT()
log.Println("AH.Attrstr = ", gui.Data.Window1.AH.Attrstr)
gui.Data.Window1.AH.Area.QueueRedrawAll()
} else if (b.Action == "AREA") {
if (config == nil) {
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
log.Println("gui.State = splash BUT SOMETHING HAS GONE VERY WRONG")
@ -417,11 +425,6 @@ func watchGUI() {
for {
if (count > 10) {
log.Println("Sleep() in watchGUI() gui.Data.State =", gui.Data.State)
if (gui.Data.State == "HIDE") {
gui.Data.Window1.Box1.Show()
gui.Data.Window1.Box2.Show()
gui.Data.State = "done"
}
count = 0
}
count += 1
@ -432,6 +435,11 @@ func watchGUI() {
log.Println("gui.State = kill")
log.Println("gui.State = kill")
onExit(nil)
} else if (gui.Data.State == "HIDE") {
time.Sleep(20 * time.Millisecond) // maybe required for macos & windows refresh to work?
gui.Data.Window1.Box1.Show()
gui.Data.Window1.Box2.Show()
gui.Data.State = "done"
}
}
}

36
splash.go Normal file
View File

@ -0,0 +1,36 @@
package main
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
}