You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
1.5 KiB

package main
import (
"fmt"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"github.com/jnovack/flag"
log "github.com/sirupsen/logrus"
"os"
)
var password string
var trx int
var trace bool
var uri string
var trxname string
var ant1 string
var ant2 string
var ant3 string
func usage() {
fmt.Printf("Usage of %s:\n", os.Args[0])
flag.PrintDefaults()
}
func init() {
flag.StringVar(&password, "password", "", "your password")
flag.StringVar(&uri, "uri", "http://http-exporter", "uri to your http-exporter")
flag.IntVar(&trx, "trx", -1, "connected trx port on s.a.m.")
flag.BoolVar(&trace, "trace", false, "log almost everything")
flag.Parse()
if password == "" || uri == "" || trx == -1 {
usage()
os.Exit(1)
}
if trace {
log.SetLevel(log.TraceLevel)
log.Info("trace logging enabled")
} else {
log.Info("normal logging enabled")
}
// FIXME
log.Info("[fake] getting name from s.a.m. server..")
trxname = "KX3"
ant1 = "HF-P1 40m"
ant2 = "GP 20/15/10m"
ant3 = "2m Eggbeater"
}
func main() {
a := app.New()
w := a.NewWindow("Antenna Switcher")
hello := widget.NewLabel("just started..")
w.SetContent(container.NewVBox(
hello,
widget.NewButton(ant1, func() {
hello.SetText(fmt.Sprintf("%s : %s", trxname, ant1))
}),
widget.NewButton(ant2, func() {
hello.SetText(fmt.Sprintf("%s : %s", trxname, ant2))
}),
widget.NewButton(ant3, func() {
hello.SetText(fmt.Sprintf("%s : %s", trxname, ant3))
}),
))
w.ShowAndRun()
}