simple draw area example
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
59e1838663
commit
81df3e09fc
|
@ -8,7 +8,7 @@ import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
import "git.wit.com/wit/cloud-control-panel/splash"
|
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/account1"
|
||||||
import "git.wit.com/wit/cloud-control-panel/account2"
|
// import "git.wit.com/wit/cloud-control-panel/account2"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
@ -33,9 +33,8 @@ func main() {
|
||||||
|
|
||||||
ui.Main(makeCloudWindow)
|
ui.Main(makeCloudWindow)
|
||||||
|
|
||||||
ui.Main(account1.AddAccountWindow)
|
// ui.Main(account1.AddAccountWindow)
|
||||||
|
// ui.Main(account2.AddAccountWindow)
|
||||||
ui.Main(account2.AddAccountWindow)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func buttonClick(i int) {
|
func buttonClick(i int) {
|
||||||
|
@ -43,16 +42,13 @@ func buttonClick(i int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func watchGUI() {
|
func watchGUI() {
|
||||||
// log.Println("Sleep()")
|
|
||||||
// time.Sleep(2000 * time.Millisecond)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
log.Println("Sleep()")
|
log.Println("Sleep()")
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
|
||||||
if (state == "splash") {
|
if (state == "splash") {
|
||||||
log.Println("Display the splash box")
|
log.Println("Display the splash box")
|
||||||
smallBox = splash.ShowSplashBox(cloudBox, nil, splashClose)
|
smallBox = account1.AddAccountBox(cloudBox, splashClose)
|
||||||
// newbox.SetPadded(true)
|
// newbox.SetPadded(true)
|
||||||
state = "done"
|
state = "done"
|
||||||
}
|
}
|
||||||
|
@ -66,7 +62,7 @@ func watchGUI() {
|
||||||
}
|
}
|
||||||
if (state == "account1") {
|
if (state == "account1") {
|
||||||
log.Println("Display the splash box")
|
log.Println("Display the splash box")
|
||||||
smallBox = account1.AddAccountBox(cloudBox, splashClose)
|
smallBox = splash.ShowSplashBox(cloudBox, nil, splashClose)
|
||||||
// newbox.SetPadded(true)
|
// newbox.SetPadded(true)
|
||||||
state = "done"
|
state = "done"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,33 +1,14 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
import "log"
|
|
||||||
import "time"
|
|
||||||
import "os/signal"
|
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
import "git.wit.com/wit/cloud-control-panel/splash"
|
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 atest chan int
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
/*
|
ui.Main(setupUI)
|
||||||
ui.Main(splash.ShowSplash)
|
|
||||||
ui.Main(account1.AddAccountWindow)
|
|
||||||
ui.Main(account2.AddAccountWindow)
|
|
||||||
ui.Main(addAccountWindow)
|
|
||||||
ui.Main(showSplash)
|
|
||||||
*/
|
|
||||||
go ui.Main(setupUI)
|
|
||||||
|
|
||||||
beautifulAndFacinatingChannel()
|
|
||||||
// ui.Main(testFor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupUI() {
|
func setupUI() {
|
||||||
|
@ -39,8 +20,6 @@ func setupUI() {
|
||||||
})
|
})
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
mainwin.Destroy()
|
mainwin.Destroy()
|
||||||
test := 4
|
|
||||||
atest <- test
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -50,67 +29,11 @@ func setupUI() {
|
||||||
|
|
||||||
mainwin.Show()
|
mainwin.Show()
|
||||||
|
|
||||||
vbox := splash.ShowSplashBox(nil, atest)
|
vbox := ui.NewVerticalBox()
|
||||||
|
vbox.SetPadded(true)
|
||||||
|
|
||||||
|
splash.ShowSplashBox(vbox, nil, nil)
|
||||||
|
|
||||||
tab.Append("WIT Splash", vbox)
|
tab.Append("WIT Splash", vbox)
|
||||||
tab.SetMargined(0, true)
|
tab.SetMargined(0, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func somefunc(testing os.Signal) {
|
|
||||||
// return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
type Newish struct {
|
|
||||||
A <-chan int
|
|
||||||
r string
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// this is a facinating code snippet that I wanted to leave here because it is
|
|
||||||
// so interesting. Complements to the gorilla websocket example developers
|
|
||||||
//
|
|
||||||
func beautifulAndFacinatingChannel() {
|
|
||||||
done := make(chan struct{})
|
|
||||||
|
|
||||||
interrupt := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(interrupt, os.Interrupt)
|
|
||||||
|
|
||||||
ticker := time.NewTicker(time.Second * 1)
|
|
||||||
|
|
||||||
// atest := make(chan int, 1)
|
|
||||||
atest = make(chan int)
|
|
||||||
newthing := &Newish{
|
|
||||||
A: atest,
|
|
||||||
r: "something",
|
|
||||||
}
|
|
||||||
|
|
||||||
defer ticker.Stop()
|
|
||||||
defer close(done)
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-done:
|
|
||||||
log.Println("case <-done is EMPTY?")
|
|
||||||
return
|
|
||||||
case t := <-ticker.C:
|
|
||||||
log.Println("test NewTicker()", t.String())
|
|
||||||
spew.Dump(ticker)
|
|
||||||
case j := <-atest:
|
|
||||||
log.Println("GOT HERE!!!! test func() j=", j)
|
|
||||||
close(done)
|
|
||||||
case <-interrupt:
|
|
||||||
log.Println("interrupt")
|
|
||||||
newthing.r = "four"
|
|
||||||
spew.Dump(newthing)
|
|
||||||
|
|
||||||
// could do final things here when kill or ctrl-c
|
|
||||||
select {
|
|
||||||
case <-done:
|
|
||||||
log.Println("case <-done is EMPTY?")
|
|
||||||
case <-time.After(time.Second):
|
|
||||||
log.Println("case <-second timer fired again")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue