summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-09 03:45:49 -0600
committerJeff Carr <[email protected]>2024-02-09 03:45:49 -0600
commit1d04dfa4bbf35c5fa0893d375ec11cbef8849bf7 (patch)
treef5a688a9cd89e798fbe8e10f3f5d18958d231328
parentb777dc2b39bf1fadc292b646ae6afde9f0d0c392 (diff)
grid.NextRow() plugin counter
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--grid.go10
-rw-r--r--main.go16
-rw-r--r--plugin.go3
-rw-r--r--watchdog.go2
4 files changed, 29 insertions, 2 deletions
diff --git a/grid.go b/grid.go
index 66bd375..297a723 100644
--- a/grid.go
+++ b/grid.go
@@ -89,3 +89,13 @@ func (n *Node) At(w int, h int) *Node {
}
return n
}
+
+func (n *Node) NextRow() *Node {
+ if n == nil {
+ return n
+ }
+
+ n.NextW = 1
+ n.NextH += 1
+ return n
+}
diff --git a/main.go b/main.go
index c2cfa1b..3b8dfc5 100644
--- a/main.go
+++ b/main.go
@@ -57,12 +57,28 @@ func (n *Node) findId(i int) *Node {
return nil
}
+func pluginCounter(a *widget.Action) {
+ var found bool = false
+ for _, aplug := range allPlugins {
+ if a.ProgName == aplug.name {
+ aplug.count += 1
+ found = true
+ }
+ }
+ if ! found {
+ // TODO: fix this by making seperate channels for each plugin?
+ log.Log(WARN, "ListToolkits() got event from unidentified plugin")
+ }
+}
+
func watchCallback() {
log.Log(INFO, "guiChan() START")
for {
log.Log(CHANGE, "guiChan() select restarted")
select {
case a := <-me.guiChan:
+ pluginCounter(&a)
+
// 99.9% of events are just widget changes
n := me.rootNode.findId(a.WidgetId)
if n != nil {
diff --git a/plugin.go b/plugin.go
index b387fd1..1f83c52 100644
--- a/plugin.go
+++ b/plugin.go
@@ -19,6 +19,7 @@ var err error
type Symbol any
type aplug struct {
+ count int
name string
filename string
plug *plugin.Plugin
@@ -258,7 +259,7 @@ func (n *Node) LoadToolkitEmbed(name string, b []byte) *Node {
func (n *Node) ListToolkits() {
for _, aplug := range allPlugins {
- log.Log(WARN, "ListToolkits() already loaded toolkit plugin =", aplug.name)
+ log.Log(WARN, "ListToolkits() has plugin =", aplug.name, "i =", aplug.count)
}
}
diff --git a/watchdog.go b/watchdog.go
index 5bd9008..2bd745a 100644
--- a/watchdog.go
+++ b/watchdog.go
@@ -16,7 +16,7 @@ TODO: handle toolkit panics here?
func Watchdog() {
var i = 1
// check the four known things to see if they are all WORKING
- myTicker(10*time.Second, "WATCHDOG", func() {
+ myTicker(30*time.Second, "WATCHDOG", func() {
i += 1
log.Log(INFO, "myTicker() ticked", i)
me.rootNode.ListToolkits()