Compare commits
No commits in common. "master" and "v0.20.3" have entirely different histories.
|
@ -1,9 +1,5 @@
|
||||||
*.swp
|
*
|
||||||
go.mod
|
!.gitignore
|
||||||
go.sum
|
!Makefile
|
||||||
|
!*.go
|
||||||
/files/*
|
!LICENSE
|
||||||
/*.deb
|
|
||||||
/resources/*
|
|
||||||
|
|
||||||
gadgetwindow
|
|
||||||
|
|
56
Makefile
56
Makefile
|
@ -1,45 +1,44 @@
|
||||||
VERSION = $(shell git describe --tags)
|
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
reset
|
||||||
./gadgetwindow
|
./gadgetwindow
|
||||||
|
|
||||||
build:
|
|
||||||
GO111MODULE=off go build \
|
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
|
||||||
|
|
||||||
verbose:
|
|
||||||
GO111MODULE=off go build -v -x \
|
|
||||||
-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/
|
|
||||||
|
|
||||||
nocui: build
|
nocui: build
|
||||||
reset
|
reset
|
||||||
./gadgetwindow --gui nocui
|
./gadgetwindow --gui nocui
|
||||||
|
|
||||||
gocui: build
|
gocui: build
|
||||||
reset
|
reset
|
||||||
echo "redirecting STDOUT & STDERR to /tmp/gadgetwindow.out"
|
./gadgetwindow --gui gocui >/tmp/gadgetwindow.stderr 2>&1
|
||||||
./gadgetwindow --gui gocui
|
# ./gadgetwindow --gui gocui --tmp-log
|
||||||
|
|
||||||
|
log:
|
||||||
|
tail -f /tmp/guilogfile /tmp/witgui.* /tmp/gadget*
|
||||||
|
|
||||||
|
test-tmp-log: build
|
||||||
|
./gadgetwindow --gui andlabs --tmp-log
|
||||||
|
|
||||||
debugger: build
|
debugger: build
|
||||||
reset
|
reset
|
||||||
./gadgetwindow --debugger
|
./gadgetwindow --debugger
|
||||||
|
|
||||||
|
build:
|
||||||
|
ifeq ($(GO111MODULE),)
|
||||||
|
echo no. you must use GO111MODULE here
|
||||||
|
false
|
||||||
|
else
|
||||||
|
-rm -f gadgetwindow
|
||||||
|
go build -v -x
|
||||||
|
endif
|
||||||
|
|
||||||
|
stderr: build
|
||||||
|
echo "writing to /tmp/gadgetwindow.stderr"
|
||||||
|
./gadgetwindow >/tmp/gadgetwindow.stderr 2>&1
|
||||||
|
|
||||||
|
push:
|
||||||
|
git add --all
|
||||||
|
git commit -a
|
||||||
|
git push
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
|
|
||||||
|
@ -48,3 +47,4 @@ redomod:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
GO111MODULE= go mod tidy
|
GO111MODULE= go mod tidy
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
# gadgetwindow
|
|
||||||
This simple 'gui' demo also embedds the plugins into the binary
|
|
||||||
|
|
||||||
## Install go-glone
|
|
||||||
|
|
||||||
go build go.wit.com/apps/gadgetwindow@latest
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
var args struct {
|
||||||
|
TmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
arg.MustParse(&args)
|
||||||
|
|
||||||
|
if debugger.ArgDebug() {
|
||||||
|
log.Info("cmd line --debugger == true")
|
||||||
|
} else {
|
||||||
|
log.Info("cmd line --debugger == false")
|
||||||
|
}
|
||||||
|
}
|
38
argv.go
38
argv.go
|
@ -1,38 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/alexflint/go-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 basicwindow example demonstrates multiple windows
|
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
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 "basicwindow " + 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()
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
}
|
|
22
main.go
22
main.go
|
@ -1,8 +1,7 @@
|
||||||
|
// This creates a simple hello world window
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/debugger"
|
"go.wit.com/lib/debugger"
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
|
@ -10,15 +9,9 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sent via -ldflags
|
|
||||||
var VERSION string
|
|
||||||
|
|
||||||
// This is the beginning of the binary tree of widgets
|
// This is the beginning of the binary tree of widgets
|
||||||
var myGui *gui.Node
|
var myGui *gui.Node
|
||||||
|
|
||||||
//go:embed resources/*
|
|
||||||
var resources embed.FS
|
|
||||||
|
|
||||||
// this is the primary window. If you close it, the program will exit
|
// this is the primary window. If you close it, the program will exit
|
||||||
var mainWindow *gui.Node
|
var mainWindow *gui.Node
|
||||||
|
|
||||||
|
@ -34,13 +27,24 @@ func main() {
|
||||||
log.SetAll(true)
|
log.SetAll(true)
|
||||||
log.ShowFlags()
|
log.ShowFlags()
|
||||||
}
|
}
|
||||||
|
if args.TmpLog {
|
||||||
|
// send all log() output to a file in /tmp
|
||||||
|
log.SetTmp()
|
||||||
|
}
|
||||||
myGui = gui.New()
|
myGui = gui.New()
|
||||||
myGui.InitEmbed(resources)
|
|
||||||
myGui.Default()
|
myGui.Default()
|
||||||
|
|
||||||
helloworld()
|
helloworld()
|
||||||
basicWindow = makebasicWindow()
|
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
|
// go will sit here until the window exits
|
||||||
gui.Watchdog()
|
gui.Watchdog()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue