summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-13 20:11:06 -0600
committerJeff Carr <[email protected]>2025-02-13 20:11:06 -0600
commitede7c71fc73276cd58e1a84138fdfc779609a6f3 (patch)
treed79ffaac85a2674bb4660acc532c7066c191bb28
parenta75f0be4608991a85022981b3e033970ce40abb3 (diff)
subbed in Tables()
-rw-r--r--Makefile2
-rw-r--r--action.go36
-rw-r--r--structs.go3
3 files changed, 37 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 11e9166..bd18c6b 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ goimports:
goimports -w *.go
proto:
- autogenpb --proto widget.proto
+ # autogenpb --proto widget.proto
autogenpb --proto toolkitConfig.proto
clean:
diff --git a/action.go b/action.go
index 3ae03e4..32a11ab 100644
--- a/action.go
+++ b/action.go
@@ -5,6 +5,7 @@
package tree
import (
+ "go.wit.com/lib/protobuf/guipb"
"go.wit.com/log"
"go.wit.com/widget"
)
@@ -71,8 +72,21 @@ func (me *TreeInfo) doAction(a widget.Action) {
log.Log(TREEWARN, "SetChecked() not supported on widget", n.WidgetType, n.String())
}
case widget.Show:
- n.State.Hidden = false
- me.Show(n)
+ if n.WidgetType == widget.Table {
+ t, err := loadTable(&a)
+ if err != nil {
+ log.Info("unmarshal data failed", err)
+ return
+ }
+ if t == nil {
+ log.Info("unmarshal data failed table == nil")
+ } else {
+ me.ShowTable(nil)
+ }
+ } else {
+ n.State.Hidden = false
+ me.Show(n)
+ }
case widget.Hide:
n.State.Hidden = true
me.Hide(n)
@@ -85,3 +99,21 @@ func (me *TreeInfo) doAction(a widget.Action) {
// me.NodeAction(n, a.ActionType)
}
}
+
+func loadTable(a *widget.Action) (*guipb.Tables, error) {
+ var t *guipb.Tables
+ err := t.Unmarshal(a.TablePB)
+ /*
+ test := NewRepos()
+ if test.Uuid != all.Uuid {
+ log.Log(WARN, "uuids do not match", test.Uuid, all.Uuid)
+ deleteProtobufFile(cfgname)
+ }
+ if test.Version != all.Version {
+ log.Log(WARN, "versions do not match", test.Version, all.Version)
+ deleteProtobufFile(cfgname)
+ }
+ */
+ // log.Log(INFO, cfgname, "protobuf versions and uuid match", all.Uuid, all.Version)
+ return t, err
+}
diff --git a/structs.go b/structs.go
index 06730b7..d012f73 100644
--- a/structs.go
+++ b/structs.go
@@ -7,6 +7,7 @@ package tree
*/
import (
+ "go.wit.com/lib/protobuf/guipb"
"go.wit.com/widget"
)
@@ -29,11 +30,11 @@ type TreeInfo struct {
SetLabel func(*Node, string) // update the "label" (aka "Name") for a widget
SetChecked func(*Node, bool) // set the state of a checkbox
ToolkitClose func() // shutdown and unload the plugin
- ShowTable func(*Node) // attempt at sending a whole table
Show func(*Node) // show a widget
Hide func(*Node) // hide a widget
Enable func(*Node) // enable a widget
Disable func(*Node) // disable a widget
+ ShowTable func(*guipb.Table) // attempt at sending a whole table
// NodeI interface{} // is an interface useful here?
// NodeAction func(*Node, widget.ActionType) // deprecate
}