Browse Source

[gui] first steps on playground ;)

master
Sebastian Denz 4 years ago
parent
commit
cb7b56c83a
  1. 1
      gui/.gitignore
  2. 71
      gui/main.go

1
gui/.gitignore

@ -0,0 +1 @@
gui

71
gui/main.go

@ -0,0 +1,71 @@
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()
}
Loading…
Cancel
Save