updates for a standard plugin code file
This commit is contained in:
parent
6f5944d45f
commit
db0986fa06
1
init.go
1
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)
|
||||
|
|
|
@ -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 (
|
||||
|
|
35
structs.go
35
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 {
|
||||
|
|
31
widget.proto
31
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue