use the compiled in plugins

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-28 07:26:55 -05:00
parent 4d849303f9
commit 0450de636f
5 changed files with 21 additions and 25 deletions

View File

@ -10,7 +10,10 @@ build:
# reset
-cp ~/go/src/git.wit.org/wit/gui/toolkit/*.so resources/toolkits/
GO111MODULE="off" go build -v
./wit-new-machine
./wit-new-machine --gui-toolkit gocui >/tmp/witgui.log.stderr 2>&1
nocui:
./wit-new-machine --gui-toolkit nocui
release:
wit go update

4
apt.go
View File

@ -17,6 +17,7 @@ func aptTab() {
writeRes("resources/", "/etc/", "apt/sources.list")
writeRes("resources/", "/etc/", "apt/sources.list.d/wit.list")
writeRes("resources/", "/etc/", "apt/sources.list.d/debian.list")
doCmd("mkdir /etc/wit/")
writeRes("resources/apt/", "/etc/wit/", "wit.gpg")
doCmd("apt update")
doCmd("apt dist-upgrade")
@ -29,7 +30,8 @@ func aptTab() {
myGui.CloseToolkit("gocui")
doCmd("apt install apt-file")
doCmd("apt-file update")
doCmd("apt-file -x search '/libOpenCL.so.1'")
doCmd("apt-file -x search /libOpenCL.so.1")
// doCmd("apt-file -x search '/libOpenCL.so.1'")
os.Exit(0)
})

5
gui.go
View File

@ -1,6 +1,7 @@
package main
import (
"log"
"fmt"
"time"
"os"
"io/ioutil"
@ -65,6 +66,10 @@ func drawWindow() {
gui.DebugWindow()
})
g.NewButton("hello", func () {
fmt.Println("world")
})
/////////////////////////////////////////////////////////////////////////////
rn := newTab.NewGroup("Local Linux Settings")

11
main.go
View File

@ -23,6 +23,9 @@ var geom string = "120x30+500+500"
//go:embed resources
var res embed.FS
//go:embed resources/toolkits
var resToolkit embed.FS
//go:embed resources/ttyS0.conf
var ttyS0 string
@ -50,8 +53,12 @@ func main() {
os.Exit(0)
}
// myGui = gui.New().LoadToolkit("gocui")
myGui = gui.New().Default()
if (args.GuiToolkit == nil) {
myGui = gui.New().InitEmbed(resToolkit).Default()
} else {
myGui = gui.New().InitEmbed(resToolkit).LoadToolkit(args.GuiToolkit[0])
}
drawWindow()
gui.Watchdog()

21
os.go
View File

@ -100,24 +100,3 @@ func runLinuxCommand(cmdArgs []string) (string, error) {
log.Println(string(bytes))
return string(bytes), err
}
/*
TODO: rewrite this using go:embed
func packrSaveFile(packrname string, filename string) error {
log.Println("packrSaveFile() for", packrname)
b, _ := packrBox.FindString(packrname)
log.Println(packrname, "=\n\n", b)
spew.Dump(b)
f, err := os.Create(filename)
if err != nil {
return err
}
defer f.Close()
w := bufio.NewWriter(f)
n4, err := w.WriteString(b)
log.Println("n4 =", n4)
w.Flush()
return nil
}
*/