2023-04-12 12:21:23 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-24 22:02:08 -06:00
|
|
|
"bytes"
|
|
|
|
"embed"
|
2023-04-22 12:51:13 -05:00
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"strings"
|
2023-04-12 12:21:23 -05:00
|
|
|
|
2024-01-24 22:07:03 -06:00
|
|
|
"go.wit.com/dev/alexflint/arg"
|
2024-01-24 22:02:08 -06:00
|
|
|
"go.wit.com/gui"
|
2024-01-03 22:09:15 -06:00
|
|
|
"go.wit.com/log"
|
2023-04-12 12:21:23 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-04-28 08:14:10 -05:00
|
|
|
//go:embed plugins/*.so
|
2023-04-28 07:26:55 -05:00
|
|
|
var resToolkit embed.FS
|
|
|
|
|
2023-04-22 12:51:13 -05:00
|
|
|
//go:embed resources/ttyS0.conf
|
|
|
|
var ttyS0 string
|
|
|
|
|
|
|
|
func doCmd(str string) {
|
|
|
|
var stderr bytes.Buffer
|
2023-04-22 13:00:37 -05:00
|
|
|
log.Println("doCmd()", str)
|
2023-04-22 12:51:13 -05:00
|
|
|
args := strings.Split(str, " ")
|
|
|
|
cmd := exec.Command(args[0], args[1:]...)
|
2023-04-22 13:41:59 -05:00
|
|
|
cmd.Stdin = os.Stdin
|
2023-04-22 12:51:13 -05:00
|
|
|
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())
|
|
|
|
}
|
|
|
|
|
2023-04-12 12:21:23 -05:00
|
|
|
func main() {
|
|
|
|
log.Println("starting my Control Panel")
|
2024-01-03 22:09:15 -06:00
|
|
|
arg.MustParse()
|
2023-04-12 12:21:23 -05:00
|
|
|
|
2024-01-01 01:18:17 -06:00
|
|
|
// myGui = gui.New().InitEmbed(resToolkit)
|
|
|
|
myGui = gui.New().Default()
|
2023-04-23 11:30:39 -05:00
|
|
|
drawWindow()
|
|
|
|
|
2023-04-12 12:21:23 -05:00
|
|
|
gui.Watchdog()
|
|
|
|
}
|
|
|
|
|
|
|
|
func closeWindow(n *gui.Node) {
|
2024-02-15 03:28:16 -06:00
|
|
|
log.Println("Just closing the window and nothing else.", n.String())
|
2023-04-12 12:21:23 -05:00
|
|
|
// os.Exit(0)
|
|
|
|
}
|