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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 81 additions & 4 deletions castervoice/lib/ccr/core/nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
@author: synkarius
'''
from castervoice.lib.imports import *
from dragonfly.actions.action_mimic import Mimic
from castervoice.lib.alphanumeric import caster_alphabet


_NEXUS = control.nexus()

Expand All @@ -15,7 +18,7 @@
else:
raise Exception("Need to deal with nonstandard pair length in double_text_punc_dict.")

class NavigationNon(MergeRule):
class NavigationNon(MergeRule):
mapping = {
"<direction> <time_in_seconds>":
AsynchronousAction(
Expand Down Expand Up @@ -190,8 +193,8 @@ class Navigation(MergeRule):
R(Key("c-s"), rspec="save"),
'shock [<nnavi50>]':
R(Key("enter"), rspec="shock")* Repeat(extra="nnavi50"),
"(<mtn_dir> | <mtn_mode> [<mtn_dir>]) [(<nnavi500> | <extreme>)]":
R(Function(text_utils.master_text_nav)),
# "(<mtn_dir> | <mtn_mode> [<mtn_dir>]) [(<nnavi500> | <extreme>)]":
# R(Function(text_utils.master_text_nav)), # this is now implemented below
"shift click":
R(Key("shift:down") + Mouse("left") + Key("shift:up")),
"stoosh [<nnavi500>]":
Expand Down Expand Up @@ -254,16 +257,89 @@ class Navigation(MergeRule):
R(Function(navigation.left_down, nexus=_NEXUS)),
"bench":
R(Function(navigation.left_up, nexus=_NEXUS)),

# keystroke commands
"<direction> [<nnavi500>]": R(Key("%(direction)s") * Repeat(extra='nnavi500'),
rdescript="arrow keys"),
"(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")),

"<modifier> <button_dictionary_500> [<nnavi500>]":
R(Key("%(modifier)s%(button_dictionary_500)s") * Repeat(extra='nnavi500'),
rdescript="press modifier keys plus buttons from button_dictionary_500"),
"<modifier> <button_dictionary_10> [<nnavi10>]":
R(Key("%(modifier)s%(button_dictionary_10)s") * Repeat(extra='nnavi10'),
rdescript="press modifier keys plus buttons from button_dictionary_10"),
"<modifier> <button_dictionary_1>":
R(Key("%(modifier)s%(button_dictionary_1)s"),
rdescript="press modifiers plus buttons from button_dictionary_1, non-repeatable"),

# "key stroke [<modifier>] <combined_button_dictionary>":
# R(Text('Key("%(modifier)s%(combined_button_dictionary)s")')),

}



}
# I tried to limit which things get repeated how many times in hopes that it will help prevent the bad grammar error
# this could definitely be changed. perhaps some of these should be made non-CCR
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"}
combined_button_dictionary = {}
for dictionary in [button_dictionary_1, button_dictionary_10, button_dictionary_500]:
combined_button_dictionary.update(dictionary)

modifier_choice_object = Choice("modifier", {
"(control | fly)": "c-", #TODO: make DRY
"(shift | shin)": "s-",
"alt": "a-",
"(control shift | que)": "cs-",
"control alt": "ca-",
"(shift alt | alt shift)": "sa-",
"(control alt shift | control shift alt)": "csa-", # control must go first
"windows": "w-", # windows should go before alt/shift
"control windows": "cw-",
"control windows alt": "cwa-",
"control windows shift": "cws-",
"windows shift alt": "wsa-",
"windows alt shift": "was-",
"windows shift": "ws-",
"windows alt": "wa-",
"control windows alt shift": "cwas-",
"hit": "",
})
extras = [

IntegerRefST("nnavi10", 1, 11),
IntegerRefST("nnavi3", 1, 4),
IntegerRefST("nnavi50", 1, 50),
IntegerRefST("nnavi500", 1, 500),
Dictation("textnv"),
Choice("enclosure", double_text_punc_dict),
Choice("direction", {
"dunce": "down",
"sauce": "up",
"lease": "left",
"ross": "right",
}),
modifier_choice_object,
Choice("button_dictionary_1", button_dictionary_1),
Choice("button_dictionary_10", button_dictionary_10),
Choice("button_dictionary_500", button_dictionary_500),
Choice("combined_button_dictionary", combined_button_dictionary),

Choice("capitalization", {
"yell": 1,
"tie": 2,
Expand Down Expand Up @@ -327,6 +403,7 @@ class Navigation(MergeRule):
"extreme": None,
"big": False,
"splatdir": "backspace",
"modifier": "",
}


Expand Down
11 changes: 11 additions & 0 deletions castervoice/lib/ccr/voice_dev_commands/voice_dev_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
users may want to make this context-specific to their text editors
'''
from castervoice.lib.imports import *
from castervoice.lib.ccr.core.nav import Navigation
# combined_button_dictionary = Navigation.combined_button_dictionary
# modifier_choice_object = Navigation.modifier_choice_object
# print(combined_button_dictionary)
# del Navigation

def split_dictation(text):
if text:
Expand Down Expand Up @@ -74,6 +79,10 @@ class VoiceDevCommands(MergeRule):
mapping = {

# Dragonfly Snippets
# this first command is probably the most useful one
"dev key [<modifier>] <combined_button_dictionary>":
R(Text('Key("%(modifier)s%(combined_button_dictionary)s")'),
rdescript="DragonflyDev: Snippet for creating a full Key action"),
"dev key":
R(Text('Key("")') + Key("left:2"), rdescript="DragonflyDev: Snippet for Key Action"),
"dev text":
Expand Down Expand Up @@ -181,6 +190,8 @@ class VoiceDevCommands(MergeRule):
}

extras = [
Navigation.modifier_choice_object,
Choice("combined_button_dictionary", Navigation.combined_button_dictionary),
Dictation("text"),
Dictation("dict"),
Dictation("spec"),
Expand Down
Binary file modified castervoice/lib/dll/tirg-dll.dll
Binary file not shown.
Binary file modified docs/CasterQuickReference.pdf
Binary file not shown.
31 changes: 8 additions & 23 deletions docs/CasterQuickReference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -417,35 +417,31 @@ \section*{Caster Quick Reference} % Title

%----------------------------------------------------------------------------------------

\end{minipage}
}

\put(200, 200){
\begin{minipage}[t]{85mm}

\sectiontitle{Bring me}

\command{program/website/folder/file to bring me as <key>}{manually create bring me binding}
\command{to bring me as <key>}{automatically create bring me binding}
\command{program/website/folder/file to bring me as <key>}{create a new bring me binding}
\command{bring me <key>}{open bring me binding}
\command{bring me <key> in explorer/terminal}{open bring me binding in a new window}
\command{remove <key> from bring me}{}
\command{restore bring me defaults}{}

%----------------------------------------------------------------------------------------

\end{minipage}
}

\put(200, 200){
\begin{minipage}[t]{85mm}

\sectiontitle{Dragon}

\command{number/spell/dictation/normal/command mode}{switch dragon modes}
\command{reboot dragon}{Restarts DNS}

%----------------------------------------------------------------------------------------

\sectiontitle{Update and Caster Management}

\command{clear caster log}{Clears Log Window}
\command{update caster}{Updates Caster}
\command{update dragonfly}{Updates Dragonfly}
\command{reboot dragon}{Restarts Caster}
\command{reboot windows speech recognition}{Restarts Caster}

\end{minipage}
Expand All @@ -471,17 +467,6 @@ \section*{Caster Quick Reference} % Title
\end{minipage}
}

\put(105,200){ % Divide the page
\begin{minipage}[t]{85mm} % Create a box to house text
\examplecommand{window ross}{Snap the current window to the right hand side of the screen}
\examplecommand{new work}{Create a new workspace}
\examplecommand{go work three}{Switch to the third workspace}
\examplecommand{move work one}{Move the current window to the first workspace}

\examplecommand{bring me my pictures in terminal}{Open a terminal window and cd to my pictures}
\end{minipage}
}

\end{picture} % End the container for the entire page

\end{document}