Compare commits
No commits in common. "guimain" and "v0.20.2" have entirely different histories.
40
Makefile
40
Makefile
|
@ -1,41 +1,15 @@
|
||||||
VERSION = $(shell git describe --tags)
|
all:
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
go build -v -x
|
||||||
|
|
||||||
all: build
|
|
||||||
./helloworld
|
./helloworld
|
||||||
|
|
||||||
build:
|
push:
|
||||||
GO111MODULE=off go build \
|
git add --all
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
git commit -a
|
||||||
|
git push
|
||||||
verbose:
|
|
||||||
GO111MODULE=off go build -v -x -work \
|
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
|
||||||
|
|
||||||
install:
|
|
||||||
GO111MODULE=off go install \
|
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -f gadgetwindow
|
|
||||||
-rm resources/*.so
|
|
||||||
touch resources/blank.so
|
|
||||||
|
|
||||||
# embed the toolkit plugins in the binary
|
|
||||||
embed:
|
|
||||||
-rm resources/*.so
|
|
||||||
touch resources/blank.so
|
|
||||||
-cp -a ~/go/src/go.wit.com/toolkits/*.so resources/
|
|
||||||
|
|
||||||
gocui:
|
|
||||||
./helloworld --gui gocui
|
|
||||||
|
|
||||||
goimports:
|
|
||||||
goimports -w *.go
|
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
GO111MODULE= go mod tidy
|
GO111MODULE= go mod tidy
|
||||||
go mod edit -go=1.20
|
|
||||||
|
|
39
argv.go
39
argv.go
|
@ -1,39 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
|
||||||
this parses the command line arguements
|
|
||||||
|
|
||||||
this enables command line options from other packages like 'gui' and 'log'
|
|
||||||
*/
|
|
||||||
|
|
||||||
var argv args
|
|
||||||
|
|
||||||
type args struct {
|
|
||||||
Demo string `arg:"positional" help:"this is just a demo"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a args) Description() string {
|
|
||||||
return `
|
|
||||||
This helloworld example demonstrates the 'gui' plugin toolkits
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
pp := arg.MustParse(&argv)
|
|
||||||
|
|
||||||
// for very new users or users unfamilar with the command line, this may help them
|
|
||||||
if argv.Demo == "version" || argv.Demo == "help" || argv.Demo == "?" {
|
|
||||||
pp.WriteHelp(os.Stdout)
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (args) Version() string {
|
|
||||||
return "helloworld " + VERSION
|
|
||||||
}
|
|
20
debugger.go
20
debugger.go
|
@ -1,20 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
/*
|
|
||||||
enables GUI options and the debugger in your application
|
|
||||||
*/
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/lib/debugger"
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
if debugger.ArgDebug() {
|
|
||||||
log.Info("cmd line --debugger == true")
|
|
||||||
go func() {
|
|
||||||
log.Sleep(2)
|
|
||||||
debugger.DebugWindow()
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
}
|
|
15
main.go
15
main.go
|
@ -1,30 +1,20 @@
|
||||||
|
// This creates a simple helloworld window
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sent via -ldflags
|
|
||||||
var VERSION string
|
|
||||||
|
|
||||||
// This is the beginning of our binary tree of widgets
|
// This is the beginning of our binary tree of widgets
|
||||||
var myGui *gui.Node
|
var myGui *gui.Node
|
||||||
|
|
||||||
//go:embed resources/*
|
|
||||||
var resources embed.FS
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
myGui = gui.New()
|
myGui = gui.New().Default()
|
||||||
myGui.InitEmbed(resources)
|
|
||||||
myGui.Default()
|
|
||||||
|
|
||||||
helloworld()
|
helloworld()
|
||||||
|
|
||||||
// go will sit here until the window exits
|
// go will sit here until the window exits
|
||||||
// intermittently, it will show toolkit statistics
|
|
||||||
gui.Watchdog()
|
gui.Watchdog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +47,7 @@ func helloworld() {
|
||||||
log.Info("color is now", color.String())
|
log.Info("color is now", color.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
check := grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
|
check := grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
|
||||||
check.Custom = func() {
|
check.Custom = func() {
|
||||||
log.Info("Checkers is now", check.Bool())
|
log.Info("Checkers is now", check.Bool())
|
||||||
|
|
Loading…
Reference in New Issue