Compare commits

..

No commits in common. "master" and "v0.20.6" have entirely different histories.

7 changed files with 28 additions and 89 deletions

14
.gitignore vendored
View File

@ -1,9 +1,5 @@
*.swp *
go.mod !.gitignore
go.sum !Makefile
!*.go
/files/* !LICENSE
/*.deb
/resources/*
gadgetwindow

View File

@ -1,32 +1,7 @@
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
@ -34,12 +9,26 @@ nocui: build
gocui: build gocui: build
reset reset
echo "redirecting STDOUT & STDERR to /tmp/gadgetwindow.out" echo "redirecting STDOUT & STDERR to /tmp/gadgetwindow.out"
./gadgetwindow --gui gocui ./gadgetwindow --gui gocui >/tmp/gadgetwindow.out 2>&1
log:
tail -f /tmp/gadgetwindow.out*
debugger: build debugger: build
reset reset
./gadgetwindow --debugger ./gadgetwindow --debugger
build:
ifeq ($(GO111MODULE),)
@echo
@echo In GO, to build here you must export GO111MODULE=off
@echo
@false
else
-rm -f gadgetwindow
go build -v -x
endif
goimports: goimports:
goimports -w *.go goimports -w *.go

View File

@ -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

38
argv.go
View File

@ -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
}

View File

@ -5,11 +5,17 @@ package main
*/ */
import ( import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/debugger" "go.wit.com/lib/debugger"
"go.wit.com/log" "go.wit.com/log"
) )
var args struct {
}
func init() { func init() {
arg.MustParse(&args)
if debugger.ArgDebug() { if debugger.ArgDebug() {
log.Info("cmd line --debugger == true") log.Info("cmd line --debugger == true")
go func() { go func() {

10
main.go
View File

@ -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
@ -35,7 +28,6 @@ func main() {
log.ShowFlags() log.ShowFlags()
} }
myGui = gui.New() myGui = gui.New()
myGui.InitEmbed(resources)
myGui.Default() myGui.Default()
helloworld() helloworld()

View File