diff options
| author | Jeff Carr <[email protected]> | 2024-01-31 13:34:13 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-31 13:34:13 -0600 | 
| commit | 4641eceda817e822b1e4e096086a2227a04bb3fd (patch) | |
| tree | 5960151642ca54cd30fe574e28b463f44ecaf033 | |
| parent | 1a9b13dda5e13d0786718768443bab4a6916aab9 (diff) | |
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | common.go | 56 | ||||
| -rw-r--r-- | draw.go | 3 | ||||
| -rw-r--r-- | new.go | 26 | ||||
| -rw-r--r-- | update.go | 1 | 
4 files changed, 10 insertions, 76 deletions
@@ -2,7 +2,6 @@  package linuxstatus  import ( -	"go.wit.com/gui"  	"go.wit.com/log"  ) @@ -19,30 +18,6 @@ func (ls *LinuxStatus) Changed() bool {  	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() {  	if !ls.Ready() {  		return @@ -86,34 +61,3 @@ func (ls *LinuxStatus) Ready() bool {  	}  	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) -	} -} @@ -8,9 +8,6 @@ import (  // 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) @@ -2,12 +2,13 @@  package linuxstatus  import ( +	"go.wit.com/gui"  	"go.wit.com/log"  	"go.wit.com/lib/gadgets"  ) -func New() *LinuxStatus { +func NewLinuxStatus(parent *gui.Node) *LinuxStatus {  	if me != nil {  		log.Log(WARN, "You have done New() twice. You can only do this once")  		return me @@ -19,21 +20,12 @@ func New() *LinuxStatus {  	me.ifmap = make(map[int]*IFtype)  	me.ipmap = make(map[string]*IPtype) -	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 +	me.window = gadgets.NewBasicWindow(parent, "OS Hostname Details") +	me.window.Make() +	draw(me) +	me.window.Draw() + +	me.ready = true +	return me  } @@ -9,6 +9,7 @@ import (  )  func (ls *LinuxStatus) Update() { +	if ls == nil { return }  	if !ls.Ready() {  		log.Log(WARN, "can't update yet. ready is false")  		log.Error(errors.New("Update() is not ready yet"))  | 
