parent
b0ddd6af21
commit
f3da30a919
24
draw.go
24
draw.go
|
@ -1,9 +1,9 @@
|
||||||
package logsettings
|
package logsettings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/log"
|
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: make sure this works without needing to be shown
|
// TODO: make sure this works without needing to be shown
|
||||||
|
@ -12,18 +12,24 @@ import (
|
||||||
// this is a test commit to tag this as v0.10
|
// this is a test commit to tag this as v0.10
|
||||||
|
|
||||||
func (d *LogSettings) Show() {
|
func (d *LogSettings) Show() {
|
||||||
if ! d.Ready() { return }
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
d.win.Show()
|
d.win.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *LogSettings) Hide() {
|
func (d *LogSettings) Hide() {
|
||||||
if ! d.Ready() { return }
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
d.win.Hide()
|
d.win.Hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
// alternates between showing and hiding the window
|
// alternates between showing and hiding the window
|
||||||
func (d *LogSettings) Toggle() {
|
func (d *LogSettings) Toggle() {
|
||||||
if ! d.Ready() { return }
|
if !d.Ready() {
|
||||||
|
return
|
||||||
|
}
|
||||||
d.win.Toggle()
|
d.win.Toggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,8 +104,12 @@ func (d *LogSettings) draw() {
|
||||||
|
|
||||||
func addFlag(p *gui.Node, newf *log.LogFlag) {
|
func addFlag(p *gui.Node, newf *log.LogFlag) {
|
||||||
var flagWidgets *flagGroup
|
var flagWidgets *flagGroup
|
||||||
if newf == nil { return }
|
if newf == nil {
|
||||||
if p == nil { return }
|
return
|
||||||
|
}
|
||||||
|
if p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
subsys := newf.GetSubsystem()
|
subsys := newf.GetSubsystem()
|
||||||
name := newf.GetName()
|
name := newf.GetName()
|
||||||
|
|
20
settings.go
20
settings.go
|
@ -1,14 +1,16 @@
|
||||||
package logsettings
|
package logsettings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/log"
|
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This initializes the main object
|
// This initializes the main object
|
||||||
// You can only have one of these
|
// You can only have one of these
|
||||||
func New(p *gui.Node) *LogSettings {
|
func New(p *gui.Node) *LogSettings {
|
||||||
if myLogGui != nil {return myLogGui}
|
if myLogGui != nil {
|
||||||
|
return myLogGui
|
||||||
|
}
|
||||||
myLogGui = new(LogSettings)
|
myLogGui = new(LogSettings)
|
||||||
myLogGui.parent = p
|
myLogGui.parent = p
|
||||||
myLogGui.groups = make(map[string]*flagGroup)
|
myLogGui.groups = make(map[string]*flagGroup)
|
||||||
|
@ -19,16 +21,22 @@ func New(p *gui.Node) *LogSettings {
|
||||||
|
|
||||||
// Returns true if the status is valid
|
// Returns true if the status is valid
|
||||||
func (d *LogSettings) Ready() bool {
|
func (d *LogSettings) Ready() bool {
|
||||||
if d == nil {return false}
|
if d == nil {
|
||||||
if ! d.parent.Ready() {return false}
|
return false
|
||||||
if (d.win == nil) {
|
}
|
||||||
|
if !d.parent.Ready() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if d.win == nil {
|
||||||
d.draw()
|
d.draw()
|
||||||
}
|
}
|
||||||
return d.ready
|
return d.ready
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *LogSettings) Update() bool {
|
func (d *LogSettings) Update() bool {
|
||||||
if ! d.Ready() {return false}
|
if !d.Ready() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package logsettings
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
var myLogGui *LogSettings
|
var myLogGui *LogSettings
|
||||||
|
|
Loading…
Reference in New Issue