nocui works

release automation testing
    try to track disable state

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-27 10:03:01 -06:00
parent fbd035f5be
commit e1cd1a27a3
4 changed files with 29 additions and 17 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.swp

View File

@ -80,6 +80,11 @@ func ready(n *tree.Node) bool {
return true return true
} }
func hide(n *tree.Node) {
show(n, false)
n.State.Hidden = true
}
func show(n *tree.Node, b bool) { func show(n *tree.Node, b bool) {
if tkbad(n) { if tkbad(n) {
return return
@ -102,14 +107,11 @@ func show(n *tree.Node, b bool) {
} }
func enable(n *tree.Node, b bool) { func enable(n *tree.Node, b bool) {
var tk *guiWidget if !ready(n) {
tk = n.TK.(*guiWidget)
if n == nil {
panic("WHAT? enable was passed nil. How does this even happen?")
}
if tk == nil {
return return
} }
var tk *guiWidget
tk = n.TK.(*guiWidget)
if tk.uiControl == nil { if tk.uiControl == nil {
return return
} }
@ -199,7 +201,16 @@ func processAction(a *widget.Action) {
if a.ActionType == widget.Add { if a.ActionType == widget.Add {
n := add(a) n := add(a)
show(n, !a.State.Hidden) // show(n, !a.State.Hidden)
if a.State.Hidden {
hide(n)
} else {
if a.State.Enable {
// nothing to do
} else {
enable(n, false)
}
}
// pad(n, n.State.Pad) // pad(n, n.State.Pad)
// expand(n, a.State.Expand) // expand(n, a.State.Expand)
return return
@ -238,7 +249,7 @@ func processAction(a *widget.Action) {
case widget.Show: case widget.Show:
show(n, true) show(n, true)
case widget.Hide: case widget.Hide:
show(n, false) hide(n)
case widget.Enable: case widget.Enable:
enable(n, true) enable(n, true)
case widget.Disable: case widget.Disable:

6
go.mod
View File

@ -4,9 +4,9 @@ go 1.21.4
require ( require (
go.wit.com/dev/andlabs/ui v0.0.1 go.wit.com/dev/andlabs/ui v0.0.1
go.wit.com/log v0.5.6 go.wit.com/log v0.13.0
go.wit.com/toolkits/tree v0.13.13 go.wit.com/toolkits/tree v0.13.14
go.wit.com/widget v1.1.7 go.wit.com/widget v1.1.8
) )
require go.wit.com/dev/davecgh/spew v1.1.4 // indirect require go.wit.com/dev/davecgh/spew v1.1.4 // indirect

12
go.sum
View File

@ -2,9 +2,9 @@ go.wit.com/dev/andlabs/ui v0.0.1 h1:SowOybLBu/qUOqp905EZikz5/iPa3GpmnCAPzNOYajM=
go.wit.com/dev/andlabs/ui v0.0.1/go.mod h1:mlKEEe05ZJURzjh1LtjzdGMHVbJm9a7BUaVpA9cHxsM= go.wit.com/dev/andlabs/ui v0.0.1/go.mod h1:mlKEEe05ZJURzjh1LtjzdGMHVbJm9a7BUaVpA9cHxsM=
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/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4= go.wit.com/log v0.13.0 h1:0vyW3mHwDww3wCsyGnmQuX2P4V7aBMoJgxCy0GfA20g=
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo= go.wit.com/log v0.13.0/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/toolkits/tree v0.13.13 h1:2/3hTZ7mMxbxsFnIgknySEbTdX/cHxpdHqK5xUoP7fI= go.wit.com/toolkits/tree v0.13.14 h1:Hy1tbgSL67rvlXkPCz65CDq03i2VeilL95gtOpkzOpo=
go.wit.com/toolkits/tree v0.13.13/go.mod h1:BUJYvkdwGjuyK987nELtZXyqOf4cbMWx+TV+Kon6MtU= go.wit.com/toolkits/tree v0.13.14/go.mod h1:f9ihlbRaORRqgWiqOslfUbLkFRgIjBWY0nG0MidHC7g=
go.wit.com/widget v1.1.7 h1:Gy84I2bD8CMna7NcKBX4sRLR8do6x6mVYX0Ui43f3is= go.wit.com/widget v1.1.8 h1:5cHcmfgwCyHjf02Af/9UMrbLhBR7Z/LFAjPuCx4dx5A=
go.wit.com/widget v1.1.7/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ= go.wit.com/widget v1.1.8/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=