func name change
This commit is contained in:
parent
b697978b69
commit
e8e36ee802
Notes:
Jeff Carr
2025-02-14 00:47:56 -06:00
// `autogen:go.mod` module go.wit.com/lib/gadgets go 1.22 toolchain go1.23.6 require ( go.wit.com/gui v0.22.26 go.wit.com/log v0.22.16 ) require ( go.wit.com/dev/alexflint/arg v1.5.5 // indirect go.wit.com/dev/alexflint/scalar v1.2.4 // indirect go.wit.com/lib/protobuf/guipb v0.0.2 // indirect go.wit.com/widget v1.1.29 // indirect google.golang.org/protobuf v1.36.5 // indirect ) // `autogen:go.sum` github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= go.wit.com/dev/alexflint/arg v1.5.5 h1:c4jgIb4OvHjnCMRNSjOa1sNLl6WDxV6tIkMVezR9hCk= go.wit.com/dev/alexflint/arg v1.5.5/go.mod h1:nH3F6TJDaAUgnLkC0WgRN/H047YfN1TYKaWPYr6B8lo= go.wit.com/dev/alexflint/scalar v1.2.4 h1:zmBeEkObwz1lcelwfGNYP2GS6SQ9e0tdv7JdHwMZEEk= go.wit.com/dev/alexflint/scalar v1.2.4/go.mod h1:kCNO1Fo5LnnK6+qa+zYhP5fdgfC1C+vx1ti99Md+FAM= go.wit.com/gui v0.22.26 h1:HtdV1kx6wHpCTyS67s2KdMCyX6teNXIQOk1NyX6o8bY= go.wit.com/gui v0.22.26/go.mod h1:6OVZofoS43VNUiQWR0aJkXEcqpuIhERJQnxhdGrEsHo= go.wit.com/lib/protobuf/guipb v0.0.2 h1:ZR4cLy+XheRQEFLlissBmASJDqiLfHaAluF6wYbVuOo= go.wit.com/lib/protobuf/guipb v0.0.2/go.mod h1:mZsirb7zRgsE2IGHuvHkG7j85hkrGZl3NAALOEkjowA= go.wit.com/log v0.22.16 h1:E0Vd0Z2ILtfjhs7J/CQ4g13DK1jtQiYl6l5KOBGsZoA= go.wit.com/log v0.22.16/go.mod h1:/c5Uj30sWRQ4B5ei2ElB6Q8Si/cK6v+KbxnH208KD84= go.wit.com/widget v1.1.29 h1:rURM/N1hbrl0btGlBIUx0SCre9jj+hshvkBLMMa008I= go.wit.com/widget v1.1.29/go.mod h1:wj7TpAr2gk7Poa+v8XQkH1aidnTdgAa/a8GxrMtcztw= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= // `autogen:`
5
Makefile
5
Makefile
|
@ -1,5 +1,5 @@
|
||||||
#a git remote add github git@github.com:wit-go/gadgets.git
|
#a git remote add github git@github.com:wit-go/gadgets.git
|
||||||
all:
|
all: goimports vet
|
||||||
@echo
|
@echo
|
||||||
@echo gadgets are collections of widget primaties that work
|
@echo gadgets are collections of widget primaties that work
|
||||||
@echo in ways that are common enough they are generally useful
|
@echo in ways that are common enough they are generally useful
|
||||||
|
@ -14,6 +14,9 @@ all:
|
||||||
goimports:
|
goimports:
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
|
|
||||||
|
vet:
|
||||||
|
@GO111MODULE=off go vet
|
||||||
|
|
||||||
redomod:
|
redomod:
|
||||||
rm -f go.*
|
rm -f go.*
|
||||||
GO111MODULE= go mod init
|
GO111MODULE= go mod init
|
||||||
|
|
18
logFlag.go
18
logFlag.go
|
@ -32,12 +32,12 @@ type LogFlag struct {
|
||||||
|
|
||||||
// probably a better name than GetValue()
|
// probably a better name than GetValue()
|
||||||
func (f *LogFlag) Bool() bool {
|
func (f *LogFlag) Bool() bool {
|
||||||
if f.lf.Bool() != f.checkbox.Bool() {
|
if f.lf.Enabled() != f.checkbox.Bool() {
|
||||||
log.Error(errors.New("gadget.LogFlag error. actual flag.Bool() does not match checkbox.Bool()"))
|
log.Error(errors.New("gadget.LogFlag error. actual flag.Bool() does not match checkbox.Bool()"))
|
||||||
// set the checkbox to reflect the actual flag value
|
// set the checkbox to reflect the actual flag value
|
||||||
f.checkbox.SetChecked(f.lf.Bool())
|
f.checkbox.SetChecked(f.lf.Enabled())
|
||||||
}
|
}
|
||||||
return f.lf.Bool()
|
return f.lf.Enabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *LogFlag) GetValue() bool {
|
func (f *LogFlag) GetValue() bool {
|
||||||
|
@ -57,10 +57,10 @@ func (f *LogFlag) GetDesc() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *LogFlag) SetValue(b bool) {
|
func (f *LogFlag) SetValue(b bool) {
|
||||||
log.Log(GADGETS, "LogFlag.SetValue() before SetValue() log.flag =", f.lf.Bool(), "checkbox =", f.checkbox.Bool())
|
log.Log(GADGETS, "LogFlag.SetValue() before SetValue() log.flag =", f.lf.Enabled(), "checkbox =", f.checkbox.Bool())
|
||||||
f.checkbox.SetChecked(b)
|
f.checkbox.SetChecked(b)
|
||||||
f.lf.SetBool(b)
|
f.lf.SetBool(b)
|
||||||
log.Log(GADGETS, "LogFlag.SetValue() after SetValue() log.flag =", f.lf.Bool(), "checkbox =", f.checkbox.Bool())
|
log.Log(GADGETS, "LogFlag.SetValue() after SetValue() log.flag =", f.lf.Enabled(), "checkbox =", f.checkbox.Bool())
|
||||||
}
|
}
|
||||||
|
|
||||||
// should be RestoreDefault() ?
|
// should be RestoreDefault() ?
|
||||||
|
@ -94,11 +94,11 @@ func NewLogFlag(n *gui.Node, lf *log.LogFlag) *LogFlag {
|
||||||
f.checkbox.Custom = func() {
|
f.checkbox.Custom = func() {
|
||||||
if counter == 0 {
|
if counter == 0 {
|
||||||
// store the first clicked value
|
// store the first clicked value
|
||||||
watcher = f.lf.Bool()
|
watcher = f.lf.Enabled()
|
||||||
} else {
|
} else {
|
||||||
// if the value has changed, then everything is fine
|
// if the value has changed, then everything is fine
|
||||||
if watcher != f.lf.Bool() {
|
if watcher != f.lf.Enabled() {
|
||||||
watcher = f.lf.Bool()
|
watcher = f.lf.Enabled()
|
||||||
counter = 0
|
counter = 0
|
||||||
}
|
}
|
||||||
// this means the value has not changed 3 times
|
// this means the value has not changed 3 times
|
||||||
|
@ -114,7 +114,7 @@ func NewLogFlag(n *gui.Node, lf *log.LogFlag) *LogFlag {
|
||||||
|
|
||||||
f.lf.SetBool(f.checkbox.Bool())
|
f.lf.SetBool(f.checkbox.Bool())
|
||||||
}
|
}
|
||||||
f.checkbox.SetChecked(lf.Bool())
|
f.checkbox.SetChecked(lf.Enabled())
|
||||||
|
|
||||||
return &f
|
return &f
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue