70 lines
1.3 KiB
Go
70 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"embed"
|
|
"strings"
|
|
"bytes"
|
|
|
|
"go.wit.com/arg"
|
|
"go.wit.com/log"
|
|
"go.wit.com/gui/gui"
|
|
"go.wit.com/gui/debugger"
|
|
)
|
|
|
|
var GITCOMMIT string // this is passed in as an ldflag
|
|
var GOVERSION string // this is passed in as an ldflag
|
|
var VERSION string // this is passed in as an ldflag
|
|
var BUILDTIME string // this is passed in as an ldflag
|
|
|
|
var username string
|
|
var hostname string
|
|
var geom string = "120x30+500+500"
|
|
|
|
|
|
//go:embed resources
|
|
var res embed.FS
|
|
|
|
//go:embed plugins/*.so
|
|
var resToolkit embed.FS
|
|
|
|
//go:embed resources/ttyS0.conf
|
|
var ttyS0 string
|
|
|
|
func doCmd(str string) {
|
|
var stderr bytes.Buffer
|
|
log.Println("doCmd()", str)
|
|
args := strings.Split(str, " ")
|
|
cmd := exec.Command(args[0], args[1:]...)
|
|
cmd.Stdin = os.Stdin
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = &stderr // os.Stderr
|
|
err := cmd.Run()
|
|
if err != nil {
|
|
log.Println("Error:", err)
|
|
}
|
|
log.Println("STDERR:\n", stderr.String())
|
|
}
|
|
|
|
func main() {
|
|
log.Println("starting my Control Panel")
|
|
arg.MustParse()
|
|
|
|
// myGui = gui.New().InitEmbed(resToolkit)
|
|
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)
|
|
// os.Exit(0)
|
|
}
|