summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-05 12:06:17 -0600
committerJeff Carr <[email protected]>2024-02-05 12:06:17 -0600
commit1e98d2607b0eafb698dc63e7b97d55ecaf416cb5 (patch)
tree001ec93a75bd26668f7312e45b3f21903181ec8f /main.go
parentfea47363e00f9c02497108484500ad40a88f466c (diff)
use the new tree functions
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go49
1 files changed, 46 insertions, 3 deletions
diff --git a/main.go b/main.go
index ae3c6d4..27e61cc 100644
--- a/main.go
+++ b/main.go
@@ -17,8 +17,44 @@ var uiMainUndef bool = true
var uiMain sync.Once
var muAction sync.Mutex
+func queueAction(n *tree.Node, atype widget.ActionType) {
+ ui.QueueMain(func() {
+ newAction(n, atype)
+ })
+}
+
+func queueAdd(n *tree.Node) {
+ ui.QueueMain(func() {
+ newAdd(n)
+ })
+}
+
+func queueSetTitle(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ SetText(n, s)
+ })
+}
+
+func queueSetLabel(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ SetText(n, s)
+ })
+}
+
+func queueSetText(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ SetText(n, s)
+ })
+}
+
+func queueAddText(n *tree.Node, s string) {
+ ui.QueueMain(func() {
+ AddText(n, s)
+ })
+}
+
+/*
func queueMain(currentA widget.Action) {
- /*
// this never happends
defer func() {
if r := recover(); r != nil {
@@ -29,7 +65,6 @@ func queueMain(currentA widget.Action) {
me.myTree.SendToolkitPanic()
}
}()
- */
// andlabs puts this inside the gofunction over there
// probably this should be changed around here
// and only andlabs stuff should be sent there?
@@ -41,6 +76,7 @@ func queueMain(currentA widget.Action) {
processAction(&currentA)
})
}
+*/
func guiMain() {
defer func() {
@@ -79,7 +115,14 @@ func init() {
me.myTree = tree.New()
me.myTree.PluginName = "andlabs"
- me.myTree.ActionFromChannel = queueMain
+ // me.myTree.ActionFromChannel = queueMain
+
+ me.myTree.NodeAction = queueAction
+ me.myTree.Add = queueAdd
+ me.myTree.SetTitle = queueSetTitle
+ me.myTree.SetLabel = queueSetLabel
+ me.myTree.SetText = queueSetText
+ me.myTree.AddText = queueAddText
// TODO: this is messed up. run ui.Main() from the first add? Initialize it with an empty thing first?
// fake out the OS toolkit by making a fake window. This is probably needed for macos & windows