Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-08 11:55:56 -06:00
parent b1c311a1e2
commit 16fe0dacdd
6 changed files with 38 additions and 7 deletions

View File

@ -2,7 +2,8 @@
run: build run: build
# ./control-panel-dns >/tmp/witgui.log.stderr 2>&1 # ./control-panel-dns >/tmp/witgui.log.stderr 2>&1
./control-panel-dns cp -f control-panel-dns ~/
./control-panel-dns --tmp-log
redomod: redomod:
rm -f go.* rm -f go.*

View File

@ -15,6 +15,7 @@ import (
var args struct { var args struct {
Display string `arg:"env:DISPLAY"` Display string `arg:"env:DISPLAY"`
TmpLog bool `arg:"--tmp-log" help:"automatically send STDOUT to /tmp"`
VerboseDNS bool `arg:"--verbose-dns" help:"debug your dns settings"` VerboseDNS bool `arg:"--verbose-dns" help:"debug your dns settings"`
} }

View File

@ -12,6 +12,7 @@ import (
type errorBox struct { type errorBox struct {
ready bool ready bool
hidden bool
parent *gui.Node parent *gui.Node
group *gui.Node group *gui.Node
@ -53,6 +54,27 @@ func NewErrorBox(p *gui.Node, name string, ip string) *errorBox {
return eb return eb
} }
func (eb *errorBox) Show() {
if eb == nil {return}
eb.hidden = false
eb.group.Show()
}
func (eb *errorBox) Hide() {
if eb == nil {return}
eb.hidden = true
eb.group.Hide()
}
func (eb *errorBox) Toggle() {
if eb == nil {return}
if eb.hidden {
eb.Show()
} else {
eb.Hide()
}
}
func (eb *errorBox) Ready() bool { func (eb *errorBox) Ready() bool {
if eb == nil {return false} if eb == nil {return false}
return eb.ready return eb.ready

8
gui.go
View File

@ -12,7 +12,7 @@ import (
"go.wit.com/gui/cloudflare" "go.wit.com/gui/cloudflare"
"go.wit.com/gui/debugger" "go.wit.com/gui/debugger"
"go.wit.com/gui/gadgets/logsettings" "go.wit.com/gui/gadgets/logsettings"
"go.wit.com/apps/control-panel-dns/smartwindow" // "go.wit.com/apps/control-panel-dns/smartwindow"
) )
// This setups up the dns control panel window // This setups up the dns control panel window
@ -89,6 +89,7 @@ func mainWindow(title string) {
// some artificial padding to make the last row of buttons look less wierd // some artificial padding to make the last row of buttons look less wierd
gr := hbox.NewGroup("Development and Debugging Windows") gr := hbox.NewGroup("Development and Debugging Windows")
gr = gr.NewBox("vbox", false)
gr.NewButton("Debug", func () { gr.NewButton("Debug", func () {
me.debug.Toggle() me.debug.Toggle()
@ -103,7 +104,9 @@ func mainWindow(title string) {
} }
myLS.Toggle() myLS.Toggle()
}) })
gr.NewButton("Show Errors", func () { gr.NewButton("Show Errors", func () {
/*
if me.fixWindow == nil { if me.fixWindow == nil {
me.fixWindow = smartwindow.New() me.fixWindow = smartwindow.New()
me.fixWindow.SetParent(me.myGui) me.fixWindow.SetParent(me.myGui)
@ -115,7 +118,8 @@ func mainWindow(title string) {
me.fixWindow.Hide() me.fixWindow.Hide()
return return
} }
me.fixWindow.Toggle() */
me.problems.Toggle()
}) })
// These are your problems // These are your problems

View File

@ -35,10 +35,14 @@ func main() {
me.ipv4s = make(map[string]dns.RR) me.ipv4s = make(map[string]dns.RR)
me.ipv6s = make(map[string]dns.RR) me.ipv6s = make(map[string]dns.RR)
if args.TmpLog {
// send all log() output to a file in /tmp // send all log() output to a file in /tmp
log.SetTmp() log.SetTmp()
}
me.myGui = gui.New().Default() me.myGui = gui.New()
me.myGui.InitEmbed(resToolkit)
me.myGui.Default()
log.Sleep(me.artificialSleep) log.Sleep(me.artificialSleep)
setupControlPanelWindow() setupControlPanelWindow()

View File

@ -64,7 +64,6 @@ type Host struct {
fixButton *gui.Node fixButton *gui.Node
fixWindow *smartwindow.SmartWindow fixWindow *smartwindow.SmartWindow
errorGroup *gui.Node // Hide() and Show() this node if there are no errors
problems *errorBox problems *errorBox
} }