subbed in Tables()
This commit is contained in:
parent
a75f0be460
commit
ede7c71fc7
2
Makefile
2
Makefile
|
@ -15,7 +15,7 @@ goimports:
|
|||
goimports -w *.go
|
||||
|
||||
proto:
|
||||
autogenpb --proto widget.proto
|
||||
# autogenpb --proto widget.proto
|
||||
autogenpb --proto toolkitConfig.proto
|
||||
|
||||
clean:
|
||||
|
|
32
action.go
32
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:
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue