Compare commits
No commits in common. "guimaster" and "v0.10.1" have entirely different histories.
|
@ -1,3 +0,0 @@
|
||||||
*.swp
|
|
||||||
go.mod
|
|
||||||
go.sum
|
|
27
LICENSE
27
LICENSE
|
@ -1,27 +0,0 @@
|
||||||
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,9 +4,6 @@ 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
|
||||||
|
|
22
draw.go
22
draw.go
|
@ -39,20 +39,18 @@ 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
|
||||||
|
|
||||||
g.NewButton("Redirect STDOUT to /tmp/", func() {
|
g.NewButton("Redirect STDOUT to /tmp/", func() {
|
||||||
// log.SetTmp()
|
log.SetTmp()
|
||||||
})
|
})
|
||||||
|
|
||||||
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.RestoreDefault()
|
f.SetDefault()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -60,7 +58,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.SetValue(true)
|
f.Set(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -68,7 +66,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.SetValue(false)
|
f.Set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -79,7 +77,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.Bool(), f.GetName(), ":", f.GetDesc())
|
log.Info("Dump Flags\t", f.Get(), f.Name, ":", f.Desc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -114,11 +112,13 @@ 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.group = p.NewGroup(newf.GetSubsystem())
|
flagWidgets.name = subsys
|
||||||
|
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,17 +126,19 @@ func addFlag(p *gui.Node, newf *log.LogFlag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range flagWidgets.flags {
|
for _, f := range flagWidgets.flags {
|
||||||
if f.GetName() == newf.GetName() {
|
if f.Name == name {
|
||||||
log.Info("addFlag() FOUND FLAG", f)
|
log.Info("addFlag() FOUND FLAG", f)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Info("addFlag() Adding new flag:", newf.GetSubsystem(), newf.GetName())
|
log.Info("addFlag() Adding new flag:", subsys, name)
|
||||||
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
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
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
|
||||||
|
)
|
|
@ -0,0 +1,14 @@
|
||||||
|
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,26 +5,14 @@ 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 NewWindow() *LogSettings {
|
func New(p *gui.Node) *LogSettings {
|
||||||
if myLogGui != nil {
|
if myLogGui != nil {
|
||||||
return myLogGui
|
return myLogGui
|
||||||
}
|
}
|
||||||
myLogGui = new(LogSettings)
|
myLogGui = new(LogSettings)
|
||||||
myLogGui.parent = gui.TreeRoot()
|
myLogGui.parent = p
|
||||||
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,7 +5,6 @@ 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