Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-01 09:22:34 -06:00
parent cbe69e9d12
commit 4672399fae
3 changed files with 65 additions and 59 deletions

View File

@ -1,17 +1,13 @@
// This creates a simple hello world window
package main package main
import ( import (
"os" "os"
"time"
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets" "go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/cloudflare" "go.wit.com/lib/gui/cloudflare"
"go.wit.com/lib/gui/logsettings"
) )
// This setups up the dns control panel window // This setups up the dns control panel window
@ -33,57 +29,6 @@ func setupControlPanelWindow(title string) {
me.window.Draw() 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) { func myDefaultExit(n *gui.Node) {
log.Println("You can Do exit() things here") log.Println("You can Do exit() things here")
os.Exit(0) os.Exit(0)

63
debugWindow.go Normal file
View File

@ -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
}

View File

@ -44,12 +44,10 @@ func main() {
me.myGui.InitEmbed(resToolkit) me.myGui.InitEmbed(resToolkit)
me.myGui.Default() me.myGui.Default()
// log.Sleep(me.artificialSleep) // setup the main window
// setupControlPanelWindow()
// setup the main tab
setupControlPanelWindow("DNS and IPv6 Control Panel") setupControlPanelWindow("DNS and IPv6 Control Panel")
me.debug = debugTab("Debug") me.debug = debugWindow("Debugging")
// TODO: track this bug down // TODO: track this bug down
log.Sleep(1) log.Sleep(1)