summaryrefslogtreecommitdiff
path: root/draw.go
blob: ac0e7152fb6f22cf8380b299732387c8cc6aaf7c (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
// This creates a simple hello world window
package linuxstatus

import (
	"go.wit.com/lib/gadgets"
)

// creates the actual widgets.
// it's assumed you are always passing in a box
func draw(ls *LinuxStatus) {
	if !ls.Ready() {
		return
	}
	ls.group = ls.window.Box().NewGroup("What Linux Knows It Is")

	ls.grid = ls.group.NewGrid("gridnuts", 2, 2)

	ls.hostnameStatus = gadgets.NewOneLiner(ls.grid, "status")
	ls.hostname = gadgets.NewOneLiner(ls.grid, "hostname -f")
	ls.hostshort = gadgets.NewOneLiner(ls.grid, "hostname -s")
	ls.domainname = gadgets.NewOneLiner(ls.grid, "domain name")
	ls.resolver = gadgets.NewOneLiner(ls.grid, "nameservers =")
	ls.resolver.SetText("TODO")
	ls.uid = gadgets.NewOneLiner(ls.grid, "UID =")
	ls.IPv4 = gadgets.NewOneLiner(ls.grid, "Current IPv4 =")
	ls.IPv6 = gadgets.NewOneLiner(ls.grid, "Current IPv6 =")
	ls.workingIPv4 = gadgets.NewOneLiner(ls.grid, "Real IPv4 =")
	ls.workingIPv6 = gadgets.NewOneLiner(ls.grid, "Real IPv6 =")
	// ls.nics		= gadgets.NewOneLiner(ls.grid, "network intefaces =")

	ls.grid.NewLabel("interfaces =")
	ls.Interfaces = ls.grid.NewCombobox()

	ls.speed = gadgets.NewOneLiner(ls.grid, "refresh speed =")
	ls.speedActual = gadgets.NewOneLiner(ls.grid, "refresh speed =")

	ls.grid.Margin()
	ls.grid.Pad()
}