summaryrefslogtreecommitdiff
path: root/gui.go
diff options
context:
space:
mode:
Diffstat (limited to 'gui.go')
-rw-r--r--gui.go71
1 files changed, 31 insertions, 40 deletions
diff --git a/gui.go b/gui.go
index d6d0357..d0d4f4b 100644
--- a/gui.go
+++ b/gui.go
@@ -1,18 +1,17 @@
// This creates a simple hello world window
package main
-import (
- "time"
+import (
"os"
+ "time"
"go.wit.com/log"
- "go.wit.com/gui/gui"
- "go.wit.com/gui/gadgets"
- "go.wit.com/gui/debugger"
- "go.wit.com/gui/lib/cloudflare"
- "go.wit.com/gui/lib/logsettings"
- "go.wit.com/apps/control-panel-dns/smartwindow"
+ "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
@@ -34,11 +33,11 @@ func debugTab(title string) {
g2 = me.debug.Box().NewGroup("Real Stuff")
- g2.NewButton("GO GUI Debug Window", func () {
- debugger.DebugWindow(me.myGui)
+ g2.NewButton("GO GUI Debug Window", func() {
+ debugger.DebugWindow()
})
- g2.NewButton("dig A & AAAA DNS records (updateDNS())", func () {
+ g2.NewButton("dig A & AAAA DNS records (updateDNS())", func() {
log.Log(CHANGE, "updateDNS() going to run:")
})
@@ -46,11 +45,11 @@ func debugTab(title string) {
gridP := g2.NewGrid("nuts", 2, 1)
// makes a slider widget
- me.ttl = gadgets.NewDurationSlider(gridP, "Loop Timeout", 10 * time.Millisecond, 5 * time.Second)
+ me.ttl = gadgets.NewDurationSlider(gridP, "Loop Timeout", 10*time.Millisecond, 5*time.Second)
me.ttl.Set(300 * time.Millisecond)
// makes a slider widget
- me.dnsTtl = gadgets.NewDurationSlider(gridP, "DNS Timeout", 800 * time.Millisecond, 300 * time.Second)
+ me.dnsTtl = gadgets.NewDurationSlider(gridP, "DNS Timeout", 800*time.Millisecond, 300*time.Second)
me.dnsTtl.Set(60 * time.Second)
gridP.NewLabel("dns resolution")
@@ -75,7 +74,7 @@ func debugTab(title string) {
}
func myDefaultExit(n *gui.Node) {
- log.Println("You can Do exit() things here")
+ log.Println("You can Do exit() things here")
os.Exit(0)
}
@@ -93,47 +92,35 @@ func mainWindow(title string) {
gr := hbox.NewGroup("Development and Debugging Windows")
gr = gr.NewBox("vbox", false)
- gr.NewButton("Debug", func () {
+ gr.NewButton("Debug", func() {
me.debug.Toggle()
})
- var myLS *logsettings.LogSettings
- gr.NewButton("Logging Settings", func () {
- if myLS == nil {
- // initialize the log settings window (does not display it)
- myLS = logsettings.New(me.myGui)
- return
- }
- myLS.Toggle()
+ gr.NewButton("Logging Settings", func() {
+ logsettings.LogWindow()
})
- gr.NewButton("test smartwindow()", func () {
+ gr.NewButton("test smartwindow()", func() {
if me.fixWindow == nil {
- me.fixWindow = smartwindow.New()
- me.fixWindow.SetParent(me.myGui)
- me.fixWindow.Title("smart window test")
- me.fixWindow.SetDraw(testSmartWindow)
- me.fixWindow.Vertical()
+ me.fixWindow = gadgets.NewBasicWindow(me.myGui, "smart window test")
me.fixWindow.Make()
me.fixWindow.Draw()
- me.fixWindow.Hide()
return
}
me.fixWindow.Toggle()
})
- gr.NewButton("Show Errors", func () {
+ gr.NewButton("Show Errors", func() {
me.problems.Toggle()
})
me.autofix = gr.NewCheckbox("Auto-correct Errors")
- me.autofix.Set(false)
+ me.autofix.SetChecked(false)
// These are your problems
me.problems = NewErrorBox(me.window.Box(), "Errors", "has problems?")
me.problems.addIPerror(RR, USER, "1:1:1:1")
}
-
func statusGrid(n *gui.Node) {
problems := n.NewGroup("status")
problems.Margin()
@@ -145,27 +132,31 @@ func statusGrid(n *gui.Node) {
gridP.NewLabel("hostname =")
me.hostnameStatus = gridP.NewLabel("invalid")
- gridP.NewButton("Linux Status", func () {
+ gridP.NewButton("Linux Status", func() {
me.statusOS.Toggle()
})
me.statusIPv6 = gadgets.NewOneLiner(gridP, "DNS Lookup")
- me.statusIPv6.Set("known")
- gridP.NewButton("resolver status", func () {
- if ! me.digStatus.Ready() {return}
+ me.statusIPv6.SetValue("known")
+ gridP.NewButton("resolver status", func() {
+ if !me.digStatus.Ready() {
+ return
+ }
me.digStatus.window.Toggle()
})
gridP.NewLabel("DNS Status")
me.DnsStatus = gridP.NewLabel("unknown")
- me.statusDNSbutton = gridP.NewButton("hostname status", func () {
- if ! me.statusDNS.Ready() {return}
+ me.statusDNSbutton = gridP.NewButton("hostname status", func() {
+ if !me.statusDNS.Ready() {
+ return
+ }
me.statusDNS.window.Toggle()
})
gridP.NewLabel("DNS API")
me.DnsAPIstatus = gridP.NewLabel("unknown")
- me.apiButton = gridP.NewButton("unknown wit.com", func () {
+ me.apiButton = gridP.NewButton("unknown wit.com", func() {
log.Log(CHANGE, "WHAT API ARE YOU USING?")
provider := me.statusDNS.GetDNSapi()
if provider == "cloudflare" {