109 lines
2.3 KiB
Go
109 lines
2.3 KiB
Go
package main
|
|
|
|
import "log"
|
|
import "time"
|
|
|
|
import "github.com/andlabs/ui"
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
import "git.wit.com/wit/cloud-control-panel/splash"
|
|
import "git.wit.com/wit/cloud-control-panel/account1"
|
|
// import "git.wit.com/wit/cloud-control-panel/account2"
|
|
|
|
// import "github.com/davecgh/go-spew/spew"
|
|
|
|
var cloudWindow *ui.Window
|
|
var cloudTab *ui.Tab
|
|
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 main() {
|
|
go watchGUI()
|
|
|
|
ui.Main(makeCloudWindow)
|
|
|
|
// ui.Main(account1.AddAccountWindow)
|
|
// ui.Main(account2.AddAccountWindow)
|
|
}
|
|
|
|
func buttonClick(i int, s string) {
|
|
log.Println("buttonClick() i, s =", i, s)
|
|
}
|
|
|
|
func watchGUI() {
|
|
log.Println("Sleep(2000)")
|
|
time.Sleep(2000 * time.Millisecond)
|
|
|
|
for {
|
|
log.Println("Sleep()")
|
|
time.Sleep(200 * time.Millisecond)
|
|
|
|
if (state == "splash") {
|
|
log.Println("Display the splash box")
|
|
smallBox = account1.AddAccountBox(nil, splashClose)
|
|
cloudTab.Append("Intro", smallBox)
|
|
cloudTab.SetMargined(0, true)
|
|
// newbox.SetPadded(true)
|
|
state = "done"
|
|
}
|
|
if (state == "kill") {
|
|
log.Println("state = kill")
|
|
log.Println("state = kill")
|
|
log.Println("state = kill")
|
|
smallBox.Destroy()
|
|
state = "account1"
|
|
smallBox = nil
|
|
}
|
|
if (state == "account1") {
|
|
log.Println("Display the splash box")
|
|
smallBox = splash.ShowSplashBox(nil, nil, splashClose)
|
|
cloudTab.Append("WIT Account", smallBox)
|
|
cloudTab.SetMargined(0, true)
|
|
// newbox.SetPadded(true)
|
|
state = "done"
|
|
}
|
|
}
|
|
}
|
|
|
|
func makeCloudWindow() {
|
|
cloudWindow := ui.NewWindow("", 640, 480, true)
|
|
cloudWindow.SetBorderless(true)
|
|
cloudWindow.OnClosing(func(*ui.Window) bool {
|
|
ui.Quit()
|
|
return true
|
|
})
|
|
ui.OnShouldQuit(func() bool {
|
|
cloudWindow.Destroy()
|
|
return true
|
|
})
|
|
|
|
// cloudBox = ui.NewVerticalBox()
|
|
// cloudBox.SetPadded(true)
|
|
// cloudWindow.SetChild(cloudBox)
|
|
// cloudWindow.SetMargined(true)
|
|
|
|
cloudTab = ui.NewTab()
|
|
cloudWindow.SetChild(cloudTab)
|
|
cloudWindow.SetMargined(true)
|
|
|
|
cloudBox = splash.ShowSplashBox(nil, nil, buttonClick)
|
|
|
|
cloudTab.Append("WIT Splash", cloudBox)
|
|
cloudTab.SetMargined(0, true)
|
|
|
|
cloudWindow.Show()
|
|
state = "splash"
|
|
}
|