summaryrefslogtreecommitdiff
path: root/debugWindow.go
blob: e6e0311a0621a5c85b3b0f6ebb0d87e5c319f984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
}