From 16fe0dacddbb3f425ec43174ccd7fb347e2e310d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 8 Jan 2024 11:55:56 -0600 Subject: [PATCH] not sure Signed-off-by: Jeff Carr --- Makefile | 3 ++- args.go | 1 + errorBox.go | 22 ++++++++++++++++++++++ gui.go | 8 ++++++-- main.go | 10 +++++++--- structs.go | 1 - 6 files changed, 38 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a0c49d0..0c35f00 100644 --- a/Makefile +++ b/Makefile @@ -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.* diff --git a/args.go b/args.go index 6ee6960..08fdd8a 100644 --- a/args.go +++ b/args.go @@ -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"` } diff --git a/errorBox.go b/errorBox.go index dab2016..768f762 100644 --- a/errorBox.go +++ b/errorBox.go @@ -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 diff --git a/gui.go b/gui.go index 191ab63..38d1ec8 100644 --- a/gui.go +++ b/gui.go @@ -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 diff --git a/main.go b/main.go index f1801b2..485c63a 100644 --- a/main.go +++ b/main.go @@ -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() diff --git a/structs.go b/structs.go index 863bdce..0bbe939 100644 --- a/structs.go +++ b/structs.go @@ -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 }