new gui version

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-24 18:24:38 -06:00
parent 6a09621efc
commit d0e1ab2f8e
19 changed files with 919 additions and 768 deletions

View File

@ -8,6 +8,11 @@ VERSION = $(shell cat resources/VERSION)
run: build
./wit-debian-gui
redomod:
rm -f go.*
go mod init
go mod tidy
new-build:
# go mod edit -replace go.wit.com/wit/gui=/home/jcarr/go/src/git.wit.org/wit/gui
# go mod edit -replace go.wit.com/wit/shell=/home/jcarr/go/src/git.wit.org/wit/shell

25
apt.go
View File

@ -1,23 +1,22 @@
package main
import (
"go.wit.com/gui"
"go.wit.com/log"
"go.wit.com/gui/gui"
)
func aptGroup(box *gui.Node) {
n := box.NewGroup("apt Resets")
n.NewButton("update apt-file", func () {
n.NewButton("update apt-file", func() {
// shell.Script("apt -y install apt-file\napt-file update")
// xterm("apt -y install apt-file; apt-file update")
// gui.ErrorWindow("test error window", "this is the error")
err := sudo( func() error {
err := sudo(func() error {
err := bash("apt install moon-buggy")
return err
})
if (err != nil) {
if err != nil {
log.Warn("Error", "Failed to run:\napt install moon-buggy")
return
}
@ -26,28 +25,28 @@ func aptGroup(box *gui.Node) {
bash("apt-file update")
})
n.NewButton("install packages", func () {
n.NewButton("install packages", func() {
aptPackagesWindow()
})
n.NewButton("install base packages", func () {
sudo( func() error {
n.NewButton("install base packages", func() {
sudo(func() error {
line := "apt install moon-buggy2"
err := bash(line)
if (err != nil) {
log.Error(err, "Error", "Failed to run:\n" + line)
if err != nil {
log.Error(err, "Error", "Failed to run:\n"+line)
return err
}
return nil
})
})
n.NewButton("purge rc-only", func () {
n.NewButton("purge rc-only", func() {
xterm("dpkg -l |grep ^rc | awk '{print $2}' |xargs apt remove --purge -y")
})
n.NewButton("install defaults", func () {
n.NewButton("install defaults", func() {
xterm("./resources/bin/setup-packages-default")
})
n.NewButton("install kvm", func () {
n.NewButton("install kvm", func() {
xterm("./resources/bin/setup-packages-kvm")
})

34
go.mod Normal file
View File

@ -0,0 +1,34 @@
module git.wit.org/wit/wit-debian-gui
go 1.21.4
require (
github.com/davecgh/go-spew v1.1.1
github.com/getlantern/systray v1.2.2
github.com/gobuffalo/packr v1.30.1
go.wit.com/gui v0.13.11
go.wit.com/lib/debugger v0.12.7
go.wit.com/lib/gadgets v0.13.0
go.wit.com/log v0.5.6
)
require (
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 // indirect
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 // indirect
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 // indirect
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gobuffalo/envy v1.7.0 // indirect
github.com/gobuffalo/packd v0.3.0 // indirect
github.com/joho/godotenv v1.3.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/rogpeppe/go-internal v1.3.0 // indirect
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
go.wit.com/lib/gui/logsettings v0.10.2 // indirect
go.wit.com/widget v1.1.6 // indirect
golang.org/x/sys v0.1.0 // indirect
)

112
go.sum Normal file
View File

@ -0,0 +1,112 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 h1:6uJ+sZ/e03gkbqZ0kUG6mfKoqDb4XMAzMIwlajq19So=
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A=
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 h1:guBYzEaLz0Vfc/jv0czrr2z7qyzTOGC9hiQ0VC+hKjk=
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7/go.mod h1:zx/1xUUeYPy3Pcmet8OSXLbF47l+3y6hIPpyLWoR9oc=
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 h1:micT5vkcr9tOVk1FiH8SWKID8ultN44Z+yzd2y/Vyb0=
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7/go.mod h1:dD3CgOrwlzca8ed61CsZouQS5h5jIzkK9ZWrTcf0s+o=
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 h1:XYzSdCbkzOC0FDNrgJqGRo8PCMFOBFL9py72DRs7bmc=
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA=
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA=
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
github.com/getlantern/systray v1.2.2 h1:dCEHtfmvkJG7HZ8lS/sLklTH4RKUcIsKrAD9sThoEBE=
github.com/getlantern/systray v1.2.2/go.mod h1:pXFOI1wwqwYXEhLPm9ZGjS2u/vVELeIgNMY5HvhHhcE=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=
github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=
github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=
github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=
github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=
github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg=
github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk=
github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794/go.mod h1:E23UucZGqpuUANJooIbHWCufXvOcT6E7Stq81gU+CSQ=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
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/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/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 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
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.12.7 h1:c8ehU7p2asb//K4YgC17XG4o2pPP+IZb9lR2a0nBio8=
go.wit.com/lib/debugger v0.12.7/go.mod h1:zcZstsgOcALjCNOiIE+KcKkrIF78ogYjwxmaQlBbmtQ=
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.10.2 h1:xRx0AX1V74kC6CIm+ib6C3ziTcbBjR/Ju3rTLEpQMsw=
go.wit.com/lib/gui/logsettings v0.10.2/go.mod h1:v5XUQ6WyNyfScR9oOFhdz8p1wtxCpNWXK3DJ/dbLPVo=
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/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
gopkg.in/Knetic/govaluate.v3 v3.0.0/go.mod h1:csKLBORsPbafmSCGTEh3U7Ozmsuq8ZSIlKk1bcqph0E=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -1,9 +1,11 @@
package main
import "log"
// import "os"
import "go.wit.com/gui/gui"
import "go.wit.com/gui"
// import "github.com/skratchdot/open-golang/open"
// import "github.com/davecgh/go-spew/spew"
@ -14,33 +16,33 @@ import "go.wit.com/gui/gui"
//
type myButtonInfo struct {
Custom func (*gui.Node)
ADD func (*gui.Node)
Name string
Action string
Node *gui.Node
Custom func(*gui.Node)
ADD func(*gui.Node)
Name string
Action string
Node *gui.Node
}
// stores the fields we want to map into our private structure 'values'
func makeButtonValues(n *gui.Node, name string, action string, custom func(*gui.Node)) *myButtonInfo {
val := &myButtonInfo{}
val.Custom = custom
val.Name = name
val := &myButtonInfo{}
val.Custom = custom
val.Name = name
// val.Action = action
return val
}
// stores the fields we want to map into our private structure 'values'
func newMmakeButtonValues(name string, custom func(*gui.Node)) *myButtonInfo {
val := &myButtonInfo{}
val.Custom = custom
val.Name = name
val := &myButtonInfo{}
val.Custom = custom
val.Name = name
// val.Action = action
return val
}
func makeXtermButton(n *gui.Node, name string, action string, custom string) *gui.Node {
n.NewButton(name, func () {
n.NewButton(name, func() {
log.Println("xterm cmd=", custom)
xterm(custom)
})

View File

@ -1,4 +1,5 @@
//+build linux darwin
//go:build linux || darwin
// +build linux darwin
// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray)
@ -635,4 +636,3 @@ var myIcon []byte = []byte{
0x25, 0x84, 0xe2, 0xc1, 0xa1, 0x04, 0x20, 0x81, 0x00, 0x00, 0x00, 0x00,
0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
}

View File

@ -4,10 +4,10 @@ import (
"os"
"time"
"go.wit.com/log"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
"github.com/gobuffalo/packr"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
)
// origlog "log"
@ -67,7 +67,7 @@ func main() {
myGui = gui.New().Default()
log.Warn("Starting window")
gadgets.NewBasicWindow(myGui, "Debian SID Mate Control Panel " + VERSION)
gadgets.NewBasicWindow(myGui, "Debian SID Mate Control Panel "+VERSION)
tabResets()
windowAddWWW()

28
os.go
View File

@ -1,22 +1,22 @@
package main
import (
"strings"
"bufio"
"errors"
"io/ioutil"
"os"
"os/exec"
"io/ioutil"
"errors"
"bufio"
"strings"
"go.wit.com/log"
// "go.wit.com/gui/gui"
// "go.wit.com/gui/gui"
"github.com/davecgh/go-spew/spew"
)
func runSimpleCommand(s string) {
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
cmd = strings.TrimSuffix(cmd, "\n") // this is like 'chomp' in perl
cmdArgs := strings.Fields(cmd)
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
cmd = strings.TrimSuffix(cmd, "\n") // this is like 'chomp' in perl
cmdArgs := strings.Fields(cmd)
runLinuxCommand(cmdArgs)
}
@ -112,12 +112,12 @@ func packrSaveFile(packrname string, filename string) error {
func bash(cmdline string) error {
log.Println("shell.Run() START " + cmdline)
cmdArgs := strings.Fields(cmdline)
cmdArgs := strings.Fields(cmdline)
process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)
process.Stderr = os.Stderr
process.Stdin = os.Stdin
process.Stdout = os.Stdout
process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)
process.Stderr = os.Stderr
process.Stdin = os.Stdin
process.Stdout = os.Stdout
process.Start()
err := process.Wait()
log.Println("shell.Exec() err =", err)
@ -129,7 +129,7 @@ func sudo(f func() error) error {
uid := os.Getuid()
e := "You must be root to do this."
log.Println(e, "uid =", uid)
if (uid != 0) {
if uid != 0 {
log.Warn("Permissions Failed", e)
return errors.New("not root")
}

View File

@ -2,16 +2,15 @@ package main
import (
"fmt"
"os"
"io/ioutil"
"log"
"os"
"time"
// "go.wit.com/gui/gui"
"go.wit.com/gui/debugger"
// "go.wit.com/gui/gui"
"github.com/davecgh/go-spew/spew"
"github.com/getlantern/systray"
"go.wit.com/lib/debugger"
// "github.com/skratchdot/open-golang/open"
)
@ -103,11 +102,11 @@ func onReady() {
case <-mHide.ClickedCh:
log.Println("START Hide()")
/*
window := gui.Data.WindowMap["splash"]
if window != nil {
box := window.BoxMap["splash"]
box.Window.UiTab.Hide()
}
window := gui.Data.WindowMap["splash"]
if window != nil {
box := window.BoxMap["splash"]
box.Window.UiTab.Hide()
}
*/
log.Println("END")
case <-mEnabled.ClickedCh:

View File

@ -1,3 +1,4 @@
//go:build darwin || freebsd || dragonfly || openbsd || netbsd
// +build darwin freebsd dragonfly openbsd netbsd
// https://github.com/creack/termios/blob/master/raw/tioc_bsd.go

View File

@ -9,8 +9,7 @@ import (
"log"
"runtime/debug"
"time"
// "go.wit.com/gui/gui"
// "go.wit.com/gui/gui"
)
type myChan struct {
@ -30,26 +29,26 @@ func watchWindows() {
log.Println("Window was closed")
/*
if dnsSlider == nil {
log.Println("SKIPPING: dnsSlider == nil")
} else {
dnsSlider.SetValue(55)
}
if dnsSlider == nil {
log.Println("SKIPPING: dnsSlider == nil")
} else {
dnsSlider.SetValue(55)
}
*/
// gui.CreateWindow("ARGV", "vars", 300, 200, makeWindowARGV)
debug.PrintStack()
dumpModuleInfo()
/*
gui.DumpBoxes()
window := gui.Data.WindowMap["Debugging2"]
if window != nil {
log.Println("found debugging2 Window")
gui.DeleteWindow("Debugging2")
} else {
closed = false
}
*/
/*
gui.DumpBoxes()
window := gui.Data.WindowMap["Debugging2"]
if window != nil {
log.Println("found debugging2 Window")
gui.DeleteWindow("Debugging2")
} else {
closed = false
}
*/
// toggle the systray menu
var tmp struct{}

View File

@ -1,15 +1,15 @@
package main
import (
// "bufio"
// "bufio"
"os"
"runtime"
"runtime/debug"
"runtime/pprof"
"go.wit.com/log"
// "go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
// "go.wit.com/gui/gui"
"go.wit.com/lib/gadgets"
)
var langWin *gadgets.BasicWindow
@ -24,44 +24,44 @@ func golangDebug() {
/////////////////////////////// Column DEBUG GOLANG //////////////////////
gNode := langWin.Box().NewGroup("golang")
gNode.NewButton("runtime.Stack() dump", func () {
gNode.NewButton("runtime.Stack() dump", func() {
log.Println("\tSTART")
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
log.Printf("%s", buf)
log.Println("\tEND")
})
gNode.NewButton("dumpModuleInfo", func () {
gNode.NewButton("dumpModuleInfo", func() {
log.Println("\tSTART")
dumpModuleInfo()
log.Println("\tEND")
})
gNode.NewButton("debug.PrintStack", func () {
gNode.NewButton("debug.PrintStack", func() {
log.Println("\tSTART")
debug.PrintStack()
log.Println("\tEND")
})
gNode.NewButton("pprof.Lookup goroutine", func () {
gNode.NewButton("pprof.Lookup goroutine", func() {
log.Println("\tSTART")
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
log.Println("\tEND")
})
gNode.NewButton("pprof.Lookup", func () {
gNode.NewButton("pprof.Lookup", func() {
log.Println("\tSTART")
pprof.Lookup("heap").WriteTo(os.Stdout, 1)
log.Println("\tEND")
})
gNode.NewButton("pprof.Lookup block", func () {
gNode.NewButton("pprof.Lookup block", func() {
log.Println("\tSTART")
pprof.Lookup("block").WriteTo(os.Stdout, 1)
log.Println("\tEND")
})
gNode.NewButton("pprof.Lookup threadcreate", func () {
gNode.NewButton("pprof.Lookup threadcreate", func() {
log.Println("\tSTART")
pprof.Lookup("threadcreate").WriteTo(os.Stdout, 1)
log.Println("\tEND")
})
gNode.NewButton("runtime.ReadMemStats", func () {
gNode.NewButton("runtime.ReadMemStats", func() {
var s runtime.MemStats
runtime.ReadMemStats(&s)
log.Printf("alloc: %v bytes\n", s.Alloc)

View File

@ -1,21 +1,21 @@
package main
import (
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
)
var upDNSwin *gadgets.BasicWindow
func updateDNS(w *gui.Node) {
if (upDNSwin != nil) {
if upDNSwin != nil {
upDNSwin.Toggle()
return
}
upDNSwin = gadgets.NewBasicWindow(w, "dns update Window")
////////////// filename /////////////////////////
////////////// filename /////////////////////////
gNode := upDNSwin.Box().NewGroup("eth0 update")
// fontsize := "16"
@ -25,9 +25,9 @@ func updateDNS(w *gui.Node) {
dnsNode.AddText("24")
dnsNode.SetText("12")
////////////// connect /////////////////////////
////////////// connect /////////////////////////
gNode = upDNSwin.Box().NewGroup("Update")
gNode.NewButton("setup .Xresources", func () {
gNode.NewButton("setup .Xresources", func() {
})
}

View File

@ -7,8 +7,8 @@ import (
"os"
"strings"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
)
var aptWin *gadgets.BasicWindow

View File

@ -1,8 +1,8 @@
package main
import (
"go.wit.com/lib/gadgets"
"go.wit.com/log"
"go.wit.com/gui/gadgets"
)
var tabWin *gadgets.BasicWindow

View File

@ -1,14 +1,14 @@
package main
import (
"os"
"bufio"
"strings"
"errors"
"os"
"strings"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
)
var filename string = "resolv-1-1-1-1.conf"
@ -17,13 +17,13 @@ var generaloutput *gui.Node
var resWin *gadgets.BasicWindow
func resolvWindow() {
if (resWin != nil) {
if resWin != nil {
resWin.Toggle()
return
}
resWin = gadgets.NewBasicWindow(myGui,"resolv.conf Window")
resWin = gadgets.NewBasicWindow(myGui, "resolv.conf Window")
////////////// filename /////////////////////////
////////////// filename /////////////////////////
gNode := resWin.Box().NewGroup("filename")
var tmp []string
@ -41,22 +41,22 @@ func resolvWindow() {
}
resolvNode.SetText(filename)
resolvNode.Custom = func () {
resolvNode.Custom = func() {
log.Println("STARTED HOSTNAME")
filename = resolvNode.GetText()
b, _ := packrBox.FindString(filename)
if (generaloutput != nil) {
if generaloutput != nil {
generaloutput.SetText(b)
}
log.Println("ENDED GetText() HOSTNAME =", filename)
}
////////////// connect /////////////////////////
////////////// connect /////////////////////////
gNode = resWin.Box().NewGroup("")
gNode.NewButton("Update /etc/resolv.conf", func () {
sudo( func() error {
log.Println("set resolv.conf to",filename)
gNode.NewButton("Update /etc/resolv.conf", func() {
sudo(func() error {
log.Println("set resolv.conf to", filename)
b, _ := packrBox.FindString(filename)
// spew.Dump(b)
b = generaloutput.GetText()
@ -75,22 +75,22 @@ func resolvWindow() {
return nil
})
})
gNode.NewButton("test ping ipv4", func () {
gNode.NewButton("test ping ipv4", func() {
bash("ping -c 3 -4 google.com")
})
gNode.NewButton("test ping ipv6", func () {
gNode.NewButton("test ping ipv6", func() {
bash("ping -c 3 -6 google.com")
})
gNode.NewButton("set output", func () {
if (generaloutput != nil) {
gNode.NewButton("set output", func() {
if generaloutput != nil {
generaloutput.SetText("wow")
generaloutput.Margin()
}
})
gNode = resWin.Box().NewGroup("Update")
gNode.NewButton("MakeGroupEdit()", func () {
gNode.NewButton("MakeGroupEdit()", func() {
log.Warn("recreate a gadget for editing the resolv.conf")
//generaloutput = gNode.MakeGroupEdit("resolv.conf:")
})

View File

@ -3,22 +3,22 @@ package main
import (
"os/user"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
)
var userNode *gui.Node
var sshWin *gadgets.BasicWindow
func sshGenericWindow() {
if (sshWin != nil) {
if sshWin != nil {
sshWin.Toggle()
return
}
sshWin = gadgets.NewBasicWindow(myGui, "sshWindow")
////////////// username /////////////////////////
////////////// username /////////////////////////
gNode := sshWin.Box().NewGroup("username")
userNode = gNode.NewCombobox("username")
@ -26,7 +26,7 @@ func sshGenericWindow() {
userNode.AddText("jcarr")
userNode.AddText("hugo")
userNode.Custom = func () {
userNode.Custom = func() {
username = userNode.GetText()
log.Println("SETTING: username=", username)
userNode.Dump()
@ -38,7 +38,7 @@ func sshGenericWindow() {
userNode.Dump()
// panic("blah")
////////////// hostname /////////////////////////
////////////// hostname /////////////////////////
gNode = sshWin.Box().NewGroup("homename")
hostNode := gNode.NewCombobox("hostname")
@ -46,7 +46,7 @@ func sshGenericWindow() {
hostNode.AddText("mirrors")
hostNode.AddText("git")
hostNode.Custom = func () {
hostNode.Custom = func() {
log.Println("STARTED HOSTNAME")
hostname = hostNode.GetText()
log.Println("ENDED GetText() HOSTNAME")
@ -54,10 +54,10 @@ func sshGenericWindow() {
hostname = "mirrors"
hostNode.SetText("mirrors")
////////////// connect /////////////////////////
////////////// connect /////////////////////////
gNode = sshWin.Box().NewGroup("connect")
gNode.NewButton("connect", func () {
gNode.NewButton("connect", func() {
cmd := "ssh -v " + username + "@" + hostname
log.Println("xterm cmd=", cmd)
xterm(cmd)

View File

@ -1,31 +1,31 @@
package main
import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
)
var webWin *gadgets.BasicWindow
func windowAddWWW() {
if (webWin != nil) {
if webWin != nil {
webWin.Toggle()
return
}
webWin = gadgets.NewBasicWindow(myGui, "webpages")
////////////// connect /////////////////////////
////////////// connect /////////////////////////
gNode := webWin.Box().NewGroup("www")
firefoxButton(gNode, "git", "https://git.wit.org/")
firefoxButton(gNode, "mirrors", "https://mirrors.wit.org/")
firefoxButton(gNode, "IPv6-Only ping", "http://ping.wit.org/")
firefoxButton(gNode, "SyncThing", "http://localhost:8384/")
firefoxButton(gNode, "pprof this GO app", "http://localhost:6060/debug/pprof/")
firefoxButton(gNode, "git", "https://git.wit.org/")
firefoxButton(gNode, "mirrors", "https://mirrors.wit.org/")
firefoxButton(gNode, "IPv6-Only ping", "http://ping.wit.org/")
firefoxButton(gNode, "SyncThing", "http://localhost:8384/")
firefoxButton(gNode, "pprof this GO app", "http://localhost:6060/debug/pprof/")
}
func firefoxButton (n *gui.Node, name string, url string) {
n.NewButton(name, func () {
func firefoxButton(n *gui.Node, name string, url string) {
n.NewButton(name, func() {
log.Println("button clicked: trying to open url")
var tmp []string
tmp = append(tmp, "nohup")

View File

@ -3,9 +3,9 @@ package main
import (
"io/ioutil"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
)
var fontNode *gui.Node
@ -14,7 +14,7 @@ var fontsize string = ""
var xtermWin *gadgets.BasicWindow
func xtermSettings(w *gui.Node) {
if (xtermWin != nil) {
if xtermWin != nil {
xtermWin.Toggle()
return
}
@ -29,15 +29,15 @@ func xtermSettings(w *gui.Node) {
fontNode.AddText("16")
fontNode.AddText("24")
fontNode.AddText("32")
fontNode.Custom = func () {
fontNode.Custom = func() {
fontsize = fontNode.GetText()
}
fontNode.SetText(fontsize)
////////////// connect /////////////////////////
////////////// connect /////////////////////////
gNode = xtermWin.Box().NewGroup("Update")
gNode.NewButton("setup .Xresources", func () {
gNode.NewButton("setup .Xresources", func() {
log.Println("fontsize =", fontsize)
// write out .Xresources file
@ -52,13 +52,13 @@ func xtermSettings(w *gui.Node) {
log.Println("button click end")
})
gNode.NewButton("test xterm", func () {
gNode.NewButton("test xterm", func() {
cmd := "xterm"
xterm(cmd)
})
gNode.NewButton("fontNode.GetText()", func () {
if (fontNode != nil) {
gNode.NewButton("fontNode.GetText()", func() {
if fontNode != nil {
fontsize = fontNode.GetText()
log.Println("set fontsize =", fontsize)
}