diff options
| author | Jeff Carr <[email protected]> | 2024-02-09 03:45:49 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-09 03:45:49 -0600 |
| commit | 1d04dfa4bbf35c5fa0893d375ec11cbef8849bf7 (patch) | |
| tree | f5a688a9cd89e798fbe8e10f3f5d18958d231328 | |
| parent | b777dc2b39bf1fadc292b646ae6afde9f0d0c392 (diff) | |
grid.NextRow() plugin counter
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | grid.go | 10 | ||||
| -rw-r--r-- | main.go | 16 | ||||
| -rw-r--r-- | plugin.go | 3 | ||||
| -rw-r--r-- | watchdog.go | 2 |
4 files changed, 29 insertions, 2 deletions
@@ -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 +} @@ -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 { @@ -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() |
