Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifier keys #585

Merged
merged 15 commits into from
Jul 9, 2019
Merged

Conversation

alexboche
Copy link
Contributor

@alexboche alexboche commented Jun 19, 2019

I added functionality for <modifier_key> <button> for all the modifier keys and nearly all possible buttons. the modifiers can be spoken as the regular English name or as the caster name (e.g. "control "or "fly"). To press a key without modifiers, say "hit ". The original caster master navigation command # "(<mtn_dir> | <mtn_mode> [<mtn_dir>]) [(<nnavi500> | <extreme>)]": causes some ambiguity with these new commands so I commented it out. All the functionality is preserved except for the ability to say "fly", "shin", "que" without specifying "lease" or "ross" (if you specify the direction those still work fine). I added six new one syllable commands for that purpose (one for each in each direction) (bird, fird, brick, frick, blitch, flitch). I also added "latch", "ratch" which can be used instead of "ross/lease wally" in a stand-alone use or also in cases like "shin ross/lease wally" (you can still say ross/lease wally if you want).

Currently the keys must all be prefaced by a modifier; this could be changed.

Right now I made them all these CCR (and allow some of them to be repeatable to varying degrees). Because the modifier commands have to be prefaced by the modifier I think the risk of misfires is lower than usual. It seems that grammar complexity is a limited resource that CCR commands use up. Given that some of these commands like "control alt insert" may never be used, I think we should not use that resource on them. Thus I think some of these should be made CCR before merging. I have not done so yet because I don't know yet which ones to make CCR and it is simpler to have it this way while I am still getting feedback from the maintainers and the community. In particular, I don't have a good understanding of the grammar complexity error.

To make it easier for people to give feedback on this, I'm including the full key dictionaries and new command names in this comment. The number after button_dictionary_ indicates the number of times the keys there which must be prefaced by modifiers can be repeated:

button_dictionary_500 = {"(tab | tabby)": "tab", "(backspace | clear)": "backspace", "(delete|deli)": "del", "(escape | cancel)": "escape", "(enter | shock)": "enter",
    "(left | lease)": "left", "(right | ross)": "right", "(up | sauce)": "up",
    "(down | dunce)": "down", "page (down | dunce)": "pgdown", "page (up | sauce)": "pgup", "space": "space"}
    button_dictionary_10 = {"function {}".format(i):"f{}".format(i) for i in range(1, 10)}
    button_dictionary_10.update(caster_alphabet)
    button_dictionary_10.update(text_punc_dict)
    button_dictionary_1 = {"(home | lease wally | latch)": "home", "(end | ross wally | ratch)": "end", "insert": "insert", "zero": "0",
    "one": "1", "two": "2", "three": "3", "four": "4", "five": "5", "six":"6", "seven": "7", "eight": "8", "nine": "9"}

Note: the F keys are called "function ".
new command names (old names are preserved, see above):

"(lease wally | latch) [<nnavi10>]": R(Key("home:%(nnavi10)s")),
        "(ross wally | ratch) [<nnavi10>]": R(Key("end:%(nnavi10)s")),
        "bird [<nnavi500>]": R(Key("c-left:%(nnavi500)s")),
        "fird [<nnavi500>]": R(Key("c-right:%(nnavi500)s")),
        "brick [<nnavi500>]": R(Key("s-left:%(nnavi500)s")),
        "frick [<nnavi500>]": R(Key("s-right:%(nnavi500)s")),
        "blitch [<nnavi500>]": R(Key("cs-left:%(nnavi500)s")),
        "flitch [<nnavi500>]": R(Key("cs-right:%(nnavi500)s")),

"(control shift | que)": "cs",
"control alt": "ca",
"(shift alt | alt shift)": "sa",
"(control alt shift | control shift alt)": "csa", # control must go first
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow composition with fly, shin, alt as well. ie "fly alt shin" should be an option

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add "cass" as an option?

Copy link
Contributor Author

@alexboche alexboche Jun 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the shortened names for the rarer combination modifiers (like control alt shift). Those commands would be probably not often used so I don't know that it's a good idea to introduce a bunch of new commands like that with a short name that might cause misrecognitions at least if they are CCR. On the other hand, some users may want to use these commands in something like a text editor that has a lot of complex hotkeys so for them the short name would be worth it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't feel strongly about it either way. People can add them

@kendonB
Copy link
Collaborator

kendonB commented Jun 19, 2019

right from when I started using caster I added "hum": "home", "end": "end", "sun": "pageup", "doon": "pagedown" as options for direction. this change has only been helpful for me and I seldom get misrecognitions because of it.

What do people think about making this change here as well? Of course we can still keep Wally as an option but it gives some nice single syllable options for these powerful navigation commands.

@LexiconCode, @mrob95 input on this please

EDIT: I didn't actually realize that the functionality I usually use is already there in this PR. The spec for page up is "page up" instead of "sun" but I can now say "shin page up" and it works.

"(shift | shin)": "s",
"alt": "a",
"(control shift | que)": "cs",
"control alt": "ca",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

control alt | cult

"alt": "a",
"(control shift | que)": "cs",
"control alt": "ca",
"(shift alt | alt shift)": "sa",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| salt

@kendonB
Copy link
Collaborator

kendonB commented Jun 19, 2019

I think this PR is going to help a lot for those of us who switch between typing and voice control!

@LexiconCode LexiconCode added Caster Core Spec Issues for Caster Specs that are not part of the application or language specific grammar/ccr New Feature A new feature that is not currently implemented. labels Jun 21, 2019
@kendonB
Copy link
Collaborator

kendonB commented Jun 22, 2019

@alexboche are you able to write out all the functional changes in this PR in your first comment? I was about to solicit comments on the Caster channel but realised that people would have to dig into the code to work out the changes.

@alexboche
Copy link
Contributor Author

@alexboche178 are you able to write out all the functional changes in this PR in your first comment? I was about to solicit comments on the Caster channel but realised that people would have to dig into the code to work out the changes.

I have done so. Let me know if further elaboration is necessary.

@kendonB
Copy link
Collaborator

kendonB commented Jun 23, 2019

@alexboche178 are you able to write out all the functional changes in this PR in your first comment? I was about to solicit comments on the Caster channel but realised that people would have to dig into the code to work out the changes.

I have done so. Let me know if further elaboration is necessary.

flitch etc as well

kendonB added a commit to kendonB/Caster that referenced this pull request Jun 23, 2019
kendonB added a commit to kendonB/Caster that referenced this pull request Jun 23, 2019
@LexiconCode LexiconCode added WIP An work in progress Documentation Needed Issue needs grammars or function documentation labels Jun 23, 2019
@LexiconCode
Copy link
Member

This can be tested and merged once documentation and conflicts are resolved.

@LexiconCode LexiconCode added the Waiting for User Reply Waiting for OP reply label Jun 27, 2019
@alexboche
Copy link
Contributor Author

I tried to do the documentation in the caster quick reference. Even without making any changes, when I try to compile the latex, I get the error message pointing to line 436. "! Missing $ inserted." On that line,the code is:

\end{minipage}
}

Any suggestions?

@LexiconCode
Copy link
Member

I tried to do the documentation in the caster quick reference. Even without making any changes, when I try to compile the latex, I get the error message pointing to line 436. "! Missing $ inserted." On that line,the code is:

\end{minipage}
}

Any suggestions?

A bit about my set up for latex. I found Miktex and Texmaker to be plug-and-play which none of the other editors or latex compilers seem to provide.
Miktex
Texmaker

In terms of troubleshooting does your error happen with the vanilla CasterQuickReference.tex? I verified that CasterQuickReference compiles from the Development branch.

@alexboche
Copy link
Contributor Author

alexboche commented Jun 29, 2019

Not sure what changed,it's working now. As I add things, things get cut off at the end of the mini page. Is there a way to get everything to line up nicely instead of having to manually adjust the mini pages all the way through the document every time I add something?

@LexiconCode
Copy link
Member

I'm still learning a bit myself with latex. Therefore I think the easiest solution would be to upload your working file I will take a look.

@alexboche
Copy link
Contributor Author

Here is what I have. The issue seems that if I move one section to a different many page that messes up the next section and so on and I end up having to shift everything over by a page which is a huge pain, there must be a better way.
Am having some issues with git, which is not allowing me to push the changes,which is why I'm using a paste service for now until I get that figured out. The stuff I'm adding is on line 232-256. thanks

@LexiconCode
Copy link
Member

Thanks. Regarding git you might have to do force push to your current branch modifier_keys. Force push is okay when you don't have anyone else working on the same branch.

@LexiconCode LexiconCode removed the Waiting for User Reply Waiting for OP reply label Jun 29, 2019
@alexboche
Copy link
Contributor Author

If you click on the latest commit, which is called, "first draft add to quick reference",you should be able to see the changes to the quick reference. Thanks

@LexiconCode LexiconCode reopened this Jun 30, 2019
@LexiconCode LexiconCode changed the base branch from develop to master June 30, 2019 20:47
@LexiconCode
Copy link
Member

@mrob95 I can't quite get figure out how to make the latex play nicely without running out of margins. Any tips?

@alexboche
Copy link
Contributor Author

I just added a new command for making keystroke commands. The command is "keystroke [] ". So now saying "keystroke control shift delta" should type out Key("cs-d"). One could certainly argue this should go in the voice dev command files,but since this is so similar to the modifiier key commands and everything required is sitting right there in nav.py, I thought it would be simplest to put it there. When testing this new command, I was having some trouble getting it to work with some of the keys in button_dictionary_500. I think this is some conflict with Unimacro,but I'm not totally sure. can somebody test this new command to make sure it works. Once this is given the green light, I can add a line to the voice dev commands documentation.

I also fixed the typo with the home key.

@kendonB
Copy link
Collaborator

kendonB commented Jul 4, 2019

One could certainly argue this should go in the voice dev command files

You are right! It should go there and not in nav.py. I'd also do "dev key control shift s" to be similar to the others that you have in there.

@alexboche
Copy link
Contributor Author

Okay I moved the new command for creating keystroke commands into the voice dev command file and called it dev key. If you just say dev key, then it will move the cursor inside the key action,but if you specify the keys,the cursor will be left outside the key action.

@LexiconCode
Copy link
Member

@alexboche I'm fine merging this without the documentation and we can remove the edits fromCasterQuickReference.tex and CasterQuickReference.tex.

We can include the documentation in #629 as that issue matures.

@alexboche
Copy link
Contributor Author

alexboche commented Jul 6, 2019

I undid the changes to the caster quick reference.
By the way, some of the shorter command words like "latch" (home) will have to be monitored to see if they cause misfires. I did have one misfire where "sauce latch" was interpreted as "slash". If we stick with these, it's good to stick the landing on the "ch" sound.

@LexiconCode LexiconCode added Testing Required Requesting testers before merge and removed WIP An work in progress labels Jul 7, 2019
@alexboche
Copy link
Contributor Author

alexboche commented Jul 8, 2019

I just added the ability to say "hit <button>" for when you don't want to modify the button with a modifier key. I also added the F keys which can be used by saying e.g. "function 6". by the way, git was Saying something about " rewrite castervoice/lib/dll/tirg-dll.dll".
I think this now has all the features it needs.

@LexiconCode
Copy link
Member

I just added the ability to say "hit " for when you don't want to modify the button with a modifier key.

That's brilliant! For some reason github won't let me resolve the conflicts online so you'll need to update it on your end.

@kendonB
Copy link
Collaborator

kendonB commented Jul 9, 2019

@LexiconCode if you want to resolve the conflicts you could try out my "git push back to pull request alex" function:

https://github.com/kendonB/Caster/blob/b8160f73b4eb1212346966c29abb1351a4f2efab/castervoice/apps/gitbash.py#L132-L135

Full workflow:

  1. Have a clean caster working tree
  2. say "checkout pull request" on this webpage
  3. Do a git merge master and resolve conflicts
  4. say "git push back to pull request alex" then add modifier_keys as the branch name

@alexboche
Copy link
Contributor Author

okay I merged with the latest caster and added the windows key commands which I forgot

@LexiconCode LexiconCode removed the Testing Required Requesting testers before merge label Jul 9, 2019
@LexiconCode LexiconCode merged commit fe3c3f3 into dictation-toolbox:master Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Caster Core Spec Issues for Caster Specs that are not part of the application or language specific grammar/ccr Documentation Needed Issue needs grammars or function documentation New Feature A new feature that is not currently implemented.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants