Compare commits

...

2 Commits

Author SHA1 Message Date
Jeff Carr 391ed60415 add Destroy()
improve syntax shortcuts
    go mod update

Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-15 16:14:48 -06:00
Jeff Carr 7af0ecf8f1 minimal go mod files
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-14 14:51:18 -06:00
7 changed files with 49 additions and 41 deletions

View File

@ -28,20 +28,6 @@ update:
git pull git pull
go get -v -t -u ./... go get -v -t -u ./...
# sync repo to the github backup
# git remote add github git@github.com:wit-go/gui.git
github:
git push origin master
git push origin devel
git push origin --tags
git push github master
git push github devel
git push github --tags
@echo
@echo check https://git.wit.org/gui/gui
@echo check https://github.com/wit-go/gui
@echo
doc: doc:
godoc -v godoc -v

View File

@ -2,7 +2,7 @@ package gui
import ( import (
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/dev/alexflint/go-arg" "go.wit.com/dev/alexflint/arg"
) )
var INFO *log.LogFlag var INFO *log.LogFlag

View File

@ -33,13 +33,19 @@ func (n *Node) Hide() *Node {
if ! n.Ready() { return n } if ! n.Ready() { return n }
if n.Hidden() { return n } if n.Hidden() { return n }
if n.WidgetType == widget.Window { if n.WidgetType == widget.Window {
log.Warn("Hide on a window", n.progname) log.Warn("Hide on a window", n.progname)
log.Warn("this needs to do TestDestroy() ?") log.Warn("this needs to do TestDestroy() ?")
n.Destroy()
n.hidden = true
n.changed = true
return nil
} }
n.hidden = true n.hidden = true
n.changed = true n.changed = true
// inform the toolkits // inform the toolkits
sendAction(n, widget.Hide) sendAction(n, widget.Hide)
return n return n
@ -73,6 +79,18 @@ func (n *Node) Disable() *Node {
return n return n
} }
func (n *Node) Destroy() {
if ! n.Ready() { return }
// if ! n.enabled { return }
n.enabled = false
n.changed = true
// inform the toolkits
sendAction(n, widget.Delete)
return
}
// add a new text string to widgets that support // add a new text string to widgets that support
// multiple string values // multiple string values
@ -128,17 +146,17 @@ func (n *Node) GetBool() bool {
} }
// should get the reference name used for programming and debugging // should get the reference name used for programming and debugging
func (n *Node) SetProgName(s string) { func (n *Node) SetProgName(s string) *Node {
if ! n.Ready() { return } if ! n.Ready() { return n }
if n.progname == s { if n.progname == s {
// don't do anything since nothing changed // don't do anything since nothing changed
return return n
} }
n.changed = true n.changed = true
n.progname = s n.progname = s
return return n
} }
/* /*

8
go.mod
View File

@ -3,12 +3,12 @@ module go.wit.com/gui/gui
go 1.21.4 go 1.21.4
require ( require (
go.wit.com/dev/alexflint/go-arg v1.4.6 go.wit.com/dev/alexflint/arg v1.4.5
go.wit.com/gui/widget v1.1.3 go.wit.com/gui/widget v1.1.3
go.wit.com/log v0.5.3 go.wit.com/log v0.5.4
) )
require ( require (
github.com/alexflint/go-scalar v1.2.0 // indirect go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
go.wit.com/dev/davecgh/spew v1.1.3 // indirect go.wit.com/dev/davecgh/spew v1.1.4 // indirect
) )

25
go.sum
View File

@ -1,19 +1,10 @@
github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw= go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY=
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o= go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.wit.com/dev/alexflint/go-arg v1.4.6 h1:0kxl4YQvC8t89eGIY5e/qPSMKWmLc32aJXF08g8jRlA=
go.wit.com/dev/alexflint/go-arg v1.4.6/go.mod h1:td08jpeZ4vQ/Bu870In78YE2QRrNXhxvY1A34hC7qFo=
go.wit.com/dev/davecgh/spew v1.1.3 h1:hqnB5qsPgC2cLZaJXqQJspQ5n/Ugry9kyL3tLk0hVzQ=
go.wit.com/dev/davecgh/spew v1.1.3/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/gui/widget v1.1.3 h1:GvLzGSOF9tfmoh6HNbFdN+NSlBo2qeS/Ba2TnQQ1A1U= go.wit.com/gui/widget v1.1.3 h1:GvLzGSOF9tfmoh6HNbFdN+NSlBo2qeS/Ba2TnQQ1A1U=
go.wit.com/gui/widget v1.1.3/go.mod h1:A6/FaiFQtAHTjgo7c4FrokXe6bXX1Cowo35b2Lgi31E= go.wit.com/gui/widget v1.1.3/go.mod h1:A6/FaiFQtAHTjgo7c4FrokXe6bXX1Cowo35b2Lgi31E=
go.wit.com/log v0.5.3 h1:/zHkniOPusPEuX1R401rMny9uwSO/nSU/QOMx6qoEnE= go.wit.com/log v0.5.4 h1:vijLRPTUgChb8J5tx/7Uma/lGTUxeSXosFbheAmL914=
go.wit.com/log v0.5.3/go.mod h1:LzIzVxc2xJQxWQBtV9VbV605P4TOxmYDCl+BZF38yGE= go.wit.com/log v0.5.4/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -201,7 +201,6 @@ func initToolkit(name string, filename string) *aplug {
// add it to the list of plugins // add it to the list of plugins
allPlugins = append(allPlugins, newPlug) allPlugins = append(allPlugins, newPlug)
// set the communication to the plugins // set the communication to the plugins
newPlug.pluginChan = newPlug.PluginChannel() newPlug.pluginChan = newPlug.PluginChannel()
if (newPlug.pluginChan == nil) { if (newPlug.pluginChan == nil) {

14
separator.go Normal file
View File

@ -0,0 +1,14 @@
package gui
import (
"go.wit.com/gui/widget"
)
func (parent *Node) NewSeparator(progname string) *Node {
newNode := parent.newNode(progname, widget.Separator)
newNode.progname = progname
// inform the toolkits
sendAction(newNode, widget.Add)
return newNode
}