update to go.wit.com/gui

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-01 01:18:17 -06:00
parent 86e6811aeb
commit 0f28c56854
9 changed files with 63 additions and 70 deletions

View File

@ -8,8 +8,8 @@ VERSION = $(shell cat resources/VERSION)
build: build:
# -git pull # -git pull
-cp ~/go/src/git.wit.org/wit/gui/toolkit/*.so plugins/ -cp ~/go/src/git.wit.org/wit/gui/toolkit/*.so plugins/
GO111MODULE="off" go build -v go build -v
./wit-new-machine --gui-toolkit gocui >/tmp/witgui.log.stderr 2>&1 ./wit-new-machine --gui gocui >/tmp/witgui.log.stderr 2>&1
nocui: nocui:
./wit-new-machine --gui-toolkit nocui ./wit-new-machine --gui-toolkit nocui

1
apt.go
View File

@ -2,7 +2,6 @@ package main
import ( import (
"log" "log"
"os" "os"
// "git.wit.org/wit/gui"
) )
func aptTab() { func aptTab() {

16
args.go
View File

@ -2,23 +2,9 @@
package main package main
import ( import (
"git.wit.org/wit/gui"
arg "github.com/alexflint/go-arg" arg "github.com/alexflint/go-arg"
) )
var args struct {
LogFile string
Verbose bool
User string `arg:"env:USER"`
TestExec string
gui.GuiArgs
}
func init() { func init() {
parseArgv() arg.MustParse()
}
func parseArgv() {
arg.MustParse(&args)
} }

19
go.mod Normal file
View File

@ -0,0 +1,19 @@
module git.wit.org/jcarr/wit-new-machine
go 1.21.4
require (
github.com/alexflint/go-arg v1.4.3
go.wit.com/gui v0.9.2
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a
)
require (
github.com/alexflint/go-scalar v1.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/image v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
)

35
go.sum Normal file
View File

@ -0,0 +1,35 @@
github.com/alexflint/go-arg v1.4.3 h1:9rwwEBpMXfKQKceuZfYcwuc/7YY7tWJbFsgG5cAU/uo=
github.com/alexflint/go-arg v1.4.3/go.mod h1:3PZ/wp/8HuqRZMUUgu7I+e1qcpUbvmS258mRXkFH4IA=
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM=
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
go.wit.com/gui v0.9.2 h1:QHMYdwpV6MzKwmFUMGevKUDn2a6GAqHN2Ltx8V3HufI=
go.wit.com/gui v0.9.2/go.mod h1:asRXEYKmdjhtg1yiBi5A8YEY2YG4lWPS0gvNz4NXGDE=
golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 h1:3AGKexOYqL+ztdWdkB1bDwXgPBuTS/S8A4WzuTvJ8Cg=
golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0=
golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4=
golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a h1:sYbmY3FwUWCBTodZL1S3JUuOvaW6kM2o+clDzzDNBWg=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a/go.mod h1:Ede7gF0KGoHlj822RtphAHK1jLdrcuRBZg0sF1Q+SPc=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

19
gui.go
View File

@ -1,11 +1,10 @@
package main package main
import ( import (
"log" "log"
"fmt"
"time" "time"
"os" "os"
"io/ioutil" "io/ioutil"
"git.wit.org/wit/gui" "go.wit.com/gui"
) )
var myGui *gui.Node var myGui *gui.Node
@ -54,22 +53,6 @@ func drawWindow() {
resolv.Dump() resolv.Dump()
resolv.SetText("hello world\nfoo bar\n") resolv.SetText("hello world\nfoo bar\n")
g.NewButton("Load 'gocui'", func () {
myGui.LoadToolkit("gocui")
})
g.NewButton("Load 'andlabs'", func () {
myGui.LoadToolkit("andlabs")
})
g.NewButton("gui.DebugWindow()", func () {
gui.DebugWindow()
})
g.NewButton("hello", func () {
fmt.Println("world")
})
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
rn := newTab.NewGroup("Local Linux Settings") rn := newTab.NewGroup("Local Linux Settings")

20
main.go
View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
"bytes" "bytes"
"git.wit.org/wit/gui" "go.wit.com/gui"
) )
var GITCOMMIT string // this is passed in as an ldflag var GITCOMMIT string // this is passed in as an ldflag
@ -48,24 +48,8 @@ func doCmd(str string) {
func main() { func main() {
log.Println("starting my Control Panel") log.Println("starting my Control Panel")
if (args.TestExec != "") { // myGui = gui.New().InitEmbed(resToolkit)
// for i, t := range args.Toolkit {
doCmd(args.TestExec)
os.Exit(0)
}
myGui = gui.New().InitEmbed(resToolkit)
if (args.GuiToolkit == nil) {
myGui = gui.New().Default() myGui = gui.New().Default()
} else {
if args.GuiToolkit[0] == "gocui" {
myGui = gui.New().LoadToolkit(args.GuiToolkit[0])
} else {
myGui = gui.New().LoadToolkit(args.GuiToolkit[0]).InitEmbed(resToolkit)
// myGui = gui.New().InitEmbed(resToolkit).LoadToolkit(args.GuiToolkit[0])
}
}
drawWindow() drawWindow()
gui.Watchdog() gui.Watchdog()

13
os.go
View File

@ -6,19 +6,6 @@ import "os"
import "os/exec" import "os/exec"
import "io/ioutil" import "io/ioutil"
import "errors" import "errors"
// import "bufio"
// import "github.com/davecgh/go-spew/spew"
/*
import "time"
import "runtime"
import "runtime/debug"
import "runtime/pprof"
import "git.wit.org/wit/gui"
import "git.wit.org/wit/shell"
*/
func runSimpleCommand(s string) { func runSimpleCommand(s string) {
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl cmd := strings.TrimSpace(s) // this is like 'chomp' in perl

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"git.wit.org/wit/gui" "go.wit.com/gui"
) )
// setup a new machine // setup a new machine
@ -53,7 +53,7 @@ func setupNewMachine(cur *gui.Node) {
g.NewLabel("build myself") g.NewLabel("build myself")
g.NewButton("setup go", func () { g.NewButton("setup go", func () {
// ssh -t == force pseudo tty allocation // ssh -t == force pseudo tty allocation
command = "ssh -t " + "jcarr" + "@" + hostname + " 'go get -u -v git.wit.org/jcarr/control-panel-dns ; bash'" command = "ssh -t " + "jcarr" + "@" + hostname + " 'go get -u -v go.wit.com/jcarr/control-panel-dns ; bash'"
commandEntry.SetText(command) commandEntry.SetText(command)
}) })
} }