class GridControlRule(MergeRule): mapping = { "[<pre>] <color> <n> [<action>]": R(Function(send_input, nexus=_NEXUS), rdescript="Rainbow Grid: Action"), "exit | escape | cancel": R(Function(kill, nexus=_NEXUS), rdescript="Exit Rainbow Grid"), } extras = [ IntegerRefST("pre", 0, 9), Choice( "color", { "red": 0, "(orange | tan | brown)": 1, "yellow": 2, "green": 3, "blue": 4, "purple": 5 }), Choice("action", { "kick": 0, "psychic": 1, }), IntegerRefST("n", 0, 100), ] defaults = { "pre": 0, "action": -1, }
class CustomVSCode(MergeRule): pronunciation = "custom sublime commands" mapping = { # my custom overrides "save file as": R(Key("cs-s"), rdescript="Sublime: Save As"), "grab it": R(Key("c-d"), rdescript="Sublime: Ctrl + d"), "skip it": R(Key("c-k,c-d"), rdescript="Sublime: Ctrl + d, k"), "uppercase": R(Key("csa-u"), rdescript="Sublime: uppercase"), "lowercase": R(Key("csa-l"), rdescript="Sublime: uppercase"), "cue jeep": R(Key("a-up"), rdescript="Sublime: uppercase"), "cue doom": R(Key("a-down"), rdescript="Sublime: uppercase"), "execute": R(Key("s-enter"), rdescript="Sublime: Ctrl + b"), "[go to] group [<n2>]": R(Key("c-%(n2)s"), rdescript="Sublime: Go to Group #"), "spring <n>": R(Key("c-g") + Pause("10") + Text("%(n)s") + Key("enter"), rdescript="Sublime: Go to Line #"), "crew [<text>]": R(Key("c-i") + Pause("10") + Text("%(text)s") + Pause("10") + Key("enter") + Key("escape"), rdescript="Sublime: Get Next"), "trail [<text>]": R(Key("c-u") + Pause("10") + Text("%(text)s") + Pause("10") + Key("enter") + Key("escape"), rdescript="Sublime: Get Next"), "expand|fill quotes": R(Key("cs-space"), rdescript="Atom: Expand Selection to Quotes"), # SymbolSpecs.FUNCTION: R(Text("fu\\") + Key("tab"), rdescript="CustomSublime: Function"), # SymbolSpecs.IF: R(Text("if\\") + Key("tab"), rdescript="ColdFusion: If"), # my custom overrides "double quotes": R(Key("dquote"), rdescript="Quotation Marks"), "Quach it": R(Key("apostrophe"), rdescript="Thin Quotation Marks"), "(cellaring | sell rang) <n> <n3>": R( Key("c-g") + Pause("5") + Text("%(n)s") + Key("enter") + Pause("5") + Key("c-k") + Key("c-space") + Pause("5") + Key("c-g") + Pause("10") + Text("%(n3)s") + Key("enter") + Key("end") + Key("c-k") + Key("c-a")), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), IntegerRefST("n2", 1, 9), IntegerRefST("n3", 1, 999), ] defaults = {"n": 1, "mim": "", "text": ""}
class HMCHistoryRule(MergeRule): mapping = { # specific to macro recorder "check <n>": R(Function(hmc_checkbox, nexus=_NEXUS), rdescript="Check Checkbox"), "check from <n> to <n2>": R(Function(hmc_recording_check_range, nexus=_NEXUS), rdescript="Check Range"), "exclude <n>": R(Function(hmc_recording_exclude, nexus=_NEXUS), rdescript="Uncheck Checkbox"), "[make] repeatable": R(Function(hmc_recording_repeatable, nexus=_NEXUS), rdescript="Make Macro Repeatable") } extras = [ IntegerRefST("n", 1, 25), IntegerRefST("n2", 1, 25), ]
class EclipseCCR(MergeRule): pronunciation = "eclipse jump" mwith = [Navigation().get_pronunciation()] mapping = { #Line Ops "configure": R(Paste(ec_con.analysis_chars)+Key("left:2/5, c-f/20, backslash, rbracket, enter") + \ Function(ec_con.analyze_for_configure), rdescript="Eclipse: Configure"), "jump in [<n>]": R(Key("c-f, a-o")+Paste(r"[\(\[\{\<]")+Function(ec_con.regex_on)+ \ Key("enter:%(n)d/5, escape, right") , rdescript="Eclipse: Jump In"), "jump out [<n>]": R(Key("c-f, a-o")+Paste(r"[\)\] \}\>]")+Function(ec_con.regex_on)+ \ Key("enter:%(n)d/5, escape, right") , rdescript="Eclipse: Jump Out"), "jump back [<n>]": R(Key("c-f/5, a-b")+Paste(r"[\)\]\}\>]")+Function(ec_con.regex_on)+ \ Key("enter:%(n)d/5, escape, left") , rdescript="Eclipse: Jump Back"), "[go to] line <n>": R(Key("c-l") + Pause("50") + Text("%(n)d") + Key("enter")+ Pause("50"), rdescript="Eclipse: Go To Line"), "shackle <n> [<back>]": R(Key("c-l")+Key("right, cs-left")+ \ Function(ec_con.lines_relative), rdescript="Eclipse: Select Relative Lines"), } extras = [ Dictation("text"), IntegerRefST("n", 1, 1000), Boolean("back"), ] defaults = {"n": 1, "back": False}
class SublimeRule(MergeRule): pronunciation = "sublime" mapping = { "go to line": R(Key("c-g"), rdescript="Sublime: Go To Line"), "go to symbol": R(Key("c-r"), rdescript="Sublime: Go To Symbol"), "go to word": R(Key("c-semicolon"), rdescript="Sublime: Go To Word"), "transform upper": R(Key("control:down, k, u, control:up"), rdescript="Sublime: Transform Upper"), "transform lower": R(Key("control:down, k, l, control:up"), rdescript="Sublime: Transform Lower"), "comment line": R(Key("c-slash"), rdescript="Sublime: Comment Line"), "comment block": R(Key("cs-slash"), rdescript="Sublime: Comment Block"), "full screen": R(Key("f11"), rdescript="Sublime: Fullscreen"), "set bookmark": R(Key("c-f2"), rdescript="Sublime: Set Bookmark"), "next bookmark": R(Key("f2"), rdescript="Sublime: Next Bookmark"), "open file": R(Key("c-p"), rdescript="Sublime: Open File"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class GitHubRule(MergeRule): pronunciation = "github" mapping = { "new repository": R(Key("c-n")), "add local repository": R(Key("c-o")), "clone repository": R(Key("c-o")), "options": R(Key("c-comma")), "changes": R(Key("c-1")), "history": R(Key("c-2")), "(repositories | repository list)": R(Key("c-t")), "branches [list]": R(Key("c-b")), "zoom in [<n>]": R(Key("c-equals")) * Repeat(extra="n"), "zoom out [<n>]": R(Key("c-minus")) * Repeat(extra="n"), "reset zoom": R(Key("c-0")), "push [repository]": R(Key("c-p")), "pull [repository]": R(Key("cs-p")), "remove repository": R(Key("c-delete")), "view on github": R(Key("cs-g")), "(terminal | command prompt)": R(Key("c-backtick")), "explorer": R(Key("cs-f")), "edit": R(Key("cs-a")), "new branch": R(Key("cs-n")), "rename branch": R(Key("cs-r")), "delete branch": R(Key("cs-d")), "update from master": R(Key("cs-u")), "compare to [branch]": R(Key("cs-b")), "merge into current [branch]": R(Key("cs-m")), "compare on github": R(Key("cs-c")), "create pull request": R(Key("c-r")), } extras = [ IntegerRefST("n", 1, 10), ] defaults = {"n": 1}
class FirefoxRule(MergeRule): pronunciation = "fire fox" mapping = { "new tab [<n>]": R(Key("c-t"), rdescript="Browser: New Tab") * Repeat(extra="n"), "reopen tab [<n>]": R(Key("cs-t"), rdescript="Browser: Reopen Tab") * Repeat(extra="n"), "show history": R(Key("c-h"), rdescript="Browser: Show History"), "show downloads": R(Key("c-j"), rdescript="Browser: Show Downloads"), "zoom in <n>": R(Key("c-plus/20"), rdescript="Browser: Zoom In") * Repeat(extra="n"), "zoom out <n>": R(Key("c-minus/20"), rdescript="Browser: Zoom") * Repeat(extra="n"), "super refresh": R(Key("c-f5"), rdescript="Browser: Super Refresh"), "[add] bookmark": R(Key("c-d"), rdescript="Browser: Add Bookmark"), "developer tools": R(Key("f12"), rdescript="Browser: Developer Tools"), "resume": R(Key("f8"), rdescript="Browser: Resume"), "step over": R(Key("f10"), rdescript="Browser: Step Over"), "step into": R(Key("f11"), rdescript="Browser: Step Into"), "step out": R(Key("s-f11"), rdescript="Browser: Step Out"), "IRC identify": R(Text("/msg NickServ identify PASSWORD"), rdescript="IRC Chat Channel Identify"), } extras = [ Dictation("dict"), IntegerRefST("n",1, 100), ] defaults ={"n": 1, "dict":"nothing"}
class UpperCaseSQL(MergeRule): pronunciation = "upper case sequel" mapping = { "select": R(Text("SELECT "), rdescript="SQL: Select"), "select top [<n>]": R(Text("SELECT TOP ") + Function(_render_number), rdescript="SQL: Select Top"), "select all": R(Text("SELECT * "), rdescript="SQL: Select All"), "from": R(Key("enter") + Text("FROM "), rdescript="SQL: From"), "where": R(Key("enter") + Text("WHERE "), rdescript="SQL: Where"), "group by": R(Key("enter") + Text("GROUP BY "), rdescript="SQL: Group By"), "order by": R(Key("enter") + Text("ORDER BY "), rdescript="Order By"), "ascending": R(Text(" ASC "), rdescript="SQL: Ascending"), "descending": R(Text(" DESC "), rdescript="SQL: Descending"), "left join": R(Key("enter") + Text("LEFT JOIN "), rdescript="SQL: Left Join"), "inner join": R(Key("enter") + Text("INNER JOIN "), rdescript="SQL: Inner Join"), "join": R(Text(" JOIN "), rdescript="SQL: Join"), "insert into": R(Text(" INSERT INTO "), rdescript="SQL: Insert"), "update": R(Text(" UPDATE TOKEN SET "), rdescript="SQL: Update"), "delete": R(Text("DELETE "), rdescript="SQL: Delete"), "like": R(Text(" LIKE '%%'") + Key("left/5:2"), rdescript="SQL: Like"), "union": R(Text(" UNION "), rdescript="SQL: Union"), "alias as": R(Text(" AS "), rdescript="SQL: Alias As"), "is null": R(Text(" IS NULL "), rdescript="SQL: Is Null"), "is not null": R(Text(" IS NOT NULL "), rdescript="SQL: Is Not Null"), "declare": R(Text(" DECLARE @ "), rdescript="SQL: Is Not Null"), "fun max": R(Text(" MAX() ") + Key("left/5:2"), rdescript="SQL: Max"), "fun count": R(Text(" COUNT() ") + Key("left/5:2"), rdescript="SQL: Count"), "int": R(Text(" INT "), rdescript="SQL: Count"), "var char | far char": R(Text(" VARCHAR() ") + Key("left:2"), rdescript="SQL: Count"), } extras = [ IntegerRefST("n", 1, 10000), ] defaults = {"n": 0}
class Numbers(MergeRule): pronunciation = CCRMerger.CORE[2] mapping = { "word number <wn>": R(Function(alphanumeric.word_number, extra="wn"), rdescript="Number As Word"), "numb <wnKK>": R(Function(alphanumeric.numbers2, extra="wnKK"), rspec="number", rdescript="Number"), } extras = [ IntegerRefST("wn", 0, 10), IntegerRefST("wnKK", 0, 1000000), ] defaults = {}
class StackTest(MappingRule): '''test battery for the ContextStack''' mapping = { "close last tag": ContextSeeker([ L(S(["cancel"], None), S(["html spoken"], close_last_spoken, use_spoken=True), S(["span", "div"], close_last_rspec, use_rspec=True)) ]), "html": R(Text("<html>"), rspec="html spoken"), "divider": R(Text("<div>"), rspec="div"), "span": R(Text("<span>"), rspec="span"), "backward seeker [<text>]": ContextSeeker([ L(S(["ashes"], Text("ashes1 [%(text)s] ")), S(["bravery"], Text("bravery1 [%(text)s] "))), L(S(["ashes"], Text("ashes2 [%(text)s] ")), S(["bravery"], Text("bravery2 [%(text)s] "))) ]), "forward seeker [<text>]": ContextSeeker(forward=[ L(S(["ashes"], Text("ashes1 [%(text)s] ")), S(["bravery"], Text("bravery1 [%(text)s] "))), L(S(["ashes"], Text("ashes2 [%(text)s] ")), S(["bravery"], Text("bravery2 [%(text)s] "))) ]), "asynchronous test": AsynchronousAction([ L(S(["ashes", "charcoal"], print_time, None), S(["bravery"], Text, "bravery1")) ], time_in_seconds=0.2, repetitions=20, finisher=Text(FINISHER_TEXT), blocking=False), "ashes": RegisteredAction(Text("ashes _ "), rspec="ashes"), "bravery": RegisteredAction(Text("bravery _ "), rspec="bravery"), "charcoal <text> [<n>]": R(Text("charcoal _ %(text)s"), rspec="charcoal"), "test confirm action": ConfirmAction(Key("a"), rdescript="Confirm Action Test", instructions="some words here"), "test box action": BoxAction(lambda data: _abc(data), rdescript="Test Box Action", box_type=settings.QTYPE_DEFAULT, log_failure=True), } extras = [Dictation("text"), Dictation("text2"), IntegerRefST("n", 1, 5)] defaults = {"text": "", "text2": ""}
class FlashDevelopRule(MergeRule): pronunciation = "flash develop" mapping = { "prior tab [<n>]": R(Key("c-pgup"), rdescript="FlashDevelop: Previous Tab") * Repeat(extra="n"), "next tab [<n>]": R(Key("c-pgdown"), rdescript="FlashDevelop: Next Tab") * Repeat(extra="n"), "open resource": R(Key("c-r"), rdescript="FlashDevelop: Open Resource"), "jump to source": R(Key("f4"), rdescript="FlashDevelop: Jump To Source"), "jump away": R(Key("s-f4"), rdescript="FlashDevelop: Jump Away"), "step over [<n>]": R(Key("f10") * Repeat(extra="n"), rdescript="FlashDevelop: Step Over"), "step into": R(Key("f11"), rdescript="FlashDevelop: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="FlashDevelop: Step Out"), "resume": R(Key("a-d, c"), rdescript="FlashDevelop: Resume"), "terminate": R(Key("s-f5"), rdescript="FlashDevelop: Terminate Running Program"), "find everywhere": R(Key("cs-f"), rdescript="FlashDevelop: Search Project"), "refractor symbol": R(Key("a-r, r"), rdescript="FlashDevelop: Re-Factor Symbol"), "symbol next [<n>]": R(Key("f3"), rdescript="FlashDevelop: Symbol Next") * Repeat(extra="n"), "symbol prior [<n>]": R(Key("s-f3"), rdescript="FlashDevelop: Symbol Prior") * Repeat(extra="n"), "format code": R(Key("cs-2"), rdescript="FlashDevelop: Format Code"), "comment line": R(Key("c-q"), rdescript="FlashDevelop: Comment Line"), "clean it": R(Key("s-f8"), rdescript="FlashDevelop: Clean"), "build it": R(Key("f8"), rdescript="FlashDevelop: Build"), "(debug | run) last": R(Key("f5"), rdescript="FlashDevelop: Run"), "split view horizontal": R(Key("cs-enter"), rdescript="FlashDevelop: Split View (H)"), "auto complete": R(Key("cs-1"), rdescript="FlashDevelop: Auto Complete"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class GridControlRule(MergeRule): mapping = { "<n> [by] <n2> [<action>]": R(Function(send_input, nexus=_NEXUS), rdescript="Douglas Grid: Action"), "exit | escape | cancel": R(Function(kill, nexus=_NEXUS), rdescript="Exit Douglas Grid"), } extras = [ IntegerRefST("n", 0, 300), IntegerRefST("n2", 0, 300), Choice("action", { "kick": 0, "psychic": 1, }), ] defaults = { "action": -1, }
class SSMSRule(MergeRule): pronunciation = "custom sequel server management studio" mapping = { # There doesn't seem to be a hotkey for sequential tab navigation in SSMS, but something is better than nothing... "next tab [<n>]": R(Key("c-tab"), rdescript="SSMS: Next Tab")*Repeat(extra="n"), "prior tab [<n>]": R(Key("cs-tab"), rdescript="SSMS: Previous Tab")*Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20"), rdescript="SSMS: Close Tab")*Repeat(extra="n"), "go to line": R(Key("c-g"), rdescript="SSMS: Go To Line"), "[go to] line <n>": R(Key("c-g") + Pause("10") + Text("%(n)s") + Key("enter"), rdescript="SSMS: Go to Line #"), "comment line": R(Key("c-k, c-c"), rdescript="SSMS: Comment Selection"), "comment block": R(Key("c-k, c-c"), rdescript="SSMS: Comment Block"), "(un | on) comment line": R(Key("c-k/50, c-u"), rdescript="SSMS: Uncomment Selection"), "(un | on) comment block": R(Key("c-k/50, c-u"), rdescript="SSMS: Uncomment Block"), "[toggle] full screen": R(Key("sa-enter"), rdescript="SSMS: Fullscreen"), "(set | toggle) bookmark": R(Key("c-k, c-k"), rdescript="SSMS: Toggle Bookmark"), "next bookmark": R(Key("c-k, c-n"), rdescript="SSMS: Next Bookmark"), "prior bookmark": R(Key("c-k, c-p"), rdescript="SSMS: Previous Bookmark"), "[toggle] breakpoint": R(Key("f9"), rdescript="SSMS: Breakpoint"), "step over [<n>]": R(Key("f10/50")*Repeat(extra="n"), rdescript="SSMS: Step Over"), "step into": R(Key("f11"), rdescript="SSMS: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="SSMS: Step Out"), "resume": R(Key("f5"), rdescript="SSMS: Resume"), "execute": R(Key("f5"), rdescript="SQL: Count"), "switch focus [<n>]": R(Key("f6"), rdescript="SQL: Switch Focus")*Repeat(extra="n"), "back focus [<n>]": R(Key("s-f6"), rdescript="SQL: Back Focus")*Repeat(extra="n"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class VisualStudioRule(MergeRule): pronunciation = "visual studio" mapping = { "next tab [<n>]": R(Key("ca-pgdown"), rdescript="Visual Studio: Next Tab") * Repeat(extra="n"), "prior tab [<n>]": R(Key("ca-pgup"), rdescript="Visual Studio: Previous Tab") * Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20"), rdescript="Visual Studio: Close Tab") * Repeat(extra="n"), "(list | show) documents": R(Key("a-w, w"), rdescript="Visual Studio: List Documents"), "[focus] document (window | pane)": R(Key("a-w, w, enter"), rdescript="Visual Studio: Focus Document Pane"), "solution explorer": R(Key("ca-l"), rdescript="Visual Studio: Solution Explorer"), "team explorer": R(Key("c-backslash, c-m"), rdescript="Visual Studio: Team Explorer"), "source control explorer": R(Key("c-q") + Text("Source Control Explorer") + Key("enter"), rdescript="Visual Studio: Source Control Explorer"), "quick launch": R(Key("c-q"), rdescript="Visual Studio: Quick Launch"), "go to line": R(Key("c-g"), rdescript="Visual Studio: Go To Line"), "comment line": R(Key("c-k, c-c"), rdescript="Visual Studio: Comment Selection"), "comment block": R(Key("c-k, c-c"), rdescript="Visual Studio: Comment Block"), "(un | on) comment line": R(Key("c-k/50, c-u"), rdescript="Visual Studio: Uncomment Selection"), "(un | on) comment block": R(Key("c-k/50, c-u"), rdescript="Visual Studio: Uncomment Block"), "[toggle] full screen": R(Key("sa-enter"), rdescript="Visual Studio: Fullscreen"), "(set | toggle) bookmark": R(Key("c-k, c-k"), rdescript="Visual Studio: Toggle Bookmark"), "next bookmark": R(Key("c-k, c-n"), rdescript="Visual Studio: Next Bookmark"), "prior bookmark": R(Key("c-k, c-p"), rdescript="Visual Studio: Previous Bookmark"), "collapse to definitions": R(Key("c-m, c-o"), rdescript="Visual Studio: Collapse To Definitions"), "toggle [section] outlining": R(Key("c-m, c-m"), rdescript="Visual Studio: Toggle Section Outlining"), "toggle all outlining": R(Key("c-m, c-l"), rdescript="Visual Studio: Toggle All Outlining"), "[toggle] breakpoint": R(Key("f9"), rdescript="Visual Studio: Breakpoint"), "step over [<n>]": R(Key("f10/50") * Repeat(extra="n"), rdescript="Visual Studio: Step Over"), "step into": R(Key("f11"), rdescript="Visual Studio: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="Visual Studio: Step Out"), "resume": R(Key("f5"), rdescript="Visual Studio: Resume"), "run tests": R(Key("c-r, t"), rdescript="Visual Studio: Run test(s)"), "run all tests": R(Key("c-r, a"), rdescript="Visual Studio: Run all tests"), "build solution": R(Key("cs-b"), rdescript="Visual Studio: Build solution"), "get latest [version]": R(Key("a-f, r, l"), rdescript="Visual Studio: Get Latest"), "(show | view) history": R(Key("a-f, r, h"), rdescript="Visual Studio: Show History"), "compare (files | versions)": R(Key("a-f, r, h"), rdescript="Visual Studio: Compare..."), "undo (checkout | pending changes)": R(Key("a-f, r, u"), rdescript="Visual Studio: Undo Pending Changes"), "[open] [go to] work item": R(Key("a-m, g"), rdescript="Visual Studio: Open Work Item"), "[add] [new] linked work item": R(Key("sa-l"), rdescript="Visual Studio: New Linked Work Item"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim":""}
class RStudioRule(MergeRule): pronunciation = "are studio" mapping = { "new file": R(Key("cs-n"), rdescript="RStudio: New File"), "open file": R(Key("c-o"), rdescript="RStudio: Open File"), "open recent project": R(Key("a-f, j"), rdescript="RStudio: Open Recent Project"), "open project": R(Key("a-f, n, enter"), rdescript="RStudio: Open Project"), "save all": R(Key("ac-s"), rdescript="RStudio: Save All"), "select all": R(Key("c-a"), rdescript="RStudio: Select All"), "find": R(Key("c-f"), rdescript="RStudio: Find"), "[go to] line <n>": R(Key("as-g") + Pause("10") + Text("%(n)s") + Key("enter"), rdescript="RStudio: Go to Line #"), "focus console": R(Key("c-2"), rdescript="RStudio: Focus Console"), "focus main": R(Key("c-1"), rdescript="RStudio: Focus Main"), "next tab": R(Key("c-f12"), rdescript="RStudio: Next Tab"), "first tab": R(Key("cs-f11"), rdescript="RStudio: First Tab"), "previous tab": R(Key("c-f11"), rdescript="RStudio: Previous Tab"), "last tab": R(Key("cs-f12"), rdescript="RStudio: Last Tab"), "close tab": R(Key("c-w"), rdescript="RStudio: Close Tab"), "run line": R(Key("c-enter"), rdescript="RStudio: Run Line"), "run document": R(Key("ac-r"), rdescript="RStudio: Run Document"), "comment (line | selected)": R(Key("cs-c"), rdescript="RStudio: Comment Line"), "next plot": R(Key("ac-f12"), rdescript="RStudio: Next Plot"), "previous plot": R(Key("ac-f11"), rdescript="RStudio: Previous Plot"), } extras = [ IntegerRefST("n", 1, 10000), ] defaults = {}
class DragonRule(MergeRule): pronunciation = "dragon" mapping = { '(lock Dragon | deactivate)': R(Playback([(["go", "to", "sleep"], 0.0)]), rdescript="Dragon: Go To Sleep"), '(number|numbers) mode': R(Playback([(["numbers", "mode", "on"], 0.0)]), rdescript="Dragon: Number Mode"), 'spell mode': R(Playback([(["spell", "mode", "on"], 0.0)]), rdescript="Dragon: Spell Mode"), 'dictation mode': R(Playback([(["dictation", "mode", "on"], 0.0)]), rdescript="Dragon: Dictation Mode"), 'normal mode': R(Playback([(["normal", "mode", "on"], 0.0)]), rdescript="Dragon: Normal Mode"), 'command mode': R(Playback([(["command", "mode", "on"], 0.0)]), rdescript="Dragon: Normal Mode"), 'com on': R(Playback([(["command", "mode", "on"], 0.0)]), rdescript="Dragon: Command Mode (On)"), 'com off': R(Playback([(["command", "mode", "off"], 0.0)]), rdescript="Dragon: Command Mode (Off)"), 'scratch': R(Playback([(["scratch", "that"], 0.0)]), rdescript="Dragon: 'Scratch That'"), "reboot dragon": R(Function(utilities.reboot), rdescript="Reboot Dragon Naturallyspeaking"), "fix dragon double": R(Function(fix_dragon_double, nexus=_NEXUS), rdescript="Fix Dragon Double Letter"), "left point": R(Playback([(["MouseGrid"], 0.1), (["four", "four"], 0.1), (["click"], 0.0)]), rdescript="Mouse: Left Point"), "right point": R(Playback([(["MouseGrid"], 0.1), (["six", "six"], 0.1), (["click"], 0.0)]), rdescript="Mouse: Right Point"), "center point": R(Playback([(["MouseGrid"], 0.1), (["click"], 0.0)]), rdescript="Mouse: Center Point"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
def __init__(self, nexus): self.nexus = nexus MergeRule.__init__( self, name="repeat that", extras=[IntegerRefST("n", 1, 50)], defaults={"n": 1}, mapping={ "again (<n> [(times|time)] | do)": R(Function(lambda n: self._create_asynchronous(n)), show=False) })
class MSWordRule(MergeRule): pronunciation = "Microsoft Word" mapping = { "insert image": R(Key("alt, n, p"), rdescript="Word: Insert Image"), } extras = [ Dictation("dict"), IntegerRefST("n", 1, 100), ] defaults = {"n": 1, "dict": "nothing"}
class lyx_mathematics(MergeRule): pronunciation = "licks maths" mapping = { BINDINGS["symbol1_prefix"] + " <symbol1>": Text("\\%(symbol1)s "), BINDINGS["symbol2_prefix"] + " <symbol2>": Text("\\%(symbol2)s "), BINDINGS["text_prefix"] + " <text_modes>": Text("\\%(text_modes)s "), BINDINGS["greek_prefix"] + " [<big>] <greek_letter>": Function(greek), BINDINGS["number_prefix"] + " <numbers>": Text("%(numbers)s"), "<misc_lyx_keys>": Key("%(misc_lyx_keys)s"), "<misc_lyx_commands>": Function(misc), "matrix <rows> by <cols>": Function(matrix), "<numbers> <denominator>": Key("a-m, f, %(n1)s, down, %(denominator)s, right"), } extras = [ IntegerRefST("rows", 1, 10), IntegerRefST("cols", 1, 10), IntegerRefST("numbers", 0, 500), Choice("big", {BINDINGS["capitals_prefix"]: True}), Choice("greek_letter", BINDINGS["greek_letters"]), Choice("symbol1", BINDINGS["tex_symbols1"]), Choice("symbol2", BINDINGS["tex_symbols2"]), Choice("text_modes", BINDINGS["text_modes"]), Choice("misc_lyx_keys", BINDINGS["misc_lyx_keys"]), Choice("misc_lyx_commands", BINDINGS["misc_lyx_commands"]), Choice("denominator", BINDINGS["denominators"]), ] defaults = { BINDINGS["capitals_prefix"]: False, }
class KDiff3Rule(MergeRule): pronunciation = "K diff" mapping = { "refresh": R(Key("f5"), rdescript="Refresh"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class JetbrainsRule(MergeRule): pronunciation = "jet brains" mapping = { "quickfix": R(Key("a-enter"), rdescript="JetBrains: Quick Fix"), "duplicate": R(Key("c-d"), rdescript="JetBrains: Duplicate"), "auto complete": R(Key("cs-a"), rdescript="JetBrains: Auto Complete"), "format code": R(Key("ca-l"), rdescript="JetBrains: Format Code"), "show doc": R(Key("c-q"), rdescript="JetBrains: Show Documentation"), "show param": R(Key("c-p"), rdescript="JetBrains: Show Parameters"), "Jen method": R(Key("a-insert"), rdescript="JetBrains: Generated Method"), "jump to source": R(Key("f4"), rdescript="JetBrains: Jump To Source"), "delete line": R(Key("c-y"), rdescript="JetBrains: Delete Line"), "search symbol": R(Key("cas-n"), rdescript="JetBrains: Search Symbol"), "build": R(Key("c-f9"), rdescript="JetBrains: Build"), "build and run": R(Key("s-f10"), rdescript="JetBrains: Build And Run"), "next tab": R(Key("a-right"), rdescript="JetBrains: Next Tab"), "prior tab": R(Key("a-left"), rdescript="JetBrains: Previous Tab"), "comment line": R(Key("c-slash"), rdescript="JetBrains: Comment Line"), "uncomment line": R(Key("cs-slash"), rdescript="JetBrains: Uncomment Line"), "select ex": R(Key("c-w"), rdescript="JetBrains: untitled command"), "select ex down": R(Key("cs-w"), rdescript="JetBrains: entitled command"), "search everywhere": R(Key("shift, shift"), rdescript="JetBrains: Search Everywhere"), "find in current": R(Key("cs-f"), rdescript="JetBrains: Find In Current"), "go to line": R(Key("c-g"), rdescript="JetBrains: Go To Line"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim": ""}
class MSVCRule(MergeRule): pronunciation = "Microsoft visual studio" mapping = { "cursor prior": R(Key("c-minus"), rdescript="MSVC: Cursor Prior"), "cursor next": R(Key("cs-minus"), rdescript="MSVC: Cursor Next"), "toggle fullscreen": R(Key("sa-enter"), rdescript="MSVC: Toggle Fullscreen"), "resolve": R(Key("c-dot"), rdescript="MSVC: Resolve"), "jump to source": R(Key("f12"), rdescript="MSVC: Jump To Source"), "snippet": R(Key("tab"), rdescript="MSVC: Snippet"), "step over [<n>]": R(Key("f10/50") * Repeat(extra="n"), rdescript="MSVC: Step Over"), "step into": R(Key("f11"), rdescript="MSVC: Step Into"), "step out [of]": R(Key("s-f11"), rdescript="MSVC: Step Out"), "resume": R(Key("f8"), rdescript="MSVC: Resume"), "build [last]": R(Key("ca-f7"), rdescript="MSVC: Build"), "debug [last]": R(Key("f5"), rdescript="MSVC: Debug"), "comment out": R(Key("c-k/50, c-c"), rdescript="MSVC: Comment Out"), "on comment out": R(Key("c-k/50, c-u"), rdescript="MSVC: Uncomment Out"), "set bookmark": R(Key("c-k, c-k"), rdescript="MSVC: Set Bookmark"), "next bookmark": R(Key("c-k, c-n"), rdescript="MSVC: Next Bookmark"), "breakpoint": R(Key("f9"), rdescript="MSVC: Breakpoint"), "format code": R(Key("cs-f"), rdescript="MSVC: Format Code"), "(do imports | import all)": R(Key("cs-o"), rdescript="MSVC: Do Imports"), "comment line": R(Key("c-slash"), rdescript="MSVC: Comment Line"), "go to line": R(Key("c-g"), rdescript="MSVC: Go To Line"), } extras = [ Dictation("text"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1}
class FlashDevelopCCR(MergeRule): pronunciation = "flash develop test" mwith = [Navigation().get_name()] mapping = { "[go to] line <n>": R(Key("c-g") + Pause("50") + Text("%(n)d") + Key("enter"), rdescript="FlashDevelop: Go To Line"), } extras = [ Dictation("text"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1}
class SQLDeveloperRule(MergeRule): pronunciation = "sequel developer" mapping = { "run this query": R(Key("f9"), rdescript="SQL Dev: Run Query"), "format code": R(Key("c-f7"), rdescript="SQL Dev: Format Code"), "comment line": R(Key("c-slash"), rdescript="SQL Dev: Comment Line"), } extras = [ Dictation("text"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1}
class fmanRule(MergeRule): pronunciation = "F man" mapping = { "select all": R(Key("c-a")), "copy": R(Key("f5")), "deselect": R(Key("c-d")), "edit": R(Key("f4")), "end": R(Key("end")), "explorer": R(Key("f10")), "go <fav>": R(Key("c-0") + Pause("15") + Text("%(fav)s") + Key("enter")), "go see": R(Key("c-p") + Pause("15") + Text("c") + Key("enter")), "go external": R(Key("c-p") + Pause("15") + Text("e") + Key("enter")), "go to": R(Key("c-p")), "move": R(Key("f6")), "new file": R(Key("s-f4")), "new folder": R(Key("f7")), "open left": R(Key("c-left")), "open right": R(Key("c-right")), "properties": R(Key("a-enter")), "refresh": R(Key("c-r")), "rename": R(Key("s-f6")), "search": R(Key("cs-f")), "(set | add) favourite": R(Key("s-f")), "show favourites": R(Key("c-0")), "(show | hide) hidden": R(Key("c-dot")), "sort [by] name": R(Key("c-f1")), "sort [by] size": R(Key("c-f2")), "sort [by] (modified | date)": R(Key("c-f3")), "stoosh path": R(Key("f11")), "terminal": R(Key("f9")), "command pallette": R(Key("cs-p")), } extras = [ IntegerRefST("num", 1, 4), Choice( "fav", { "advent": "adv", "(docks | documents)": "docs", "(downs | download)": "downs", "git caster": "gcast", "mike": "mike", "user caster": "ucast", "uni [work]": "uni", }), ] defaults = { "num": 1, }
class Alias(SelfModifyingRule): mapping = {"default command": NullAction()} toml_path = "single_aliases" pronunciation = "alias" extras = [ IntegerRefST("n", 1, 50), Dictation("s"), Dictation("textnv"), ] defaults = { "n": 1, "textnv": "", } def alias(self, spec): spec = str(spec) if spec != "": text = read_highlighted(10) if text != None: self.refresh(spec, str(text)) def vary(self, capitalization, spacing, textnv): textnv2 = textformat.TextFormat.formatted_text(capitalization, spacing, str(textnv)) Text(textnv2).execute() self.refresh(str(textnv), textnv2) def refresh(self, *args): '''args: spec, text''' aliases = utilities.load_toml_file( settings.SETTINGS["paths"]["ALIAS_PATH"]) if not Alias.toml_path in aliases: aliases[Alias.toml_path] = {} if len(args) > 0: aliases[Alias.toml_path][args[0]] = args[1] utilities.save_toml_file(aliases, settings.SETTINGS["paths"]["ALIAS_PATH"]) mapping = {} for spec in aliases[Alias.toml_path]: mapping[spec] = R( Function(context.paste_string_without_altering_clipboard, content=str(aliases[Alias.toml_path][spec]))) # R( # Text(str(aliases[Alias.toml_path][spec])), # rdescript="Alias: " + spec) mapping["alias <s>"] = R(Function(lambda s: self.alias(s)), rdescript="Create Alias") mapping["delete aliases"] = R( Function(lambda: delete_all(self, Alias.toml_path)), rdescript="Delete Aliases") self.reset(mapping)
class LyxRule(MergeRule): pronunciation = "lyx" mapping = { "new file": R(Key("c-n"), rdescript="LyX: new file"), "open file": R(Key("c-o"), rdescript="LyX: open file"), "save as": R(Key("cs-s"), rdescript="LyX: save as"), "math mode": R(Key("c-m"), rdescript="LyX: math mode"), "display mode": R(Key("cs-m"), rdescript="LyX: display mode"), "view PDF": R(Key("c-r"), rdescript="LyX: view PDF"), "update PDF": R(Key("cs-r"), rdescript="LyX: update PDF"), "move line up [<n>]": R(Key("a-up"), rdescript="LyX: move line up") * Repeat(extra="n"), "move line down [<n>]": R(Key("a-down"), rdescript="LyX: move line down") * Repeat(extra="n"), "insert <environment>": R(Key("a-i, h, %(environment)s"), rdescript="LyX: insert environment"), } extras = [ IntegerRefST("n", 1, 10), Choice( "environment", { "(in line formula | in line)": "i", "(display formula | display)": "d", "(equation array environment | equation array)": "e", "(AMS align environment | AMS align)": "a", "AMS align at [environment]": "t", "AMS flalign [environment]": "f", "(AMS gathered environment | AMS gather)": "g", "(AMS multline [environment]| multiline)": "m", "array [environment]": "y", "(cases [environment] | piecewise)": "c", "(aligned [environment] | align)": "l", "aligned at [environment]": "v", "gathered [environment]": "h", "split [environment]": "s", "delimiters": "r", "matrix": "x", "macro": "o", }), ] defaults = { "n": 1, }
class RStudioRule(MergeRule): pronunciation = "are studio" mapping = { "new file": R(Key("cs-n"), rdescript="RStudio: New File"), "open file": R(Key("c-o"), rdescript="RStudio: Open File"), "save all": R(Key("ac-s"), rdescript="RStudio: Save All"), "select all": R(Key("c-a"), rdescript="RStudio: Select All"), "find": R(Key("c-f"), rdescript="RStudio: Find"), "[go to] line <n>": R(Key("as-g") + Pause("10") + Text("%(n)s") + Key("enter"), rdescript="RStudio: Go to Line #"), "focus console": R(Key("c-2"), rdescript="RStudio: Focus Console"), "focus main": R(Key("c-1"), rdescript="RStudio: Focus Main"), "next pane": R(Key("c-f12"), rdescript="RStudio: Next pane"), "first pane": R(Key("cs-f11"), rdescript="RStudio: First pane"), "previous pane": R(Key("c-f11"), rdescript="RStudio: Previous pane"), "last pane": R(Key("cs-f12"), rdescript="RStudio: Last pane"), "close pane": R(Key("c-w"), rdescript="RStudio: Close pane"), "run (line | that)": R(Key("c-enter"), rdescript="RStudio: Run Line"), "run document": R(Key("ac-r"), rdescript="RStudio: Run Document"), "comment (line | selected)": R(Key("cs-c"), rdescript="RStudio: Comment Line"), "knit (document | file)": R(Key("cs-k")), "next plot": R(Key("ac-f12"), rdescript="RStudio: Next Plot"), "previous plot": R(Key("ac-f11"), rdescript="RStudio: Previous Plot"), "help": R(Key("c-c, c-2, question, c-v, enter, c-1")), } extras = [ IntegerRefST("n", 1, 10000), ] defaults = {}
class FoxitRule(MergeRule): pronunciation = "fox it reader" mapping = { "next tab [<n>]": R(Key("c-tab"), rdescript="Foxit Reader: Next Tab") * Repeat(extra="n"), "prior tab [<n>]": R(Key("cs-tab"), rdescript="Foxit Reader: Previous Tab") * Repeat(extra="n"), "close tab [<n>]": R(Key("c-f4/20"), rdescript="Foxit Reader: Close Tab") * Repeat(extra="n"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 1000), ] defaults = {"n": 1, "mim":""}
class ChromeRule(MergeRule): pronunciation = "google chrome" mapping = { # most keybinds are taken from https://support.google.com/chrome/answer/157179?hl=en "[new] incognito window": R(Key("cs-n"), rdescript="Browser: New Incognito Window"), "new tab [<n>]": R(Key("c-t"), rdescript="Browser: New Tab") * Repeat(extra="n"), "reopen tab [<n>]": R(Key("cs-t"), rdescript="Browser: Reopen Tab") * Repeat(extra="n"), "close all tabs": R(Key("cs-w"), rdescript="Browser: Close All Tabs"), "go back [<n>]": R(Key("a-left/20"), rdescript="Browser: Navigate History Backward") * Repeat(extra="n"), "go forward [<n>]": R(Key("a-right/20"), rdescript="Browser: Navigate History Forward") * Repeat(extra="n"), "zoom in [<n>]": R(Key("c-plus/20"), rdescript="Browser: Zoom In") * Repeat(extra="n"), "zoom out [<n>]": R(Key("c-minus/20"), rdescript="Browser: Zoom") * Repeat(extra="n"), "zoom reset": R(Key("c-0"), rdescript="Browser: Reset Zoom"), "super refresh": R(Key("c-f5"), rdescript="Browser: Super Refresh"), "switch focus [<n>]": R(Key("f6/20"), rdescript="Browser: Switch Focus") * Repeat(extra="n"), "[find] next match [<n>]": R(Key("c-g/20"), rdescript="Browser: Next Match") * Repeat(extra="n"), "[find] prior match [<n>]": R(Key("cs-g/20"), rdescript="Browser: Prior Match") * Repeat(extra="n"), "[toggle] caret browsing": R(Key("f7"), rdescript="Browser: Caret Browsing"), # now available through an add on, was a standard feature "home page": R(Key("a-home"), rdescript="Browser: Home Page"), "show history": R(Key("c-h"), rdescript="Browser: Show History"), "address bar": R(Key("c-l"), rdescript="Browser: Address Bar"), "show downloads": R(Key("c-j"), rdescript="Browser: Show Downloads"), "[add] bookmark": R(Key("c-d"), rdescript="Browser: Add Bookmark"), "bookmark all tabs": R(Key("cs-d"), rdescript="Browser: Bookmark All Tabs"), "[toggle] bookmark bar": R(Key("cs-b"), rdescript="Browser: Toggle Bookmark Bar"), "show bookmarks": R(Key("cs-o"), rdescript="Browser: Show Bookmarks"), "switch user": R(Key("cs-m"), rdescript="Browser: Switch User"), "chrome task manager": R(Key("s-escape"), rdescript="Browser: Chrome Task Manager"), "[toggle] full-screen": R(Key("f11"), rdescript="Browser: Toggle Fullscreen Mode"), "focus notification": R(Key("a-n"), rdescript="Browser: Focus Notification"), "allow notification": R(Key("as-a"), rdescript="Browser: Allow Notification"), "deny notification": R(Key("as-a"), rdescript="Browser: Deny Notification"), "developer tools": R(Key("f12"), rdescript="Browser: Developer Tools"), "view [page] source": R(Key("c-u"), rdescript="Browser: View Page Source"), "resume": R(Key("f8"), rdescript="Browser: Resume"), "step over": R(Key("f10"), rdescript="Browser: Step Over"), "step into": R(Key("f11"), rdescript="Browser: Step Into"), "step out": R(Key("s-f11"), rdescript="Browser: Step Out"), "IRC identify": R(Text("/msg NickServ identify PASSWORD"), rdescript="IRC Chat Channel Identify"), } extras = [ Dictation("dict"), IntegerRefST("n", 1, 10), ] defaults = {"n": 1, "dict": "nothing"}