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