From 4672399fae8aebd66916a9c61a84fa3d10650491 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 1 Feb 2024 09:22:34 -0600 Subject: [PATCH] rename Signed-off-by: Jeff Carr --- gui.go => controlPanelWindow.go | 55 ---------------------------- debugWindow.go | 63 +++++++++++++++++++++++++++++++++ main.go | 6 ++-- 3 files changed, 65 insertions(+), 59 deletions(-) rename gui.go => controlPanelWindow.go (63%) create mode 100644 debugWindow.go diff --git a/gui.go b/controlPanelWindow.go similarity index 63% rename from gui.go rename to controlPanelWindow.go index a7610fd..3392321 100644 --- a/gui.go +++ b/controlPanelWindow.go @@ -1,17 +1,13 @@ -// This creates a simple hello world window package main import ( "os" - "time" "go.wit.com/log" "go.wit.com/gui" - "go.wit.com/lib/debugger" "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/cloudflare" - "go.wit.com/lib/gui/logsettings" ) // This setups up the dns control panel window @@ -33,57 +29,6 @@ func setupControlPanelWindow(title string) { me.window.Draw() } -func debugTab(title string) *gadgets.BasicWindow { - if me.debug != nil { - return me.debug - } - - win := gadgets.NewBasicWindow(me.myGui, title) - win.Make() - - group := win.Box().NewGroup("Real Stuff") - - group.NewButton("GO GUI Debug Window", func() { - debugger.DebugWindow() - }) - - group.NewButton("Logging Settings", func() { - logsettings.LogWindow() - }) - - group.NewButton("dig A & AAAA DNS records (updateDNS())", func() { - log.Log(CHANGE, "updateDNS() going to run:") - }) - - group = win.Box().NewGroup("debugging options") - grid := group.NewGrid("nuts", 2, 1) - - // makes a slider widget - me.ttl = gadgets.NewDurationSlider(grid, "Loop Timeout", 10*time.Millisecond, 5*time.Second) - me.ttl.Set(300 * time.Millisecond) - - // makes a slider widget - me.dnsTtl = gadgets.NewDurationSlider(grid, "DNS Timeout", 800*time.Millisecond, 300*time.Second) - me.dnsTtl.Set(60 * time.Second) - - grid.NewLabel("dns resolution") - me.DnsSpeed = grid.NewLabel("unknown") - - grid.NewLabel("dns resolution speed") - me.DnsSpeedActual = grid.NewLabel("unknown") - - grid.NewLabel("Test speed") - newGrid := grid.NewGrid("nuts", 2, 1).Pad() - - newGrid.NewLabel("ping.wit.com =") - newGrid.NewLabel("unknown") - - newGrid.NewLabel("ping6.wit.com =") - newGrid.NewLabel("unknown") - - return win -} - func myDefaultExit(n *gui.Node) { log.Println("You can Do exit() things here") os.Exit(0) diff --git a/debugWindow.go b/debugWindow.go new file mode 100644 index 0000000..e6e0311 --- /dev/null +++ b/debugWindow.go @@ -0,0 +1,63 @@ +// This creates a simple hello world window +package main + +import ( + "time" + + "go.wit.com/log" + + "go.wit.com/lib/debugger" + "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/logsettings" +) + +func debugWindow(title string) *gadgets.BasicWindow { + if me.debug != nil { + return me.debug + } + + win := gadgets.NewBasicWindow(me.myGui, title) + win.Make() + + group := win.Box().NewGroup("Real Stuff") + + group.NewButton("GO GUI Debug Window", func() { + debugger.DebugWindow() + }) + + group.NewButton("Logging Settings", func() { + logsettings.LogWindow() + }) + + group.NewButton("dig A & AAAA DNS records (updateDNS())", func() { + log.Log(CHANGE, "updateDNS() going to run:") + }) + + group = win.Box().NewGroup("debugging options") + grid := group.NewGrid("nuts", 2, 1) + + // makes a slider widget + me.ttl = gadgets.NewDurationSlider(grid, "Loop Timeout", 10*time.Millisecond, 5*time.Second) + me.ttl.Set(300 * time.Millisecond) + + // makes a slider widget + me.dnsTtl = gadgets.NewDurationSlider(grid, "DNS Timeout", 800*time.Millisecond, 300*time.Second) + me.dnsTtl.Set(60 * time.Second) + + grid.NewLabel("dns resolution") + me.DnsSpeed = grid.NewLabel("unknown") + + grid.NewLabel("dns resolution speed") + me.DnsSpeedActual = grid.NewLabel("unknown") + + grid.NewLabel("Test speed") + newGrid := grid.NewGrid("nuts", 2, 1).Pad() + + newGrid.NewLabel("ping.wit.com =") + newGrid.NewLabel("unknown") + + newGrid.NewLabel("ping6.wit.com =") + newGrid.NewLabel("unknown") + + return win +} diff --git a/main.go b/main.go index a20d07d..7b2ec0f 100644 --- a/main.go +++ b/main.go @@ -44,12 +44,10 @@ func main() { me.myGui.InitEmbed(resToolkit) me.myGui.Default() - // log.Sleep(me.artificialSleep) - // setupControlPanelWindow() - // setup the main tab + // setup the main window setupControlPanelWindow("DNS and IPv6 Control Panel") - me.debug = debugTab("Debug") + me.debug = debugWindow("Debugging") // TODO: track this bug down log.Sleep(1)