summaryrefslogtreecommitdiff
path: root/logSettings.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-01 16:19:40 -0600
committerJeff Carr <[email protected]>2024-01-01 16:19:40 -0600
commit7f6059a8e0f83bb4b450c1264195f08fe1280f05 (patch)
tree0c75d2bbbab93c8611bc7ab466a6389485c645b5 /logSettings.go
initial commit
Diffstat (limited to 'logSettings.go')
-rw-r--r--logSettings.go72
1 files changed, 72 insertions, 0 deletions
diff --git a/logSettings.go b/logSettings.go
new file mode 100644
index 0000000..a496ca5
--- /dev/null
+++ b/logSettings.go
@@ -0,0 +1,72 @@
+package gadgets
+
+import (
+ "go.wit.com/log"
+ "go.wit.com/gui/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
+}