diff --git a/init.go b/init.go index 0aaba86..0a94b3e 100644 --- a/init.go +++ b/init.go @@ -36,6 +36,7 @@ func (me *TreeInfo) newAction(a widget.Action) { // log.Log(TREEWARN, "tree.FindWidgetId() n == nil. A bug in your application?") return } + switch a.ActionType { case widget.SetText: log.Log(TREE, "tree.SetText() a.State.CurrentS =", a.State.CurrentS) diff --git a/plugin.go b/plugin.go index 1498880..61ae47f 100644 --- a/plugin.go +++ b/plugin.go @@ -6,9 +6,6 @@ package tree There are some helper functions that are probably going to be the same everywhere. Mostly due to handling the binary tree structure and the channel communication - - For now, it's just a symlink to the 'master' version in - ./toolkit/nocui/common.go */ import ( diff --git a/structs.go b/structs.go index eb76f39..c4792b7 100644 --- a/structs.go +++ b/structs.go @@ -17,27 +17,20 @@ import ( var treeRoot *Node type TreeInfo struct { - PluginName string - config *ToolkitConfigs - - // this is the channel we send user events like - // mouse clicks or keyboard events back to the program - callback chan widget.Action - - // this is the channel we get requests to make widgets - pluginChan chan widget.Action - - // NodeI interface{} - - // ActionFromChannel func(widget.Action) - NodeAction func(*Node, widget.ActionType) - Add func(*Node) - AddText func(*Node, string) - SetText func(*Node, string) - SetTitle func(*Node, string) - SetLabel func(*Node, string) - SetChecked func(*Node, bool) - ToolkitClose func() + PluginName string // used to identify the plugin + config *ToolkitConfigs // protobuf of plugin settings + callback chan widget.Action // mouse clicks or keyboard events back to the program + pluginChan chan widget.Action // this is the channel we get requests to make widgets + NodeAction func(*Node, widget.ActionType) // deprecate + Add func(*Node) // add a new widget + AddText func(*Node, string) // add a string to a dropdown widget + SetText func(*Node, string) // set the text of a widget + SetTitle func(*Node, string) // update the title of a window or tab + 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 + // NodeI interface{} // is an interface useful here? } type Node struct { diff --git a/config.go b/toolkitConfig.save.go similarity index 100% rename from config.go rename to toolkitConfig.save.go diff --git a/widget.proto b/widget.proto index 371c288..25265a7 100644 --- a/widget.proto +++ b/widget.proto @@ -5,32 +5,35 @@ syntax = "proto3"; package main; import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp +import "google/protobuf/any.proto"; // Import 'Any' + message Size { - int64 width = 1; - int64 height = 2; + int64 width = 1; + int64 height = 2; } message Location { - int64 x = 1; - int64 y = 2; + int64 x = 1; + int64 y = 2; } message Tree { - Widget parent = 1; - repeated Widget children = 2; + Widget parent = 1; + repeated Widget children = 2; } message Widget { - int64 id = 1; - string name = 2; - Size size = 3; - Location location = 4; - string color = 5; + int64 id = 1; + string name = 2; + Size size = 3; + Location location = 4; + string color = 5; + google.protobuf.Any TK = 6; } message Widgets { - string uuid = 1; // `autogenpb:uuid:0331fcd7-3c8c-43e4-be1b-77db6a6bc58c` - string version = 2; // `autogenpb:version:v1` - repeated Widget Widgets = 3; + string uuid = 1; // `autogenpb:uuid:0331fcd7-3c8c-43e4-be1b-77db6a6bc58c` + string version = 2; // `autogenpb:version:v1` + repeated Widget Widgets = 3; }