gui API updates

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-15 03:28:16 -06:00
parent 4c40ea1a7b
commit 68f23a5866
10 changed files with 38 additions and 95 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.swp
go.*
wit-new-machine
/files/*
/*.deb

View File

@ -6,9 +6,10 @@ VERSION = $(shell cat resources/VERSION)
# export GO111MODULE="off"
build:
-cp ~/go/src/go.wit.com/gui/toolkits/*.so plugins/
-mkdir plugins
-cp ~/go/src/go.wit.com/toolkits/*.so plugins/
go build -v
./wit-new-machine --debugging
./wit-new-machine
goimports:
goimports -w *.go

4
apt.go
View File

@ -3,10 +3,12 @@ package main
import (
"log"
"os"
"go.wit.com/gui"
)
func aptTab() {
aptTab := mainWindow.NewTab("apt")
aptTab := gui.RawWindow("apt")
box := aptTab.NewBox("aptBox", false)
box.NewButton("apt sources", func() {

28
args.go
View File

@ -1,28 +0,0 @@
package main
/*
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 argGui ArgsGui
// This struct can be used with the go-arg package
type ArgsGui struct {
Test bool `arg:"--test" help:"enable all logging"`
}
func init() {
arg.MustParse(&argGui)
if debugger.ArgDebug() {
log.Log(true, "INIT() gui debug == true")
} else {
log.Log(true, "INIT() gui debug == false")
}
}

26
debugger.go Normal file
View File

@ -0,0 +1,26 @@
package main
/*
enables GUI options and the debugger in your application
*/
import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/debugger"
"go.wit.com/log"
)
var args struct {
}
func init() {
arg.MustParse(&args)
if debugger.ArgDebug() {
log.Info("cmd line --debugger == true")
go func() {
log.Sleep(2)
debugger.DebugWindow()
}()
}
}

22
go.mod
View File

@ -1,22 +0,0 @@
module git.wit.org/jcarr/wit-new-machine
go 1.21.4
require (
go.wit.com/dev/alexflint/arg v1.4.5
go.wit.com/gui v0.13.11
go.wit.com/lib/debugger v0.13.0
go.wit.com/log v0.5.6
golang.org/x/mobile v0.0.0-20240112133503-c713f31d574b
)
require (
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
go.wit.com/lib/gadgets v0.13.0 // indirect
go.wit.com/lib/gui/logsettings v0.13.0 // indirect
go.wit.com/widget v1.1.6 // indirect
golang.org/x/exp/shiny v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/sys v0.16.0 // indirect
)

26
go.sum
View File

@ -1,26 +0,0 @@
go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/gui v0.13.11 h1:d74Ko/XFZYR25P/AZfCQaVO2CuGh1BSjdUp1wjktdDg=
go.wit.com/gui v0.13.11/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
go.wit.com/lib/debugger v0.13.0 h1:k5XCa7BZFYA37rFf20iTAm5L4Ch+3eRuxCbHIhorYZI=
go.wit.com/lib/debugger v0.13.0/go.mod h1:b3gykobdR+lcMjWAHJUa3GRsMYbnaHNwA/upfjpSA28=
go.wit.com/lib/gadgets v0.13.0 h1:jtsEnf4DHqAxBxuYsaDlHti73rgaxYf/ffAXNB1PJAk=
go.wit.com/lib/gadgets v0.13.0/go.mod h1:xidaHAL6Nk9+M9FkySVU1AG5i39v7T3PuFphUos6LxE=
go.wit.com/lib/gui/logsettings v0.13.0 h1:iphACMcfdc5GoCcxZkShcWn9A/SwvnPmLXCSYSL+eJU=
go.wit.com/lib/gui/logsettings v0.13.0/go.mod h1:h+skqrtQ3muJ1TzMQ7M568xAwqT7nZCGS32c5jYCrqc=
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=
go.wit.com/widget v1.1.6/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
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.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/mobile v0.0.0-20240112133503-c713f31d574b h1:kfWLZgb8iUBHdE9WydD5V5dHIS/F6HjlBZNyJfn2bs4=
golang.org/x/mobile v0.0.0-20240112133503-c713f31d574b/go.mod h1:4efzQnuA1nICq6h4kmZRMGzbPiP06lZvgADUu1VpJCE=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

9
gui.go
View File

@ -5,7 +5,6 @@ import (
"os"
"time"
"go.wit.com/lib/debugger"
"go.wit.com/gui"
"go.wit.com/log"
)
@ -41,7 +40,7 @@ func drawWindow() {
mainWindow = myGui.NewWindow("wit new machine setup").SetText("wit new machine setup")
mainWindow.Custom = customExit
newTab := mainWindow.NewTab("mainTab")
newTab := gui.NewWindow("mainTab")
//////////////////// General GUI debugging /////////////////////////
g = newTab.NewGroup("Debug")
@ -97,14 +96,10 @@ func drawWindow() {
os.Exit(0)
})
rn.NewButton("DebugWindow()", func() {
debugger.DebugWindow(myGui)
})
rn.NewLabel("Not yet working stuff")
rn.NewButton("resolv.conf", func() {
s := resolv.GetText()
s := resolv.String()
log.Println("supposed to make the resolv.conf window\n\n", s)
})

View File

@ -8,7 +8,6 @@ import (
"strings"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/debugger"
"go.wit.com/gui"
"go.wit.com/log"
)
@ -54,15 +53,10 @@ func main() {
myGui = gui.New().Default()
drawWindow()
if debugger.ArgDebug() {
log.Sleep(2)
debugger.DebugWindow(myGui)
}
gui.Watchdog()
}
func closeWindow(n *gui.Node) {
log.Println("Just closing the window and nothing else.", n.Name)
log.Println("Just closing the window and nothing else.", n.String())
// os.Exit(0)
}

View File

@ -12,7 +12,7 @@ var commandEntry *gui.Node
func setupNewMachine(cur *gui.Node) {
var w, g *gui.Node
w = cur.NewTab("Setup Machine")
w = myGui.NewWindow("Setup Machine")
g = w.NewGroup("ssh things")
g.NewButton("ssh localhost", func() {
@ -37,7 +37,7 @@ func setupNewMachine(cur *gui.Node) {
g.NewLabel("install go 1.19")
g.NewButton("wget 1.19", func() {
command = "ssh -t " + "jcarr" + "@" + hostname + " 'wget https://go.dev/dl/go1.19.linux-amd64.tar.gz' "
xtermHold.Set(true)
xtermHold.SetChecked(true)
xterm(command)
})