remove testing code
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
1a9b13dda5
commit
4641eceda8
56
common.go
56
common.go
|
@ -2,7 +2,6 @@
|
||||||
package linuxstatus
|
package linuxstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/gui"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,30 +18,6 @@ func (ls *LinuxStatus) Changed() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinuxStatus) Make() {
|
|
||||||
if !ls.Ready() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Log(CHANGE, "Make() window ready =", ls.ready)
|
|
||||||
ls.window.Make()
|
|
||||||
ls.ready = true
|
|
||||||
}
|
|
||||||
func (ls *LinuxStatus) Draw() {
|
|
||||||
if !ls.Ready() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Log(CHANGE, "Draw() window ready =", ls.ready)
|
|
||||||
ls.window.Draw()
|
|
||||||
ls.ready = true
|
|
||||||
}
|
|
||||||
func (ls *LinuxStatus) Draw2() {
|
|
||||||
if !ls.Ready() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Log(CHANGE, "draw(ls) ready =", ls.ready)
|
|
||||||
draw(ls)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ls *LinuxStatus) Show() {
|
func (ls *LinuxStatus) Show() {
|
||||||
if !ls.Ready() {
|
if !ls.Ready() {
|
||||||
return
|
return
|
||||||
|
@ -86,34 +61,3 @@ func (ls *LinuxStatus) Ready() bool {
|
||||||
}
|
}
|
||||||
return me.ready
|
return me.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinuxStatus) Initialized() bool {
|
|
||||||
log.Log(CHANGE, "checking Initialized()")
|
|
||||||
if me == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if ls == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if ls.parent == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ls *LinuxStatus) SetParent(p *gui.Node) {
|
|
||||||
log.Log(CHANGE, "Attempting SetParent")
|
|
||||||
if me == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ls == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ls.parent == nil {
|
|
||||||
log.Log(CHANGE, "SetParent =", p)
|
|
||||||
ls.parent = p
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
log.Log(CHANGE, "SetParent was already set to =", ls.parent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
3
draw.go
3
draw.go
|
@ -8,9 +8,6 @@ import (
|
||||||
// creates the actual widgets.
|
// creates the actual widgets.
|
||||||
// it's assumed you are always passing in a box
|
// it's assumed you are always passing in a box
|
||||||
func draw(ls *LinuxStatus) {
|
func draw(ls *LinuxStatus) {
|
||||||
if !ls.Ready() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ls.group = ls.window.Box().NewGroup("What Linux Knows It Is")
|
ls.group = ls.window.Box().NewGroup("What Linux Knows It Is")
|
||||||
|
|
||||||
ls.grid = ls.group.NewGrid("gridnuts", 2, 2)
|
ls.grid = ls.group.NewGrid("gridnuts", 2, 2)
|
||||||
|
|
26
new.go
26
new.go
|
@ -2,12 +2,13 @@
|
||||||
package linuxstatus
|
package linuxstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.wit.com/gui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New() *LinuxStatus {
|
func NewLinuxStatus(parent *gui.Node) *LinuxStatus {
|
||||||
if me != nil {
|
if me != nil {
|
||||||
log.Log(WARN, "You have done New() twice. You can only do this once")
|
log.Log(WARN, "You have done New() twice. You can only do this once")
|
||||||
return me
|
return me
|
||||||
|
@ -19,21 +20,12 @@ func New() *LinuxStatus {
|
||||||
me.ifmap = make(map[int]*IFtype)
|
me.ifmap = make(map[int]*IFtype)
|
||||||
me.ipmap = make(map[string]*IPtype)
|
me.ipmap = make(map[string]*IPtype)
|
||||||
|
|
||||||
|
log.Log(WARN, "Creating the Window")
|
||||||
|
me.window = gadgets.NewBasicWindow(parent, "OS Hostname Details")
|
||||||
|
me.window.Make()
|
||||||
|
draw(me)
|
||||||
|
me.window.Draw()
|
||||||
|
|
||||||
|
me.ready = true
|
||||||
return me
|
return me
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinuxStatus) InitWindow() {
|
|
||||||
if !ls.Initialized() {
|
|
||||||
log.Log(WARN, "not initalized yet (no parent for the window?)")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ls.window != nil {
|
|
||||||
log.Log(WARN, "You already have a window")
|
|
||||||
ls.ready = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Log(WARN, "Creating the Window")
|
|
||||||
ls.window = gadgets.NewBasicWindow(ls.parent, "Linux OS Details")
|
|
||||||
ls.ready = true
|
|
||||||
}
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ls *LinuxStatus) Update() {
|
func (ls *LinuxStatus) Update() {
|
||||||
|
if ls == nil { return }
|
||||||
if !ls.Ready() {
|
if !ls.Ready() {
|
||||||
log.Log(WARN, "can't update yet. ready is false")
|
log.Log(WARN, "can't update yet. ready is false")
|
||||||
log.Error(errors.New("Update() is not ready yet"))
|
log.Error(errors.New("Update() is not ready yet"))
|
||||||
|
|
Loading…
Reference in New Issue