general improvments
better window open debugger works again new go mod Signed-off-by: Jeff Carr <jcarr@wit.com> Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
8a655d64a3
commit
c00143ec9d
3
Makefile
3
Makefile
|
@ -4,6 +4,9 @@ all:
|
||||||
@echo
|
@echo
|
||||||
@# ./myrepos >/tmp/myrepos.stderr 2>&1
|
@# ./myrepos >/tmp/myrepos.stderr 2>&1
|
||||||
|
|
||||||
|
goimports:
|
||||||
|
goimports -w *.go
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
|
|
20
draw.go
20
draw.go
|
@ -39,6 +39,8 @@ func (d *LogSettings) draw() {
|
||||||
var g *gui.Node
|
var g *gui.Node
|
||||||
|
|
||||||
d.win = gadgets.NewBasicWindow(d.parent, "Debug Flags")
|
d.win = gadgets.NewBasicWindow(d.parent, "Debug Flags")
|
||||||
|
d.win.Make()
|
||||||
|
d.win.Draw()
|
||||||
g = d.win.Box().NewGroup("Show").Pad()
|
g = d.win.Box().NewGroup("Show").Pad()
|
||||||
g = g.NewBox("bw vbox", false)
|
g = g.NewBox("bw vbox", false)
|
||||||
d.buttonG = g
|
d.buttonG = g
|
||||||
|
@ -50,7 +52,7 @@ func (d *LogSettings) draw() {
|
||||||
g.NewButton("restore defaults", func() {
|
g.NewButton("restore defaults", func() {
|
||||||
for _, wg := range myLogGui.groups {
|
for _, wg := range myLogGui.groups {
|
||||||
for _, f := range wg.flags {
|
for _, f := range wg.flags {
|
||||||
f.SetDefault()
|
f.RestoreDefault()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -58,7 +60,7 @@ func (d *LogSettings) draw() {
|
||||||
g.NewButton("all on", func() {
|
g.NewButton("all on", func() {
|
||||||
for _, wg := range myLogGui.groups {
|
for _, wg := range myLogGui.groups {
|
||||||
for _, f := range wg.flags {
|
for _, f := range wg.flags {
|
||||||
f.Set(true)
|
f.SetValue(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -66,7 +68,7 @@ func (d *LogSettings) draw() {
|
||||||
g.NewButton("all off", func() {
|
g.NewButton("all off", func() {
|
||||||
for _, wg := range myLogGui.groups {
|
for _, wg := range myLogGui.groups {
|
||||||
for _, f := range wg.flags {
|
for _, f := range wg.flags {
|
||||||
f.Set(false)
|
f.SetValue(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -77,7 +79,7 @@ func (d *LogSettings) draw() {
|
||||||
for s, wg := range myLogGui.groups {
|
for s, wg := range myLogGui.groups {
|
||||||
log.Info("Dump Flags", s)
|
log.Info("Dump Flags", s)
|
||||||
for _, f := range wg.flags {
|
for _, f := range wg.flags {
|
||||||
log.Info("Dump Flags\t", f.Get(), f.Name, ":", f.Desc)
|
log.Info("Dump Flags\t", f.Bool(), f.GetName(), ":", f.GetDesc())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -112,13 +114,11 @@ func addFlag(p *gui.Node, newf *log.LogFlag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
subsys := newf.GetSubsystem()
|
subsys := newf.GetSubsystem()
|
||||||
name := newf.GetName()
|
|
||||||
|
|
||||||
if myLogGui.groups[subsys] == nil {
|
if myLogGui.groups[subsys] == nil {
|
||||||
flagWidgets = new(flagGroup)
|
flagWidgets = new(flagGroup)
|
||||||
flagWidgets.parent = p
|
flagWidgets.parent = p
|
||||||
flagWidgets.name = subsys
|
flagWidgets.group = p.NewGroup(newf.GetSubsystem())
|
||||||
flagWidgets.group = p.NewGroup(subsys)
|
|
||||||
flagWidgets.grid = flagWidgets.group.NewGrid("flags grid", 3, 1)
|
flagWidgets.grid = flagWidgets.group.NewGrid("flags grid", 3, 1)
|
||||||
myLogGui.groups[subsys] = flagWidgets
|
myLogGui.groups[subsys] = flagWidgets
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,19 +126,17 @@ func addFlag(p *gui.Node, newf *log.LogFlag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range flagWidgets.flags {
|
for _, f := range flagWidgets.flags {
|
||||||
if f.Name == name {
|
if f.GetName() == newf.GetName() {
|
||||||
log.Info("addFlag() FOUND FLAG", f)
|
log.Info("addFlag() FOUND FLAG", f)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Info("addFlag() Adding new flag:", subsys, name)
|
log.Info("addFlag() Adding new flag:", newf.GetSubsystem(), newf.GetName())
|
||||||
newWidget := gadgets.NewLogFlag(flagWidgets.grid, newf)
|
newWidget := gadgets.NewLogFlag(flagWidgets.grid, newf)
|
||||||
flagWidgets.flags = append(flagWidgets.flags, newWidget)
|
flagWidgets.flags = append(flagWidgets.flags, newWidget)
|
||||||
}
|
}
|
||||||
|
|
||||||
type flagGroup struct {
|
type flagGroup struct {
|
||||||
name string // should be set to the flag.Subsystem
|
|
||||||
|
|
||||||
parent *gui.Node // where to draw our group
|
parent *gui.Node // where to draw our group
|
||||||
group *gui.Node
|
group *gui.Node
|
||||||
grid *gui.Node
|
grid *gui.Node
|
||||||
|
|
8
go.mod
8
go.mod
|
@ -3,14 +3,14 @@ module go.wit.com/lib/gui/logsettings
|
||||||
go 1.21.4
|
go 1.21.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
go.wit.com/gui v0.12.16
|
go.wit.com/gui v0.12.19
|
||||||
go.wit.com/lib/gadgets v0.12.10
|
go.wit.com/lib/gadgets v0.12.13
|
||||||
go.wit.com/log v0.5.5
|
go.wit.com/log v0.5.6
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
||||||
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
||||||
go.wit.com/widget v1.1.5 // indirect
|
go.wit.com/widget v1.1.6 // indirect
|
||||||
)
|
)
|
||||||
|
|
16
go.sum
16
go.sum
|
@ -4,11 +4,11 @@ go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26
|
||||||
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
|
||||||
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||||
go.wit.com/gui v0.12.16 h1:GBiPiDyzkGCxwNegehHiONmNppaqyFZv7iteLUHJ/Po=
|
go.wit.com/gui v0.12.19 h1:OEnsnZnec7Q2jZVjwl413V0wuVAAB4r2mGTY0IouBuw=
|
||||||
go.wit.com/gui v0.12.16/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto=
|
go.wit.com/gui v0.12.19/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
|
||||||
go.wit.com/lib/gadgets v0.12.10 h1:zYKQurwuwACir6wTmiYgUprh3AvEX/b7SmEEweLaWOY=
|
go.wit.com/lib/gadgets v0.12.13 h1:CEPUa+rH4VjmxtaWWSqvhgGEhpIjq8zuc01FIJ62xfA=
|
||||||
go.wit.com/lib/gadgets v0.12.10/go.mod h1:Hb/vSiW22hPJjTVA1mShQ6HuqQ7dHGB95WLEfZlPO3M=
|
go.wit.com/lib/gadgets v0.12.13/go.mod h1:u+Syal5qdem7fEikOiEJdI+dO2zOybfa6vZ9ptF+bJ8=
|
||||||
go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4=
|
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
|
||||||
go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||||
go.wit.com/widget v1.1.5 h1:jx5hJ2WLZJnCcvMuaLHegzpNlzwo+0kOkzsRkzRiB30=
|
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=
|
||||||
go.wit.com/widget v1.1.5/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
go.wit.com/widget v1.1.6/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
||||||
|
|
16
settings.go
16
settings.go
|
@ -5,14 +5,26 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func LogWindow() *LogSettings {
|
||||||
|
if myLogGui != nil {
|
||||||
|
myLogGui.Toggle()
|
||||||
|
return myLogGui
|
||||||
|
}
|
||||||
|
myLogGui = NewWindow()
|
||||||
|
myLogGui.draw()
|
||||||
|
myLogGui.win.Toggle()
|
||||||
|
myLogGui.win.Toggle()
|
||||||
|
return myLogGui
|
||||||
|
}
|
||||||
|
|
||||||
// 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 NewWindow() *LogSettings {
|
||||||
if myLogGui != nil {
|
if myLogGui != nil {
|
||||||
return myLogGui
|
return myLogGui
|
||||||
}
|
}
|
||||||
myLogGui = new(LogSettings)
|
myLogGui = new(LogSettings)
|
||||||
myLogGui.parent = p
|
myLogGui.parent = gui.TreeRoot()
|
||||||
myLogGui.groups = make(map[string]*flagGroup)
|
myLogGui.groups = make(map[string]*flagGroup)
|
||||||
myLogGui.ready = true
|
myLogGui.ready = true
|
||||||
myLogGui.hidden = true
|
myLogGui.hidden = true
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// there can be only one per application
|
||||||
var myLogGui *LogSettings
|
var myLogGui *LogSettings
|
||||||
|
|
||||||
type LogSettings struct {
|
type LogSettings struct {
|
||||||
|
|
Loading…
Reference in New Issue