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
# ./control-panel-dns >/tmp/witgui.log.stderr 2>&1
./control-panel-dns
cp -f control-panel-dns ~/
./control-panel-dns --tmp-log
redomod:
rm -f go.*

View File

@ -15,6 +15,7 @@ import (
var args struct {
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"`
}

View File

@ -12,6 +12,7 @@ import (
type errorBox struct {
ready bool
hidden bool
parent *gui.Node
group *gui.Node
@ -53,6 +54,27 @@ func NewErrorBox(p *gui.Node, name string, ip string) *errorBox {
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 {
if eb == nil {return false}
return eb.ready

8
gui.go
View File

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

10
main.go
View File

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

View File

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