Closed knausj85 closed 3 years ago
This API isn't final, but one of these might help:
from talon import registry
def commands_updated(_): pass
registry.register('update_commands', commands_update)
from talon import registry
def contexts_updated(): pass
registry.register('post:update_contexts')
registry.register('update_commands', commands_update)
seems to do the trick, thanks.
Using registry.register('post:update_contexts', contexts_updated)
here crashes talon consistently as I switch windows. Since it's not final, I don't know if this merits a bug or not. Can provide log, if desired.
RecursionError: maximum recursion depth exceeresults ded while calling a Python object
I'm guessing you do something, like update a list, in there that triggers a context update. Maybe I'll change the semantics of these events to have one specifically for "a context activated or deactivated"
You're correct, I do update a list. 👍
using the below to update help
registry.register("update_commands", commands_updated)
and switching to "dictation mode" = any .talon file without an explicit mode: command
is still listed in the help, but not actually functional.
Repro:
registry.active_contexts()
, but don't actually work. e.g. formattersIf I add e.g. mode: command
to formatters.talon and follow the same steps, formatters are no longer available.
As far as I can tell, registry.active_contexts()
isn't correctly updated? Something I'm missing, perhaps?
Might be a little confusing for public release, fwiw. Thinking to allow help in dictation mode.
Context active is not the same thing as command active when it comes to command mode
. Closing in favor of https://github.com/talonvoice/beta/issues/100
Currently, help.py uses UI events to update & display active contexts -
https://github.com/knausj85/knausj_talon/blob/819d80f794ebd88ad8334d5448185c2c7d4235c7/code/help.py#L424
Since modes can be changed without application/window changes, this doesn't quite suffice.
I'm thinking it makes sense to provide either a mode changed event, or maybe there's room for some sort of generic contextchanged event to replace the usage of ui_events here?