control-panel-dns/debugWindow.go

64 lines
1.4 KiB
Go

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