Compare commits

...

10 Commits

Author SHA1 Message Date
Jeff Carr 2070927d3b disable mucking with STDOUT 2024-02-12 15:22:38 -06:00
Jeff Carr ff8d332dff golang license
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-30 16:18:42 -06:00
Jeff Carr 90b3ea950d testing go
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-29 13:53:34 -06:00
Jeff Carr 839c6c7afa go testing
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-29 12:35:44 -06:00
Jeff Carr 683723ab14 release automation working so far
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-27 12:59:16 -06:00
Jeff Carr e5a9c5fcf2 release automation testing
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-27 10:59:17 -06:00
Jeff Carr 8795f91447 release version failure
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-26 11:45:51 -06:00
Jeff Carr cd13a5812d new gui
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-26 11:14:29 -06:00
Jeff Carr 76ff80483c new gui
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-24 17:16:19 -06:00
Jeff Carr c00143ec9d 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>
2024-01-20 20:04:05 -06:00
8 changed files with 58 additions and 44 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.swp
go.mod
go.sum

27
LICENSE Normal file
View File

@ -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.

View File

@ -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
View File

@ -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
View File

@ -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
View File

@ -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=

View File

@ -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

View File

@ -5,6 +5,7 @@ import (
"go.wit.com/lib/gadgets"
)
// there can be only one per application
var myLogGui *LogSettings
type LogSettings struct {