summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go53
1 files changed, 34 insertions, 19 deletions
diff --git a/main.go b/main.go
index add53a2..dd9a08c 100644
--- a/main.go
+++ b/main.go
@@ -18,11 +18,13 @@ import (
var VERSION string
var BUILDTIME string
+var PLUGIN string = "andlabs"
+
var uiMainUndef bool = true
var uiMain sync.Once
var muAction sync.Mutex
-func queueAction(n *tree.Node, atype widget.ActionType) {
+func newaction(n *tree.Node, atype widget.ActionType) {
ui.QueueMain(func() {
newAction(n, atype)
})
@@ -34,37 +36,43 @@ func queueAdd(n *tree.Node) {
})
}
-func queueSetTitle(n *tree.Node, s string) {
+func setTitle(n *tree.Node, s string) {
ui.QueueMain(func() {
SetText(n, s)
})
}
-func queueSetLabel(n *tree.Node, s string) {
+func setLabel(n *tree.Node, s string) {
ui.QueueMain(func() {
SetText(n, s)
})
}
-func queueSetText(n *tree.Node, s string) {
+func showTable(n *tree.Node) {
+ ui.QueueMain(func() {
+ log.Info("show table here")
+ })
+}
+
+func realSetText(n *tree.Node, s string) {
ui.QueueMain(func() {
SetText(n, s)
})
}
-func queueAddText(n *tree.Node, s string) {
+func realAddText(n *tree.Node, s string) {
ui.QueueMain(func() {
AddText(n, s)
})
}
-func queueSetChecked(n *tree.Node, b bool) {
+func realSetChecked(n *tree.Node, b bool) {
ui.QueueMain(func() {
setChecked(n, b)
})
}
-func queueToolkitClose() {
+func toolkitClose() {
ui.QueueMain(func() {
ui.Quit()
})
@@ -112,6 +120,8 @@ func guiMain() {
// that is supposed to be displayed
placeholderUI()
+ me.myTree.InitOK()
+
// if nothing is working, run this instead to make
// sure you have something
// demoUI()
@@ -123,25 +133,30 @@ func Init() {
}
// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc
-func init() {
+func initPlugin() {
log.Log(INFO, "Init() START")
log.Log(INFO, "Init()")
// Can you pass values to a plugin init() ? Otherwise, there is no way to safely print
// log.Log(INFO, "init() Setting defaultBehavior = true")
// setDefaultBehavior(true)
- me.myTree = tree.New()
- me.myTree.PluginName = "andlabs"
- // me.myTree.ActionFromChannel = queueMain
+ me.myTree = initTree()
+
+ // me.ok = true // this tells init() it's okay to work with gocui
+ /*
+ me.myTree = tree.New()
+ me.myTree.PluginName = "andlabs"
+ // 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
- me.myTree.SetChecked = queueSetChecked
- me.myTree.ToolkitClose = queueToolkitClose
+ me.myTree.NodeAction = queueAction
+ me.myTree.Add = queueAdd
+ me.myTree.SetTitle = queueSetTitle
+ me.myTree.SetLabel = queueSetLabel
+ me.myTree.SetText = queueSetText
+ me.myTree.AddText = queueAddText
+ me.myTree.SetChecked = queueSetChecked
+ me.myTree.ToolkitClose = queueToolkitClose
+ */
// 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