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 13:55:46 -06:00
|
|
|
func (ls *LinuxStatus) Make() {
|
|
|
|
log.Log(CHANGE, "Draw() window")
|
|
|
|
if ! ls.Ready() {return}
|
|
|
|
log.Log(CHANGE, "Draw() window ready =", ls.ready)
|
|
|
|
ls.window.Make()
|
|
|
|
ls.ready = true
|
|
|
|
}
|
2024-01-06 11:12:10 -06:00
|
|
|
func (ls *LinuxStatus) Draw() {
|
2024-01-06 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "Draw() window")
|
2024-01-06 11:12:10 -06:00
|
|
|
if ! ls.Ready() {return}
|
2024-01-06 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "Draw() window ready =", ls.ready)
|
2024-01-06 11:12:10 -06:00
|
|
|
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 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "Show() window")
|
2024-01-06 11:12:10 -06:00
|
|
|
if ! ls.Ready() {return}
|
2024-01-06 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "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 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "Hide() window")
|
2024-01-06 11:12:10 -06:00
|
|
|
if ! ls.Ready() {return}
|
2024-01-06 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "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 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "Toggle() window")
|
2024-01-06 11:12:10 -06:00
|
|
|
if ! ls.Ready() {return}
|
2024-01-06 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "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 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "Ready()")
|
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 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "checking Initialized()")
|
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) {
|
2024-01-06 13:55:46 -06:00
|
|
|
log.Log(CHANGE, "Attempting SetParent")
|
2024-01-06 11:12:10 -06:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|