blob: 77c94a4a83c4d6380da757acdbbfa851eb678802 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
package gadgets
import (
"go.wit.com/log"
"go.wit.com/gui"
)
var myLogGui *LogSettings
type LogSettings struct {
ready bool
hidden bool
err error
parent *gui.Node // should be the root of the 'gui' package binary tree
window *gui.Node // our window for displaying the log package settings
group *gui.Node //
grid *gui.Node //
// Primary Directives
status *OneLiner
summary *OneLiner
}
// This is initializes the main DO object
// You can only have one of these
func NewLogSettings(p *gui.Node) *LogSettings {
if myLogGui != nil {return myLogGui}
myLogGui = new(LogSettings)
myLogGui.parent = p
myLogGui.ready = false
myLogGui.window = p.NewWindow("Log Settings")
// make a group label and a grid
myLogGui.group = myLogGui.window.NewGroup("droplets:").Pad()
myLogGui.grid = myLogGui.group.NewGrid("grid", 2, 1).Pad()
myLogGui.ready = true
myLogGui.Hide()
return myLogGui
}
// Returns true if the status is valid
func (d *LogSettings) Ready() bool {
if d == nil {return false}
return d.ready
}
func (d *LogSettings) Show() {
if ! d.Ready() {return}
log.Info("LogSettings.Show() window")
if d.hidden {
d.window.Show()
}
d.hidden = false
}
func (d *LogSettings) Hide() {
if ! d.Ready() {return}
log.Info("LogSettings.Hide() window")
if ! d.hidden {
d.window.Hide()
}
d.hidden = true
}
func (d *LogSettings) Update() bool {
if ! d.Ready() {return false}
return true
}
|