use SetText not SetValue

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-31 12:36:52 -06:00
parent 51eeda03e0
commit 9aeed44eea
6 changed files with 37 additions and 37 deletions

View File

@ -72,11 +72,11 @@ func NewDigStatusWindow(p *gui.Node) *digStatus {
g := ds.summary.NewGrid("LookupStatus", 2, 2)
g.Pad()
ds.status = gadgets.NewOneLiner(g, "status").SetValue("unknown")
ds.statusAAAA = gadgets.NewOneLiner(g, "IPv6 status").SetValue("unknown")
ds.statusHTTP = gadgets.NewOneLiner(g, "IPv6 via HTTP").SetValue("unknown")
ds.speed = gadgets.NewOneLiner(g, "speed").SetValue("unknown")
ds.speedActual = gadgets.NewOneLiner(g, "actual").SetValue("unknown")
ds.status = gadgets.NewOneLiner(g, "status").SetText("unknown")
ds.statusAAAA = gadgets.NewOneLiner(g, "IPv6 status").SetText("unknown")
ds.statusHTTP = gadgets.NewOneLiner(g, "IPv6 via HTTP").SetText("unknown")
ds.speed = gadgets.NewOneLiner(g, "speed").SetText("unknown")
ds.speedActual = gadgets.NewOneLiner(g, "actual").SetText("unknown")
// make the area to store the raw details
ds.detailsGroup = ds.window.Box().NewGroup("Details")
@ -103,7 +103,7 @@ func (ds *digStatus) Update() {
ds.updateDnsStatus()
})
s := fmt.Sprint(duration)
// ds.speedActual.SetValue(s)
// ds.speedActual.SetText(s)
me.digStatus.set(ds.speedActual, s)
if duration > 500*time.Millisecond {
@ -172,7 +172,7 @@ func (ds *digStatus) SetIPv6(s string) {
log.Warn("Should SetIPv6() here to", s)
log.Warn("Should SetIPv6() here to", s)
log.Warn("Should SetIPv6() here to", s)
me.DnsAAAA.SetValue(s)
me.DnsAAAA.SetText(s)
// me.digStatus.set(ds.httpGoWitCom, addr)
}
*/
@ -196,7 +196,7 @@ func (ds *digStatus) set(a any, s string) {
var ol *gadgets.OneLiner
if reflect.TypeOf(a) == reflect.TypeOf(ol) {
ol = a.(*gadgets.OneLiner)
ol.SetValue(s)
ol.SetText(s)
return
}
log.Warn("unknown type TypeOf(a) =", reflect.TypeOf(a), "a =", a)

2
dns.go
View File

@ -93,7 +93,7 @@ func lookupNS(domain string) {
if tmp != me.statusDNS.NSrr.String() {
me.changed = true
log.Log(CHANGE, "lookupNS() setting changed to me.NSrr =", tmp)
me.statusDNS.NSrr.SetValue(tmp)
me.statusDNS.NSrr.SetText(tmp)
}
}

2
gui.go
View File

@ -137,7 +137,7 @@ func statusGrid(n *gui.Node) {
})
me.statusIPv6 = gadgets.NewOneLiner(gridP, "DNS Lookup")
me.statusIPv6.SetValue("known")
me.statusIPv6.SetText("known")
gridP.NewButton("resolver status", func() {
if !me.digStatus.Ready() {
return

View File

@ -72,9 +72,9 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
group := hs.window.Box().NewGroup("Summary")
grid := group.NewGrid("LookupStatus", 2, 2)
hs.status = gadgets.NewOneLiner(grid, "status").SetValue("unknown")
hs.statusIPv4 = gadgets.NewOneLiner(grid, "IPv4").SetValue("unknown")
hs.statusIPv6 = gadgets.NewOneLiner(grid, "IPv6").SetValue("unknown")
hs.status = gadgets.NewOneLiner(grid, "status").SetText("unknown")
hs.statusIPv4 = gadgets.NewOneLiner(grid, "IPv4").SetText("unknown")
hs.statusIPv6 = gadgets.NewOneLiner(grid, "IPv6").SetText("unknown")
group.Pad()
grid.Pad()
@ -87,13 +87,13 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
hs.currentIPv4 = gadgets.NewOneLiner(grid, "Current IPv4")
hs.currentIPv6 = gadgets.NewOneLiner(grid, "Current IPv6")
hs.NSrr = gadgets.NewOneLiner(grid, "dns NS records").SetValue("unknown")
hs.dnsAPI = gadgets.NewOneLiner(grid, "dns API provider").SetValue("unknown")
hs.dnsA = gadgets.NewOneLiner(grid, "dns IPv4 resource records").SetValue("unknown")
hs.dnsAAAA = gadgets.NewOneLiner(grid, "dns IPv6 resource records").SetValue("unknown")
hs.NSrr = gadgets.NewOneLiner(grid, "dns NS records").SetText("unknown")
hs.dnsAPI = gadgets.NewOneLiner(grid, "dns API provider").SetText("unknown")
hs.dnsA = gadgets.NewOneLiner(grid, "dns IPv4 resource records").SetText("unknown")
hs.dnsAAAA = gadgets.NewOneLiner(grid, "dns IPv6 resource records").SetText("unknown")
hs.speed = gadgets.NewOneLiner(grid, "speed").SetValue("unknown")
hs.speedActual = gadgets.NewOneLiner(grid, "actual").SetValue("unknown")
hs.speed = gadgets.NewOneLiner(grid, "speed").SetText("unknown")
hs.speedActual = gadgets.NewOneLiner(grid, "actual").SetText("unknown")
group.Pad()
grid.Pad()
@ -176,14 +176,14 @@ func (hs *hostnameStatus) setIPv4(s string) {
if !hs.Ready() {
return
}
hs.statusIPv4.SetValue(s)
hs.statusIPv4.SetText(s)
}
func (hs *hostnameStatus) setIPv6(s string) {
if !hs.Ready() {
return
}
hs.statusIPv6.SetValue(s)
hs.statusIPv6.SetText(s)
}
func (hs *hostnameStatus) set(a any, s string) {
@ -210,7 +210,7 @@ func (hs *hostnameStatus) set(a any, s string) {
return
}
// log.Println("SETTING ol:", ol)
ol.SetValue(s)
ol.SetText(s)
return
}
log.Warn("unknown type TypeOf(a) =", reflect.TypeOf(a), "a =", a)
@ -245,11 +245,11 @@ func (hs *hostnameStatus) updateStatus() {
// hostname changed or was setup for the first time. Set the window title, etc
if lasthostname != hostname {
me.changed = true
hs.hostname.SetValue(hostname)
hs.hostname.SetText(hostname)
hs.window.SetLabel(hostname + " Status")
me.statusDNSbutton.SetLabel(hostname + " status")
}
hs.domainname.SetValue(me.statusOS.GetDomainName())
hs.domainname.SetText(me.statusOS.GetDomainName())
var tmp []string
tmp = me.statusOS.GetIPv4()
@ -257,7 +257,7 @@ func (hs *hostnameStatus) updateStatus() {
s = strings.Join(tmp, "\n")
if s != hs.currentIPv4.String() {
log.Log(CHANGE, "DNS IPv4 Addresses changed", tmp)
hs.currentIPv4.SetValue(s)
hs.currentIPv4.SetText(s)
hs.changed = true
}
@ -266,7 +266,7 @@ func (hs *hostnameStatus) updateStatus() {
s = strings.Join(tmp, "\n")
if s != hs.currentIPv6.String() {
log.Log(CHANGE, "DNS IPv6 Addresses changed", tmp)
hs.currentIPv6.SetValue(s)
hs.currentIPv6.SetText(s)
hs.changed = true
}
@ -274,7 +274,7 @@ func (hs *hostnameStatus) updateStatus() {
vals = lookupDoH(me.statusOS.GetHostname(), "AAAA")
log.Log(STATUS, "DNS IPv6 Addresses for ", me.statusOS.GetHostname(), "=", vals)
hs.dnsAAAA.SetValue(strings.Join(vals, "\n"))
hs.dnsAAAA.SetText(strings.Join(vals, "\n"))
vals = lookupDoH(me.statusOS.GetHostname(), "A")
log.Log(STATUS, "IPv4 Addresses for ", me.statusOS.GetHostname(), "=", vals)
@ -299,9 +299,9 @@ func (hs *hostnameStatus) updateStatus() {
}
if hs.IPv4() && hs.IPv6() {
hs.status.SetValue("GOOD")
hs.status.SetText("GOOD")
} else {
hs.status.SetValue("BROKEN")
hs.status.SetText("BROKEN")
}
last := hs.statusIPv6.String()
@ -309,14 +309,14 @@ func (hs *hostnameStatus) updateStatus() {
if last != "WORKING" {
log.Log(CHANGE, "Your DNS IPv6 has started working.", me.statusOS.GetHostname(), "should now work")
hs.changed = true
hs.statusIPv6.SetValue("WORKING")
hs.statusIPv6.SetText("WORKING")
me.DnsStatus.SetText("WORKING")
}
} else {
if last != "BROKEN" {
log.Log(CHANGE, "Your DNS entries for IPv6 have BROKEN")
hs.changed = true
hs.statusIPv6.SetValue("BROKEN")
hs.statusIPv6.SetText("BROKEN")
me.DnsStatus.SetText("BROKEN")
}
}
@ -392,6 +392,6 @@ func (hs *hostnameStatus) SetDNSapi(api string) {
return
}
hs.APIprovider = api
hs.dnsAPI.SetValue(api)
hs.dnsAPI.SetText(api)
hs.changed = true
}

View File

@ -80,12 +80,12 @@ func main() {
if me.digStatus.IPv6() {
if current != "WORKING" {
log.Log(CHANGE, "IPv6 resolution is WORKING")
me.statusIPv6.SetValue("WORKING")
me.statusIPv6.SetLabel("WORKING")
}
} else {
if current != "Need VPN" {
log.Log(CHANGE, "IPv6 resolution seems to have broken")
me.statusIPv6.SetValue("Need VPN")
me.statusIPv6.SetLabel("Need VPN")
}
}
}
@ -107,7 +107,7 @@ func main() {
me.apiButton.SetText(provider + " wit.com")
}
if provider == "cloudflare" {
me.DnsAPIstatus.SetValue("WORKING")
me.DnsAPIstatus.SetLabel("WORKING")
}
})
@ -118,7 +118,7 @@ func main() {
if me.statusOS.ValidHostname() {
if me.hostnameStatus.String() != "WORKING" {
me.hostnameStatus.SetValue("WORKING")
me.hostnameStatus.SetLabel("WORKING")
me.changed = true
}
}

View File

@ -58,7 +58,7 @@ func (rs *resolverStatus) set(a any, s string) {
var ol *gadgets.OneLiner
if reflect.TypeOf(a) == reflect.TypeOf(ol) {
ol = a.(*gadgets.OneLiner)
ol.SetValue(s)
ol.SetText(s)
return
}
log.Warn("unknown type TypeOf(a) =", reflect.TypeOf(a), "a =", a)