dictation-toolbox / Caster

Dragonfly-Based Voice Programming and Accessibility Toolkit
https://dictation-toolbox.github.io/Caster/
Other
340 stars 121 forks source link

Re-factor keyboard dictionaries to keyboard_support #876

Closed LexiconCode closed 3 years ago

LexiconCode commented 3 years ago

Description

Related Issue

None

Motivation and Context

The support files are imported only twice. Once to verify validity of Python on startup and once for all grammars regardless the number of imports of the keyboard support. ButtonDict in the support file now has a clear structure for ordering updates to the dictionary. Both modifier_choice_object and button_dictionary_1 have functions that scoped variables and execution order.

How Has This Been Tested

Testing a number of commands manually. It's too large to test all keyboard keys but it should be representative and function the same as the current master.

note: any fixes with keyboard grammar does not hold modifier keys #877 would need to be carried over to this PR. considered a work in progress until the above issue is resolved.

Types of changes

Checklist

Maintainer/Reviewer Checklist

LexiconCode commented 3 years ago

@kendonB I noticed a keyboard grammar can conflict with the following commands. Perhaps the keyboard grammar should be adapted to replace these commands nav.py

        "<button_dictionary_500_no_prefix_no_modifier> [<nnavi500>]":
            R(Key("%(button_dictionary_500_no_prefix_no_modifier)s")*Repeat(extra='nnavi500'),
              rdescript="press buttons from button_dictionary_500_no_prefix_no_modifier"),
        "<modifier> <button_dictionary_500_modifier> [<nnavi500>]":
            R(Key("%(modifier)s%(button_dictionary_500_modifier)s")*Repeat(extra='nnavi500'),
              rdescript="press modifiers plus buttons from button_dictionary_500_modifier"),
        "<modifier> <button_dictionary_1_modifier>":
            R(Key("%(modifier)s%(button_dictionary_1_modifier)s"),
              rdescript="press modifiers plus buttons from button_dictionary_1_modifier"),