summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-05 15:02:09 -0600
committerJeff Carr <[email protected]>2024-02-05 15:02:09 -0600
commita57a8b5a6348a9142088a0170a3682cdc0ecdb23 (patch)
tree618771ba9ba68d612a981b4fa0fa475304b15267
parent8fcf5f668b182bd382b489cd19cfdcd59628b279 (diff)
prepare for protobufv0.20.0
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--action.go7
-rw-r--r--addText.go2
-rw-r--r--common.go13
-rw-r--r--debug.go4
-rw-r--r--main.go2
-rw-r--r--node.go9
-rw-r--r--setText.go14
-rw-r--r--structs.go5
-rw-r--r--textbox.go4
-rw-r--r--watchdog.go1
-rw-r--r--window.go1
11 files changed, 33 insertions, 29 deletions
diff --git a/action.go b/action.go
index 36ac8e0..d60e982 100644
--- a/action.go
+++ b/action.go
@@ -60,7 +60,10 @@ func getNewAction(n *Node, atype widget.ActionType) *widget.Action {
// set state
a.State.ProgName = n.progname
a.State.Label = n.label
- a.State.Value = n.value
+ // a.State.Value = n.value
+ a.State.DefaultS = n.defaultS
+ a.State.CurrentS = n.currentS
+ a.State.NewString = n.newString
a.State.Checked = n.checked
a.State.Visable = n.visable
@@ -79,7 +82,7 @@ func getNewAction(n *Node, atype widget.ActionType) *widget.Action {
a.State.Range.High = n.Y
a.ProgName = n.progname
- a.Value = n.value
+ // a.Value = n.value
a.Direction = n.direction
// These should be improved/deprecated based on the gui/widget docs
diff --git a/addText.go b/addText.go
index 1e6a07d..7b01066 100644
--- a/addText.go
+++ b/addText.go
@@ -17,7 +17,7 @@ func (n *Node) addText(newS string) {
}
}
n.strings[newS] = highest + 1 // TODO: use the int's for the order
- n.value = newS
+ n.newString = newS
/*
// time.Sleep(time.Duration(1000 * time.Nanosecond)) // doesn't work
// maybe this stupid chipset is defective. TODO: try on different hardware
diff --git a/common.go b/common.go
index fd9d3b5..3196573 100644
--- a/common.go
+++ b/common.go
@@ -99,7 +99,7 @@ func (n *Node) Bool() bool {
default:
}
- return widget.GetBool(n.value)
+ return false
}
func (n *Node) Int() int {
@@ -107,14 +107,13 @@ func (n *Node) Int() int {
return -1
}
- return widget.GetInt(n.value)
+ return -1
}
func (n *Node) SetBool(b bool) {
switch n.WidgetType {
case widget.Checkbox:
n.checked = b
- n.value = b
default:
log.Warn("WidgetType not bool", n.WidgetType, n.id)
}
@@ -123,7 +122,7 @@ func (n *Node) SetBool(b bool) {
func (n *Node) SetInt(i int) {
switch n.WidgetType {
default:
- n.value = i
+ // n.value = i
// log.Warn("WidgetType not bool", n.WidgetType, n.id)
}
}
@@ -144,7 +143,7 @@ func (n *Node) String() string {
default:
}
- return widget.GetString(n.value)
+ return widget.GetString(n.currentS)
}
func (n *Node) Strings() []string {
@@ -181,8 +180,8 @@ func (n *Node) AppendText(str string) {
if !n.Ready() {
return
}
- tmp := widget.GetString(n.value) + str
- n.value = tmp
+ tmp := n.currentS + str
+ n.newString = tmp
n.changed = true
// inform the toolkits
diff --git a/debug.go b/debug.go
index ce9eb88..13901b0 100644
--- a/debug.go
+++ b/debug.go
@@ -64,10 +64,10 @@ func (n *Node) dumpWidget(b bool) string {
if b {
switch n.WidgetType {
case widget.Combobox:
- logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.value)
+ logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.currentS)
logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.strings)
case widget.Dropdown:
- logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.value)
+ logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.currentS)
logindent(b, listChildrenDepth, defaultPadding, " Dropdown", n.strings)
case widget.Grid:
logindent(b, listChildrenDepth, defaultPadding, " GridSize =", n.X, n.Y)
diff --git a/main.go b/main.go
index 3fabc6c..868879d 100644
--- a/main.go
+++ b/main.go
@@ -143,7 +143,7 @@ func (n *Node) gotUserEvent(a widget.Action) {
default:
}
- n.value = a.Value
+ n.currentS = a.State.CurrentS
log.Log(CHANGE, "gotUserEvent() n.Bool() =", n.Bool(), "n.String() =", n.String())
if n.Custom == nil {
log.Log(CHANGE, "a Custom() function was not set for this widget")
diff --git a/node.go b/node.go
index 947e6e3..c198f1b 100644
--- a/node.go
+++ b/node.go
@@ -13,7 +13,7 @@ and it initializes basic default values
there isn't much to see here.
*/
-func (n *Node) newNode(title string, t widget.WidgetType) *Node {
+func (n *Node) newNode(s string, t widget.WidgetType) *Node {
if n == nil {
log.Warn("newNode got parent == nil")
panic("gui newNode")
@@ -21,8 +21,11 @@ func (n *Node) newNode(title string, t widget.WidgetType) *Node {
var newN *Node
newN = addNode()
- newN.progname = title
- newN.value = title
+ newN.progname = s
+ newN.label = s
+ newN.defaultS = s
+ newN.newString = s
+ newN.currentS = s
newN.WidgetType = t
newN.strings = make(map[string]int)
diff --git a/setText.go b/setText.go
index c1baf88..6194351 100644
--- a/setText.go
+++ b/setText.go
@@ -16,10 +16,6 @@ func (n *Node) SetLabel(label string) *Node {
n.label = label
case widget.Button:
n.label = label
- case widget.Combobox:
- n.label = label
- case widget.Dropdown:
- n.label = label
case widget.Label:
n.label = label
case widget.Group:
@@ -30,7 +26,7 @@ func (n *Node) SetLabel(label string) *Node {
}
n.changed = true
- log.Log(CHANGE, "SetLabel() value =", label)
+ log.Log(CHANGE, "SetLabel() =", label)
// inform the toolkits
sendAction(n, widget.SetText)
@@ -40,7 +36,7 @@ func (n *Node) SetLabel(label string) *Node {
// What "SetText" means depends on the type of widget
// should this be a different name?
func (n *Node) SetText(text string) *Node {
- n.value = text
+ n.newString = text
n.changed = true
log.Log(CHANGE, "SetText() text =", text)
@@ -54,15 +50,15 @@ func (n *Node) SetText(text string) *Node {
case widget.Group:
n.label = text
case widget.Combobox:
- n.label = text
+ n.newString = text
case widget.Dropdown:
- n.label = text
+ n.newString = text
case widget.Window:
n.label = text
default:
}
// inform the toolkits
- sendAction(n, widget.Set)
+ sendAction(n, widget.SetText)
return n
}
diff --git a/structs.go b/structs.go
index 986aa5e..c82cd69 100644
--- a/structs.go
+++ b/structs.go
@@ -96,7 +96,10 @@ type Node struct {
WidgetType widget.WidgetType
// most widgets need one value, this is current alue
- value any
+ // value any
+ defaultS string
+ newString string
+ currentS string
//
label string
diff --git a/textbox.go b/textbox.go
index b306ec6..782c705 100644
--- a/textbox.go
+++ b/textbox.go
@@ -8,7 +8,7 @@ import (
func (parent *Node) NewTextbox(name string) *Node {
newNode := parent.newNode(name, widget.Textbox)
- newNode.value = name
+ newNode.defaultS = name
newNode.progname = name
newNode.Custom = func() {
@@ -22,7 +22,7 @@ func (parent *Node) NewTextbox(name string) *Node {
func (parent *Node) NewEntryLine(name string) *Node {
newNode := parent.newNode(name, widget.Textbox)
- newNode.value = name
+ newNode.defaultS = name
newNode.progname = name
newNode.X = 1
diff --git a/watchdog.go b/watchdog.go
index 121e91b..e27a31e 100644
--- a/watchdog.go
+++ b/watchdog.go
@@ -19,6 +19,7 @@ func Watchdog() {
myTicker(10*time.Second, "WATCHDOG", func() {
i += 1
log.Log(INFO, "myTicker() ticked", i)
+ me.rootNode.ListToolkits()
})
}
diff --git a/window.go b/window.go
index 78fb188..c805e47 100644
--- a/window.go
+++ b/window.go
@@ -29,7 +29,6 @@ func (parent *Node) NewWindow(title string) *Node {
log.Log(INFO, "NewWindow()", title)
newNode.progname = title
newNode.label = title
- newNode.value = title
newNode.margin = true
newNode.visable = true
newNode.hidden = false