more window handling
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
8b59a3141a
commit
f35ad0837b
|
@ -5,30 +5,37 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (hs *LinuxStatus) Show() {
|
func (ls *LinuxStatus) Show() {
|
||||||
log.Log(CHANGE, "linuxStatus.Show() window")
|
log.Log(CHANGE, "linuxStatus.Show() window")
|
||||||
hs.window.Show()
|
ls.window.Show()
|
||||||
hs.hidden = false
|
ls.hidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hs *LinuxStatus) Hide() {
|
func (ls *LinuxStatus) Hide() {
|
||||||
log.Log(CHANGE, "linuxStatus.Hide() window")
|
log.Log(CHANGE, "linuxStatus.Hide() window")
|
||||||
hs.window.Hide()
|
ls.window.Hide()
|
||||||
hs.hidden = true
|
ls.hidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hs *LinuxStatus) Toggle() {
|
func (ls *LinuxStatus) Toggle() {
|
||||||
log.Log(CHANGE, "linuxStatus.Toggle() window")
|
log.Log(CHANGE, "linuxStatus.Toggle() window")
|
||||||
if hs.hidden {
|
if ls.hidden {
|
||||||
hs.window.Show()
|
ls.window.Show()
|
||||||
} else {
|
} else {
|
||||||
hs.window.Hide()
|
ls.window.Hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hs *LinuxStatus) Ready() bool {
|
func (ls *LinuxStatus) Ready() bool {
|
||||||
if me == nil {return false}
|
if me == nil {return false}
|
||||||
if hs == nil {return false}
|
if ls == nil {return false}
|
||||||
if hs.window == nil {return false}
|
if ls.window == nil {return false}
|
||||||
return me.ready
|
return me.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ls *LinuxStatus) Initialized() bool {
|
||||||
|
if me == nil {return false}
|
||||||
|
if ls == nil {return false}
|
||||||
|
if ls.parent == nil {return false}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
|
@ -2,16 +2,36 @@
|
||||||
package linuxstatus
|
package linuxstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
"go.wit.com/gui/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New() *LinuxStatus {
|
func New() *LinuxStatus {
|
||||||
|
if me != nil {
|
||||||
|
log.Warn("You have done New() twice. You can only do this once")
|
||||||
|
return me
|
||||||
|
}
|
||||||
me = &LinuxStatus {
|
me = &LinuxStatus {
|
||||||
hidden: true,
|
hidden: true,
|
||||||
ready: false,
|
ready: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
me.init = true
|
|
||||||
return me
|
return me
|
||||||
|
}
|
||||||
// me.window = gadgets.NewBasicWindow(me.myGui, "Linux OS Details")
|
|
||||||
|
func (ls *LinuxStatus) InitWindow() {
|
||||||
|
if ! ls.Initialized() {
|
||||||
|
log.Warn("LinuxStatus() is not initalized yet (no parent for the window?)")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ls.window != nil {
|
||||||
|
log.Warn("You already have a window")
|
||||||
|
ls.ready = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ls.ready = true
|
||||||
|
log.Warn("Creating the Window")
|
||||||
|
ls.window = gadgets.NewBasicWindow(ls.parent, "Linux OS Details")
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,14 @@ import (
|
||||||
var me *LinuxStatus
|
var me *LinuxStatus
|
||||||
|
|
||||||
type LinuxStatus struct {
|
type LinuxStatus struct {
|
||||||
init bool
|
ready bool
|
||||||
ready bool
|
hidden bool
|
||||||
hidden bool
|
changed bool
|
||||||
changed bool
|
|
||||||
|
|
||||||
ifmap map[int]*IFtype // the current interfaces
|
parent *gui.Node
|
||||||
ipmap map[string]*IPtype // the current ip addresses
|
|
||||||
|
ifmap map[int]*IFtype // the current interfaces
|
||||||
|
ipmap map[string]*IPtype // the current ip addresses
|
||||||
|
|
||||||
window *gadgets.BasicWindow
|
window *gadgets.BasicWindow
|
||||||
group *gui.Node
|
group *gui.Node
|
||||||
|
|
Loading…
Reference in New Issue