crashes randomly but sometimes works. Strange.
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
7e787c10ca
commit
b9d10aed57
3
Makefile
3
Makefile
|
@ -1,4 +1,7 @@
|
|||
GOVER = $(shell go version)
|
||||
|
||||
run:
|
||||
@echo your version of go must be greater than 2.10. Your version is ${GOVER}
|
||||
go build
|
||||
./cloud-control-panel
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ func (ah areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
|
|||
log.Println("GOT MOUSE UP")
|
||||
log.Println("GOT MOUSE UP")
|
||||
log.Println("GOT MOUSE UP")
|
||||
splashWin.Destroy()
|
||||
ui.Quit()
|
||||
// splashWin.Destroy()
|
||||
// ui.Quit()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ func (ah areaHandler) KeyEvent(a *ui.Area, ke *ui.AreaKeyEvent) (handled bool) {
|
|||
log.Println("GOT ENTER")
|
||||
}
|
||||
spew.Dump(ke)
|
||||
splashWin.Destroy()
|
||||
ui.Quit()
|
||||
// splashWin.Destroy()
|
||||
// ui.Quit()
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -10,10 +10,11 @@ import "runtime"
|
|||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
var splashWin *ui.Window
|
||||
// var splashWin *ui.Window
|
||||
var MyArea *ui.Area
|
||||
|
||||
func ShowSplash() {
|
||||
splashWin = ui.NewWindow("", 640, 480, true)
|
||||
func ShowSplash() *ui.Window {
|
||||
splashWin := ui.NewWindow("", 640, 480, true)
|
||||
splashWin.SetBorderless(true)
|
||||
splashWin.OnClosing(func(*ui.Window) bool {
|
||||
ui.Quit()
|
||||
|
@ -30,19 +31,21 @@ func ShowSplash() {
|
|||
splashWin.SetMargined(true)
|
||||
|
||||
// This displays the window
|
||||
splashWin.Show()
|
||||
// splashWin.Show()
|
||||
|
||||
ShowSplashBox(vbox, nil)
|
||||
|
||||
return splashWin
|
||||
}
|
||||
|
||||
func ShowSplashBox(junk *ui.Box, atest chan int) *ui.Box {
|
||||
vbox := ui.NewVerticalBox()
|
||||
func ShowSplashBox(vbox *ui.Box, atest chan int) *ui.Box {
|
||||
// vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
|
||||
makeAttributedString()
|
||||
myArea := makeSplashArea()
|
||||
MyArea = makeSplashArea()
|
||||
|
||||
vbox.Append(myArea, true)
|
||||
vbox.Append(MyArea, true)
|
||||
|
||||
if runtime.GOOS == "linux" {
|
||||
vbox.Append(ui.NewLabel("OS: Linux"), false)
|
||||
|
@ -57,11 +60,11 @@ func ShowSplashBox(junk *ui.Box, atest chan int) *ui.Box {
|
|||
okButton := ui.NewButton("OK")
|
||||
|
||||
okButton.OnClicked(func(*ui.Button) {
|
||||
log.Println("OK. Closing window.")
|
||||
test := 4
|
||||
atest <- test
|
||||
splashWin.Destroy()
|
||||
ui.Quit()
|
||||
log.Println("OK. Should close window here")
|
||||
// test := 4
|
||||
// atest <- test
|
||||
// splashWin.Destroy()
|
||||
// ui.Quit()
|
||||
})
|
||||
|
||||
vbox.Append(okButton, false)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package main
|
||||
|
||||
import "log"
|
||||
import "time"
|
||||
|
||||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
|
@ -7,10 +10,59 @@ 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"
|
||||
|
||||
var cloudWindow *ui.Window
|
||||
var cloudBox *ui.Box
|
||||
var state string
|
||||
|
||||
func main() {
|
||||
ui.Main(splash.ShowSplash)
|
||||
go watchGUI()
|
||||
|
||||
ui.Main(makeCloudWindow)
|
||||
|
||||
ui.Main(account1.AddAccountWindow)
|
||||
|
||||
ui.Main(account2.AddAccountWindow)
|
||||
}
|
||||
|
||||
func watchGUI() {
|
||||
log.Println("Sleep()")
|
||||
time.Sleep(2000 * time.Millisecond)
|
||||
|
||||
for {
|
||||
log.Println("Sleep()")
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
if (state == "splash") {
|
||||
log.Println("Sleep()")
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
log.Println("Display the splash box")
|
||||
splash.ShowSplashBox(cloudBox, nil)
|
||||
// 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)
|
||||
|
||||
// splash.ShowSplashBox(cloudBox, nil)
|
||||
|
||||
// This displays the window
|
||||
cloudWindow.Show()
|
||||
state = "splash"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue