108 lines
2.2 KiB
Go
108 lines
2.2 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 cloudBox *ui.Box
|
|
var smallBox *ui.Box
|
|
var state string
|
|
|
|
func splashClose(a int, b string) {
|
|
log.Println("GOT splashClose(a,b) =", a, b)
|
|
// smallBox.Parent = nil
|
|
log.Println("cloudBox:")
|
|
log.Println("cloudBox:")
|
|
log.Println("cloudBox:")
|
|
spew.Dump(cloudBox)
|
|
cloudBox.Delete(0)
|
|
// cloudBox.Delete(1)
|
|
smallBox.Hide()
|
|
// smallBox.Parent = nil
|
|
log.Println("cloudBox:")
|
|
log.Println("cloudBox:")
|
|
log.Println("cloudBox:")
|
|
spew.Dump(cloudBox)
|
|
log.Println("smallBox:")
|
|
log.Println("smallBox:")
|
|
log.Println("smallBox:")
|
|
spew.Dump(smallBox)
|
|
// cloudBox.Destroy()
|
|
state = "kill"
|
|
}
|
|
|
|
func main() {
|
|
go watchGUI()
|
|
|
|
ui.Main(makeCloudWindow)
|
|
|
|
ui.Main(account1.AddAccountWindow)
|
|
|
|
ui.Main(account2.AddAccountWindow)
|
|
}
|
|
|
|
func buttonClick(i int) {
|
|
log.Println("buttonClick() i =", i)
|
|
}
|
|
|
|
func watchGUI() {
|
|
// log.Println("Sleep()")
|
|
// time.Sleep(2000 * time.Millisecond)
|
|
|
|
for {
|
|
log.Println("Sleep()")
|
|
time.Sleep(200 * time.Millisecond)
|
|
|
|
if (state == "splash") {
|
|
log.Println("Display the splash box")
|
|
smallBox = splash.ShowSplashBox(cloudBox, nil, splashClose)
|
|
// newbox.SetPadded(true)
|
|
state = "done"
|
|
}
|
|
if (state == "kill") {
|
|
log.Println("state = kill")
|
|
log.Println("state = kill")
|
|
log.Println("state = kill")
|
|
smallBox.Destroy()
|
|
state = "account1"
|
|
}
|
|
}
|
|
}
|
|
|
|
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)
|
|
|
|
// splash.ShowSplashBox(cloudBox, nil)
|
|
|
|
// This displays the window
|
|
cloudWindow.Show()
|
|
log.Println("cloudBox:")
|
|
log.Println("cloudBox:")
|
|
log.Println("cloudBox:")
|
|
spew.Dump(cloudBox)
|
|
state = "splash"
|
|
}
|