2024-01-06 05:24:11 -06:00
|
|
|
// This creates a simple hello world window
|
|
|
|
package linuxstatus
|
|
|
|
|
|
|
|
import (
|
|
|
|
"go.wit.com/log"
|
2024-01-06 11:12:10 -06:00
|
|
|
"go.wit.com/gui/gui"
|
2024-01-06 05:24:11 -06:00
|
|
|
)
|
|
|
|
|
2024-01-06 11:12:10 -06:00
|
|
|
func (ls *LinuxStatus) Draw() {
|
|
|
|
log.Log(CHANGE, "linuxStatus.Draw() window")
|
|
|
|
if ! ls.Ready() {return}
|
|
|
|
log.Log(CHANGE, "linuxStatus.Draw() window ready =", ls.ready)
|
|
|
|
ls.window.Draw()
|
|
|
|
ls.ready = true
|
|
|
|
}
|
|
|
|
func (ls *LinuxStatus) Draw2() {
|
|
|
|
log.Log(CHANGE, "draw(ls)")
|
|
|
|
if ! ls.Ready() {return}
|
|
|
|
log.Log(CHANGE, "draw(ls) ready =", ls.ready)
|
|
|
|
draw(ls)
|
|
|
|
}
|
|
|
|
|
2024-01-06 05:55:51 -06:00
|
|
|
func (ls *LinuxStatus) Show() {
|
2024-01-06 05:24:11 -06:00
|
|
|
log.Log(CHANGE, "linuxStatus.Show() window")
|
2024-01-06 11:12:10 -06:00
|
|
|
if ! ls.Ready() {return}
|
|
|
|
log.Log(CHANGE, "linuxStatus.Show() window ready =", ls.ready)
|
2024-01-06 05:55:51 -06:00
|
|
|
ls.window.Show()
|
|
|
|
ls.hidden = false
|
2024-01-06 05:24:11 -06:00
|
|
|
}
|
|
|
|
|
2024-01-06 05:55:51 -06:00
|
|
|
func (ls *LinuxStatus) Hide() {
|
2024-01-06 05:24:11 -06:00
|
|
|
log.Log(CHANGE, "linuxStatus.Hide() window")
|
2024-01-06 11:12:10 -06:00
|
|
|
if ! ls.Ready() {return}
|
|
|
|
log.Log(CHANGE, "linuxStatus.Hide() window ready =", ls.ready)
|
2024-01-06 05:55:51 -06:00
|
|
|
ls.window.Hide()
|
|
|
|
ls.hidden = true
|
2024-01-06 05:24:11 -06:00
|
|
|
}
|
|
|
|
|
2024-01-06 05:55:51 -06:00
|
|
|
func (ls *LinuxStatus) Toggle() {
|
2024-01-06 05:24:11 -06:00
|
|
|
log.Log(CHANGE, "linuxStatus.Toggle() window")
|
2024-01-06 11:12:10 -06:00
|
|
|
if ! ls.Ready() {return}
|
|
|
|
log.Log(CHANGE, "linuxStatus.Toggle() window ready =", ls.ready)
|
2024-01-06 05:55:51 -06:00
|
|
|
if ls.hidden {
|
2024-01-06 11:12:10 -06:00
|
|
|
ls.Show()
|
2024-01-06 05:24:11 -06:00
|
|
|
} else {
|
2024-01-06 11:12:10 -06:00
|
|
|
ls.Hide()
|
2024-01-06 05:24:11 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-06 05:55:51 -06:00
|
|
|
func (ls *LinuxStatus) Ready() bool {
|
2024-01-06 11:12:10 -06:00
|
|
|
log.Log(CHANGE, "Ready() ls =", ls)
|
2024-01-06 05:24:11 -06:00
|
|
|
if me == nil {return false}
|
2024-01-06 05:55:51 -06:00
|
|
|
if ls == nil {return false}
|
|
|
|
if ls.window == nil {return false}
|
2024-01-06 05:24:11 -06:00
|
|
|
return me.ready
|
|
|
|
}
|
2024-01-06 05:55:51 -06:00
|
|
|
|
|
|
|
func (ls *LinuxStatus) Initialized() bool {
|
2024-01-06 11:12:10 -06:00
|
|
|
log.Log(CHANGE, "checking Initialized() ls =", ls)
|
2024-01-06 05:55:51 -06:00
|
|
|
if me == nil {return false}
|
|
|
|
if ls == nil {return false}
|
|
|
|
if ls.parent == nil {return false}
|
|
|
|
return true
|
|
|
|
}
|
2024-01-06 11:12:10 -06:00
|
|
|
|
|
|
|
func (ls *LinuxStatus) SetParent(p *gui.Node) {
|
|
|
|
log.Log(CHANGE, "Attempting SetParent =", p)
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|