Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
|
2070927d3b | |
|
ff8d332dff | |
|
90b3ea950d | |
|
839c6c7afa | |
|
683723ab14 | |
|
e5a9c5fcf2 | |
|
8795f91447 | |
|
cd13a5812d | |
|
76ff80483c | |
|
c00143ec9d |
|
@ -0,0 +1,3 @@
|
|||
*.swp
|
||||
go.mod
|
||||
go.sum
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
3
Makefile
3
Makefile
|
@ -4,6 +4,9 @@ all:
|
|||
@echo
|
||||
@# ./myrepos >/tmp/myrepos.stderr 2>&1
|
||||
|
||||
goimports:
|
||||
goimports -w *.go
|
||||
|
||||
redomod:
|
||||
rm -f go.*
|
||||
goimports -w *.go
|
||||
|
|
22
draw.go
22
draw.go
|
@ -39,18 +39,20 @@ func (d *LogSettings) draw() {
|
|||
var g *gui.Node
|
||||
|
||||
d.win = gadgets.NewBasicWindow(d.parent, "Debug Flags")
|
||||
d.win.Make()
|
||||
d.win.Draw()
|
||||
g = d.win.Box().NewGroup("Show").Pad()
|
||||
g = g.NewBox("bw vbox", false)
|
||||
d.buttonG = g
|
||||
|
||||
g.NewButton("Redirect STDOUT to /tmp/", func() {
|
||||
log.SetTmp()
|
||||
// log.SetTmp()
|
||||
})
|
||||
|
||||
g.NewButton("restore defaults", func() {
|
||||
for _, wg := range myLogGui.groups {
|
||||
for _, f := range wg.flags {
|
||||
f.SetDefault()
|
||||
f.RestoreDefault()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -58,7 +60,7 @@ func (d *LogSettings) draw() {
|
|||
g.NewButton("all on", func() {
|
||||
for _, wg := range myLogGui.groups {
|
||||
for _, f := range wg.flags {
|
||||
f.Set(true)
|
||||
f.SetValue(true)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -66,7 +68,7 @@ func (d *LogSettings) draw() {
|
|||
g.NewButton("all off", func() {
|
||||
for _, wg := range myLogGui.groups {
|
||||
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 {
|
||||
log.Info("Dump Flags", s)
|
||||
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()
|
||||
name := newf.GetName()
|
||||
|
||||
if myLogGui.groups[subsys] == nil {
|
||||
flagWidgets = new(flagGroup)
|
||||
flagWidgets.parent = p
|
||||
flagWidgets.name = subsys
|
||||
flagWidgets.group = p.NewGroup(subsys)
|
||||
flagWidgets.group = p.NewGroup(newf.GetSubsystem())
|
||||
flagWidgets.grid = flagWidgets.group.NewGrid("flags grid", 3, 1)
|
||||
myLogGui.groups[subsys] = flagWidgets
|
||||
} else {
|
||||
|
@ -126,19 +126,17 @@ func addFlag(p *gui.Node, newf *log.LogFlag) {
|
|||
}
|
||||
|
||||
for _, f := range flagWidgets.flags {
|
||||
if f.Name == name {
|
||||
if f.GetName() == newf.GetName() {
|
||||
log.Info("addFlag() FOUND FLAG", f)
|
||||
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)
|
||||
flagWidgets.flags = append(flagWidgets.flags, newWidget)
|
||||
}
|
||||
|
||||
type flagGroup struct {
|
||||
name string // should be set to the flag.Subsystem
|
||||
|
||||
parent *gui.Node // where to draw our group
|
||||
group *gui.Node
|
||||
grid *gui.Node
|
||||
|
|
16
go.mod
16
go.mod
|
@ -1,16 +0,0 @@
|
|||
module go.wit.com/lib/gui/logsettings
|
||||
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
go.wit.com/gui v0.12.16
|
||||
go.wit.com/lib/gadgets v0.12.10
|
||||
go.wit.com/log v0.5.5
|
||||
)
|
||||
|
||||
require (
|
||||
go.wit.com/dev/alexflint/arg v1.4.5 // indirect
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
|
||||
go.wit.com/dev/davecgh/spew v1.1.4 // indirect
|
||||
go.wit.com/widget v1.1.5 // indirect
|
||||
)
|
14
go.sum
14
go.sum
|
@ -1,14 +0,0 @@
|
|||
go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
|
||||
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
|
||||
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
|
||||
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/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
|
||||
go.wit.com/gui v0.12.16 h1:GBiPiDyzkGCxwNegehHiONmNppaqyFZv7iteLUHJ/Po=
|
||||
go.wit.com/gui v0.12.16/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto=
|
||||
go.wit.com/lib/gadgets v0.12.10 h1:zYKQurwuwACir6wTmiYgUprh3AvEX/b7SmEEweLaWOY=
|
||||
go.wit.com/lib/gadgets v0.12.10/go.mod h1:Hb/vSiW22hPJjTVA1mShQ6HuqQ7dHGB95WLEfZlPO3M=
|
||||
go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4=
|
||||
go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
|
||||
go.wit.com/widget v1.1.5 h1:jx5hJ2WLZJnCcvMuaLHegzpNlzwo+0kOkzsRkzRiB30=
|
||||
go.wit.com/widget v1.1.5/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
|
16
settings.go
16
settings.go
|
@ -5,14 +5,26 @@ import (
|
|||
"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
|
||||
// You can only have one of these
|
||||
func New(p *gui.Node) *LogSettings {
|
||||
func NewWindow() *LogSettings {
|
||||
if myLogGui != nil {
|
||||
return myLogGui
|
||||
}
|
||||
myLogGui = new(LogSettings)
|
||||
myLogGui.parent = p
|
||||
myLogGui.parent = gui.TreeRoot()
|
||||
myLogGui.groups = make(map[string]*flagGroup)
|
||||
myLogGui.ready = true
|
||||
myLogGui.hidden = true
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"go.wit.com/lib/gadgets"
|
||||
)
|
||||
|
||||
// there can be only one per application
|
||||
var myLogGui *LogSettings
|
||||
|
||||
type LogSettings struct {
|
||||
|
|
Loading…
Reference in New Issue