parent
0bdabc5747
commit
a72024107b
8
Makefile
8
Makefile
|
@ -2,6 +2,14 @@ all: build
|
|||
reset
|
||||
./gadgetwindow
|
||||
|
||||
nocui: build
|
||||
reset
|
||||
./gadgetwindow --gui nocui
|
||||
|
||||
debugger: build
|
||||
reset
|
||||
./gadgetwindow --debugger
|
||||
|
||||
build:
|
||||
ifeq ($(GO111MODULE),)
|
||||
echo no. you must use GO111MODULE here
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
/*
|
||||
this parses the command line arguements
|
||||
|
||||
this enables command line options from other packages like 'gui' and 'log'
|
||||
*/
|
||||
|
||||
import (
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// GadgetDisplay string `arg:"env:DISPLAY"`
|
||||
// GadgetTmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"`
|
||||
// GadgetVerboseDNS bool `arg:"--verbose" help:"debug your dns settings"`
|
||||
var args struct {
|
||||
}
|
||||
|
||||
var NOW *log.LogFlag
|
||||
|
||||
func init() {
|
||||
arg.MustParse(&args)
|
||||
full := "go.wit.com/control-panels/dns"
|
||||
short := "cpdns"
|
||||
|
||||
NOW = log.NewFlag("NOW", true, full, short, "temp debugging stuff")
|
||||
|
||||
if debugger.ArgDebug() {
|
||||
log.Log(NOW, "INIT() gui debug == true")
|
||||
} else {
|
||||
log.Log(NOW, "INIT() gui debug == false")
|
||||
}
|
||||
}
|
11
choices.go
11
choices.go
|
@ -29,7 +29,7 @@ func newChoices(parent *gui.Node) *choices {
|
|||
c.grid.NewButton("hello", func() {
|
||||
log.Info("world")
|
||||
})
|
||||
c.grid.NewButton("show basic window", func() {
|
||||
c.grid.NewButton("toggle basic window", func() {
|
||||
basicWindow.Toggle()
|
||||
})
|
||||
c.grid.NewLabel("a label")
|
||||
|
@ -64,7 +64,7 @@ func newChoices(parent *gui.Node) *choices {
|
|||
c.animal.AddText("polar bear")
|
||||
|
||||
c.place = gadgets.NewBasicEntry(c.grid, "common favorite place")
|
||||
c.place.Custom = func () {
|
||||
c.place.Custom = func() {
|
||||
log.Info("now set to:", c.place.String())
|
||||
if c.place == section1.place {
|
||||
section2.place.SetText(c.place.String())
|
||||
|
@ -75,6 +75,13 @@ func newChoices(parent *gui.Node) *choices {
|
|||
}
|
||||
c.place.SetText("coffee shop")
|
||||
|
||||
c.grid.NewButton("enable animals", func() {
|
||||
c.animal.Enable()
|
||||
})
|
||||
c.grid.NewButton("disable animals", func() {
|
||||
c.animal.Disable()
|
||||
})
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
|
12
main.go
12
main.go
|
@ -23,8 +23,10 @@ var section1 *choices
|
|||
var section2 *choices
|
||||
|
||||
func main() {
|
||||
log.SetAll(true)
|
||||
log.ShowFlags()
|
||||
myGui = gui.New()
|
||||
myGui.LoadToolkit("andlabs")
|
||||
// myGui.LoadToolkit("andlabs")
|
||||
// myGui.LoadToolkit("nocui")
|
||||
|
||||
myGui.Default()
|
||||
|
@ -32,6 +34,14 @@ func main() {
|
|||
helloworld()
|
||||
basicWindow = makebasicWindow()
|
||||
|
||||
// run the debugger if triggered from the commandline
|
||||
if debugger.ArgDebug() {
|
||||
go func() {
|
||||
log.Sleep(2)
|
||||
debugger.DebugWindow()
|
||||
}()
|
||||
}
|
||||
|
||||
// go will sit here until the window exits
|
||||
gui.Watchdog()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue