Example #1
0
class StackItemConfirm(StackItemAsynchronous):
    TYPE = "confirm"
    def __init__(self, confirm, data, type=TYPE):
        StackItemAsynchronous.__init__(self, confirm, data, type)
        self.base = Pause("50") + confirm.base # TODO: fix this race condition
        self.rspec = confirm.rspec
        self.hmc_response = 0
        
    def execute(self, success):
        if self.mutable_integer["value"]==1:
            self.base.execute(self.dragonfly_data)
        self.base = None
        StackItemAsynchronous.execute(self, success)
    
    def shared_state(self, mutable_integer):
        self.mutable_integer = mutable_integer
Example #2
0
class StackItemConfirm(StackItemAsynchronous):
    TYPE = "confirm"
    def __init__(self, confirm, data, type=TYPE):
        StackItemAsynchronous.__init__(self, confirm, data, type)
        self.base = Pause("50") + confirm.base # TODO: fix this race condition
        self.rspec = confirm.rspec
        self.hmc_response = 0
        
    def execute(self, success):
        if self.hmc_response==1:
            self.base.execute(self.dragonfly_data)
        self.base = None
        StackItemAsynchronous.execute(self, success)
        
    def receive_hmc_response(self, data):
        self.hmc_response = data
        
        
        
Example #3
0
class VSCodeNonCcrRule(MappingRule):
    mapping = {
        # Moving around a file
        "[(go to | jump | jump to)] line <n>":
            R(Key("c-g") + Text("%(n)d") + Key("enter")),
        "<action> [line] <ln1> [by <ln2>]":
            R(Function(navigation.action_lines)),

        "go back <n>":
            R(Key("a-left") * Repeat(extra='n')),
        "go forward [<n>]":
            R(Key("a-right")) * Repeat(extra="n"),

        # Display
        # note that most of these can be turned on/off with the same command
        "[toggle] full screen":
            R(Key("sa-enter")),
        "toggle orientation":
            R(Key("sa-0")),
        "zoom in [<n>]":
            R(Key("c-equal") * Repeat(extra='n')),
        "zoom out [<n>]":
            R(Key("c-minus") * Repeat(extra='n')),
        "sidebar":
            R(Key("c-b")),
        "explorer":
            R(Key("cs-e")),
        "source control":
            R(Key("cs-g")),
        "keyboard shortcuts":
            R(Key("c-k, c-s")),
        "key mappings":
            R(Key("c-k, c-s:2")),
        "settings":
            R(Key("a-f, p, s, enter"), rdescript="VS Code: User/workspace Settings"),
        "snippets":
            R(Key("a-f, p, s:2, enter"), rdescript="VS Code: User Snippets"),
        "extensions":
            R(Key("cs-x")),
        "search details":
            R(Key("cs-j")),
        "output panel":
            R(Key("cs-u")),
        "markdown preview":
            R(Key("cs-v")),
        "markdown preview side":
            R(Key("c-k, v")),
        "Zen mode":
            # note: use esc esc to exit
            R(Key("c-k, z")),

        # File Management
        "copy path":
            R(Key("c-k, p")),
        "[open] command palette [<text>]":
            R(Key("cs-p") + Text("%(text)s"), rdescript="VS Code: Command Palette"),
        "(open file | go to [tab]) [<text>]":
            R(Key("c-p") + Text("%(text)s"), rdescript="VS Code: Go to File without using dialogbox"),
        "open project [<text>]":
            R(Key("c-r") + Pause("30") + Text("%(text)s")),
        "open dialogue":
            R(Key("c-o"), rdescript="VS Code: open file dialogbox"),
        "open folder":
            R(Key("c-k, c-o"), rdescript="VS Code: Open folder"),
        "Save and close":
            R(Key("c-s/10, c-w")),
        "new file":
            R(Key("c-n")),
        "new window":
            R(Key("cs-n")),
        "close window":
            R(Key("a-f4")),
        "close workspace":
            R(Key("c-k, f")),
        "close editor":
            R(Key("c-f4")),
        "save as":
            R(Key("cs-s")),
        "save all":
            R(Key("c-k, s")),
        "next tab [<n>]":
            R(Key("c-pgdown") * Repeat(extra='n')),
        "previous tab [<n>]":
            R(Key("c-pgup") * Repeat(extra='n')),
        "close tab [<n>]":
            R(Key("c-f4/20") * Repeat(extra='n')),
        "(recent | R) tab [<n>]":
            R(Key("c-tab") * Repeat(extra='n')),
        "reopen tab [<n>]":
            R(Key("cs-t") * Repeat(extra='n')),
        "Exit preview":
            R(Key("space, c-z")),
        "keep preview open":
            R(Key("c-k, enter")),
        "windows explorer here":
            R(Key("c-k, r")),
        "show active file in new window":
            R(Key("c-k, o")),

        # Search
        "(search | find)":
            R(Key("c-f")),
        "replace":
            R(Key("c-h")),
        "find in files":
            R(Key("cs-f")),
        "replace in files":
            R(Key("cs-h")),
        "next find":
            R(Key("f3")),
        "(prior | previous) find":
            R(Key("s-f3")),
        "select all occurrences":
            R(Key("a-enter")),

        "toggle case sensitive":
            R(Key("a-c"), rdescript="VS Code: Toggle Find Case Sensitive"),
        "toggle regex":
            R(Key("a-r"), rdescript="VS Code: Toggle Find Regular Expressions"),
        "toggle whole word":
            R(Key("a-w"), rdescript="VS Code: Toggle Find Whole Word"),

        "(find | jump [to]) next <text>":
            R(Function(_find_nth_token, n=1, direction="forward")),
        "(find | jump [to]) previous <text>":
            R(Function(_find_nth_token, n=1, direction="reverse")),
        "show all symbols":
            R(Key("c-t")),
        "go to symbol":
            R(Key("cs-o")),

        # Editor Management
        "close editor":
            R(Key("c-w")),
        "close folder":
            R(Key("c-k, f")),
        "split editor":
            R(Key("c-backslash")),
        "next pane":
            R(Key("c-k, c-right")),
        "(prior | previous | un) pane":
            R(Key("c-k, c-right")),
        "shift group left":
            R(Key("c-k, left"),
              rdescript="VS Code: Shift Current Group of Tabs to the Left E.g. Swap with Pane to the Left"),
        "shift group right":
            R(Key("c-k, right"),
              rdescript="VS Code: Shift Current Group of Tabs to the Right E.g. Swap with Pane to the Right"
              ),
        "<nth> tab":
            R(Key("c-%(nth)s")),

        # Languages Editing
        "go to definition":
            R(Key("f12")),
        "go to required definition":
            R(Key("c-f12:2, c-right:5, left/50, f12")),
        "peak definition":
            R(Key("a-f12")),
        "trigger parameter hints":
            R(Key("cs-space")),
        "format that":
            R(Key("c-k, c-f")),
        "(definition to side | side def)":
            R(Key("c-k, f12")),
        "show references":
            R(Key("s-f12")),
        "rename symbol":
            R(Key("f2")),
        "(trim white)":
            R(Key("c-k, c-x")),
        "change file language":
            R(Key("c-k, m")),

        # Debugging
        "debug":
            R(Key("cs-d")),
        "[toggle] breakpoint":
            R(Key("f9")),
        "step over [<n>]":
            R(Key("f10/50") * Repeat(extra='n')),
        "step into":
            R(Key("f11")),
        "step out [of]":
            R(Key("s-f11")),
        "resume":
            R(Key("f5")),
        "stopper":
            R(Key("s-f5")),
        "continue":
            R(Key("f5"), rdescript="VS Code: Start/Continue"),
        "(show hover|mouse hover|hover mouse)":
            R(Key("c-k, c-i"),
              rdescript="Show the little box as if you are hovering your mouse over the place where the cursor (As opposed to the mouse pointer) currently is"
              ),
        "[show] problems [panel]":
            R(Key("cs-m")),
        "next error":
            R(Key("f8")),  # doesn't seem to be working properly
        "(prior | previous) error":
            R(Key("s-f8")),
        "toggle tab moves focus":
            R(Key("c-m")),

        # Integrated Terminal

        "new terminal":
            R(Key("cs-backtick")),
        "terminal scroll up":
            R(Key("c-up")),
        "terminal scroll down":
            R(Key("c-down")),
        "terminal page up":
            R(Key("s-pgup")),
        "terminal page down":
            R(Key("s-pgdown")),
        "altar kick":
            R(Key("alt:down") + Mouse("left") + Key("alt:up")),

        # Collapsing
        "(fold | collapse) region":
            R(Key("cs-lbracket")),
        "(unfold | uncollapse) region":
            R(Key("cs-rbracket")),
        "(fold | collapse) [all] subregions":
            R(Key("c-k, c-lbracket")),
        "(unfold | uncollapse) [all] subregions":
            R(Key("c-k, c-rbracket")),
        "(fold | collapse) [all] regions":
            R(Key("c-k, c-0")),
        "(unfold | uncollapse) [all] regions":
            R(Key("c-k, c-j")),
        "toggle word wrap":
            R(Key("a-z")),

        "run this line":
            R(Key("csa-l")),
        "join line":
            R(Key("csa-j")),

        # requires gitlens extension
        "toggle blame":
            R(Key("cs-g, b")),
        "lens commit details":
            R(Key("cs-g, c")),
        "lens file history":
            R(Key("cs-g, h")),
        "lens repo status":
            R(Key("cs-g, s")),
        "toggle git lens":
            R(Key("cs-g, s-b")),

        # requires bookmark extension
        "mark (prev | prior | previous)":
            R(Key("ca-j")),
        "mark next":
            R(Key("ca-l")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("ln1", 1, 1000),
        IntegerRefST("ln2", 1, 1000),
        IntegerRefST("n", 1, 1000),
        Choice("action", navigation.actions),
        Choice(
            "nth", {
                "first": "1",
                "second": "2",
                "third": "3",
                "fourth": "4",
                "fifth": "5",
                "sixth": "6",
            }),
    ]
    defaults = {"n": 1, "ln2": "",  "mim": "", "text": ""}
	def _process_recognition(self, node, extras):
		os.system('"C:\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\switcher.lnk"')
		Pause("150").execute()
		Key("right/100").execute()
		Key("enter").execute()
Example #5
0
class MainRule(MergeRule):
    @staticmethod
    def generate_ccr_choices(nexus):
        choices = {}
        for ccr_choice in nexus.merger.global_rule_names():
            choices[ccr_choice] = ccr_choice
        return Choice("name", choices)

    @staticmethod
    def generate_sm_ccr_choices(nexus):
        choices = {}
        for ccr_choice in nexus.merger.selfmod_rule_names():
            choices[ccr_choice] = ccr_choice
        return Choice("name2", choices)

    mapping = {
        # Dragon NaturallySpeaking commands moved to dragon.py

        # hardware management
        "volume <volume_mode> [<n>]":
            R(Function(navigation.volume_control, extra={'n', 'volume_mode'}),
              rdescript="Volume Control"),
        "change monitor":
            R(Key("w-p") + Pause("100") + Function(change_monitor),
              rdescript="Change Monitor"),

        # window management
        'minimize':
            Playback([(["minimize", "window"], 0.0)]),
        'maximize':
            Playback([(["maximize", "window"], 0.0)]),
        "remax":
            R(Key("a-space/10,r/10,a-space/10,x"), rdescript="Force Maximize"),

        # passwords

        # mouse alternatives
        "legion [<monitor>]":
            R(Function(navigation.mouse_alternates, mode="legion", nexus=_NEXUS),
              rdescript="Activate Legion"),
        "rainbow [<monitor>]":
            R(Function(navigation.mouse_alternates, mode="rainbow", nexus=_NEXUS),
              rdescript="Activate Rainbow Grid"),
        "douglas [<monitor>]":
            R(Function(navigation.mouse_alternates, mode="douglas", nexus=_NEXUS),
              rdescript="Activate Douglas Grid"),

        # ccr de/activation
        "<enable> <name>":
            R(Function(_NEXUS.merger.global_rule_changer(), save=True),
              rdescript="Toggle CCR Module"),
        "<enable> <name2>":
            R(Function(_NEXUS.merger.selfmod_rule_changer(), save=True),
              rdescript="Toggle sm-CCR Module"),
    }
    extras = [
        IntegerRefST("n", 1, 50),
        Dictation("text"),
        Dictation("text2"),
        Dictation("text3"),
        Choice("enable", {
            "enable": True,
            "disable": False
        }),
        Choice("volume_mode", {
            "mute": "mute",
            "up": "up",
            "down": "down"
        }),
        generate_ccr_choices.__func__(_NEXUS),
        generate_sm_ccr_choices.__func__(_NEXUS),
        IntegerRefST("monitor", 1, 10)
    ]
    defaults = {"n": 1, "nnv": 1, "text": "", "volume_mode": "setsysvolume", "enable": -1}
Example #6
0
def gitPause():
    Key('escape').execute()
    Pause('20').execute()
    Key('a-f12').execute()
    Pause("40").execute()
Example #7
0
class JiraRule(MappingRule):

    mapping = {
        # Global Shortcuts
        "go to dashboards":
            R(Key("g") + Key("d")),
        "go to projects":
            R(Key("g") + Key("p")),
        "go to boards":
            R(Key("g") + Key("a")),
        "go to issues":
            R(Key("g") + Key("i")),
        # This requires a plugin
        "go to tempo [teams]":
            R(Key("g") + Key("t")),
        # This requires a plugin
        "go to portfolio":
            R(Key("p") + Key("v")),
        "quick search":
            R(Key("slash")),
        "create issue":
            R(Key("c")),
        "submit [form]":
            R(Key('as-s')),

        # Navigating Issues
        "view issue":
            R(Key("o")),
        "next (issue | item) [<nnavi10>]":
            R(Key("j"))*Repeat(extra="nnavi10"),
        "previous (issue | item) [<nnavi10>]":
            R(Key("k"))*Repeat(extra="nnavi10"),
        
        # Issue Actions
        "edit issue":
            R(Key("e")),

        "(action | actions)":
            R(Key(".")),
        # Opens the action menu and attempts the given action. If the action does not exist the menu remains open.
        # Depending on the context the verb "edit" is more natural
        "(action | edit) <action>":
            R(Key(".") + Pause("20") + Text("%(action)s") + Pause("20") + Key("enter")),

        # JIRA contains dedicated hotkeys for some operations. However, the above action command makes them redundant.
        # - assign issue
        # - comment issue
        # - edit issue labels
        # - log time
        # - assign to me
        "share issue":
            R(Key("s")),

        # Board Shortcuts
        "go to backlog":
            R(Key("1")),
        "go to sprint":
            R(Key("2")),
        "go to reports":
            R(Key("3")),
        "toggle details":
            R(Key("t")),
        "toggle presentation [mode]":
            R(Key("z")),
        "toggle swim lanes":
            R(Key("minus")),
        "send to top":
            R(Key("s") + Key("t")),
        "send to bottom":
            R(Key("s") + Key("b")),
    }

    exported = True
    extras = [
        IntegerRefST("nnavi10", 1, 11),
        Dictation("action"),
    ]
    defaults = {
        "nnavi10": 1,
        "action": "",
    }
Example #8
0
class CodeMappings(MappingRule):
    mapping = {
        # Snippets
        'text snip':
        Text("Text('')") + Pause('30') + Key('left:2'),
        'key snip':
        Text("Key('')") + Pause('30') + Key('left:2'),
        'pause snip':
        Text("Pause('')") + Pause('30') + Key('left:2'),
        'pie def':
        Text('df'),
        'in com':
        Text('# COMMAND ----------'),

        # Python
        'py com':
        Text('##############################') + Key('enter') + Text('# '),
        'py com end':
        Text('##############################') + Key('enter'),

        # debugging
        'run it':
        Key("f5"),
        'kill it':
        Key("s-f5"),
        'restart':
        Key("cs-f5"),
        'step in':
        Key('f11'),
        'step over':
        Key('f10'),
        'step out':
        Key("s-f11"),
        'breaks snap':
        Key("f9"),

        # open files
        "Open pie":
        Key("c-k,c-o,a-d") + Pause('50') +
        Text(R'C:\NatLink\NatLink\MacroSystem') + Key("enter:2"),
        "Open react":
        Key("c-k,c-o,a-d") + Pause('50') +
        Text(R"D:\GitProjects\react-components") + Key("enter:2"),
        "Open code":
        Key("c-k,c-o,a-d") + Pause('50') + Text(R"D:\GitProjects") +
        Key("enter:2"),

        # Editing
        'replace local':
        Key("c-h"),
        'replace global':
        Key("cs-h"),
        'back space':
        Key('backspace'),
        'Div <text>':
        Text('<div>%(text)s</div>'),
        'New copy':
        Key('c-c,c-v'),
        'copy down':
        Key('sa-down'),
        'Load web':
        Key('w-4') + Pause('50') + Key('f5') + Pause('50') + Key('w-5'),
        'copy line <number>':
        Key('c-g') + Text('%(number)d') + Key('enter,s-end,c-c'),
        'select line <number>':
        Key('c-g') + Text('%(number)d') + Key('enter,s-end'),
        'select multi <number>':
        Key("shift:down, ctrl:down, alt:down, down:%(number)d, shift:up, ctrl:up, alt:up,"
            ),
        # 'line <number>': Key('c-g') + Pause('5') + Text('%(number)d'),
        'line <number>':
        Key('c-g') + Text('%(number)d') + Key('enter,end'),
        # 'line <number> <n>': Key('c-g') + Text('%(number)d') + Key('enter,end') + Key('left:%(n)d'),
        'zap':
        Key("c-k,c-c"),
        'zip':
        Key("c-k,c-u"),
        'del line':
        Key("s-delete"),
        'tab <tab>':
        Key('a-%(tab)d'),
        'Change language':
        Key('c-k,m'),

        # Navigation
        'snurch':
        Key('cs-f'),
        'previ':
        Key('c-pgup'),
        'nexty':
        Key('c-pgdown'),
        'Save all':
        Key('c-k,s'),
        'Save':
        Key('c-s'),
        'see view':
        Key('cs-e'),
        'team view':
        Key('cs-g,g'),
        'term view':
        Key('cs-`'),
        'Open tab':
        Key('c-n'),
        'Sidebar':
        Key('c-b'),
        'find death':
        Key('sa-f12'),
        'goat death':
        Key('f12'),
        'Goat':
        Key('c-p'),
        'Goat funk':
        Key('cs-o'),
        'Goat prop':
        Key('cs-p'),
        'focus code':
        Key('c-j'),
        'close all':
        Key('c-k,w'),
        'close tab':
        Key('c-f4'),
        'key cuts':
        Key('c-k, c-s'),
        'rename':
        Key('f2'),
        'doneUnder':
        Text('__'),
        # '<nocaps>': Text('%(noccaps)s'),
        # Commands
        'Execute <text>':
        Key('cs-p') + Text('Execute %(text)s') +
        Key('enter'),  #Query, selected

        # git
        'get check out develop':
        Key('cs-`') + Text('inter') + Key('enter') + Pause("20") +
        Text("git co develop && git pull") + Key("enter"),
        'get check out feature':
        Key('cs-`') + Pause("20") + Text("git co feature/"),
        'get called release':
        Key('cs-`') + Text("git cob release/"),
        'get called feature':
        Key('cs-`') + Text("git cob feature/DF-"),
        'num var':
        Key("%,(,n,u,m,b,e,r,),d"),
        'get checkout <text>':
        Key('cs-`') + Text("git co %(text)s/"),
        'get merge <text>':
        Key('cs-`') + Pause("20") +
        Text("git merge --%(text)s"),  #Continue, abort
        'get merge develop':
        Key('cs-`') + Text("git merge origin/develop") + Key('enter'),
        'get commit':
        Key('cs-`') + Pause("10") + Text('git commit -am ""') + Pause("10") +
        Key('left'),
        'get push':
        Key('cs-`') + Pause("10") + Text('git push') + Pause("10") +
        Key('enter'),
        'get pull':
        Key('cs-`') + Pause("10") + Text('git pull') + Pause("10") +
        Key('enter'),
        'get branch':
        Key('cs-`') + Pause("10") + Text('git branch -r') + Pause("10") +
        Key('enter'),

        # Builds
        'yarn <text>':
        Key('cs-`') + Pause('10') + Text("yarn %(text)s") +
        Key("enter"),  #install, lint, clean, build, dev
        'build wheel':
        Key('cs-`') + Pause('10') + Text('./buildLoadWheelToCluster.sh') +
        Key('enter'),

        # 'test': bar("text"),
    }
    extras = [
        Integer('tab', 1, 20),
        Integer('number', 1, 9999),
        Integer('n', 1, 9999),
        Dictation("text"),
        Dictation("nocaps", default="").lower(),
        Dictation("camel_text", default="").camel(),
        Dictation("snaketext", default="").lower().replace(" ", "_"),
    ]
Example #9
0
    Text("ssh cas8.ping4central.com") + Key("enter"),
    "tail app logs":
    Text("cd ~") + Key("enter") + Text("current") + Key("enter") +
    Text("tail -f log/*.log") + Key("enter"),
    "tail (torquebox|torque box) log":
    Text("tail -f /var/log/torquebox/torquebox.log") + Key("enter"),
    "tail development logs":
    Text("tail -f log/development.log") + Key("enter"),
    "tail postgres (log|logs)":
    Text("tail -f /var/log/postgresql/postgresql*.log") + Key("enter"),
    "edit ssh config":
    Text("vim ~/.ssh/config") + Key("enter"),
    "(open|start) program":
    DynamicAction(Key("a-space"), Key("f1")),
    "(open|start) program <text>":
    DynamicAction(Key("a-space"), Key("f1")) + Pause("30") +
    Function(lib.format.lowercase_text),

    # Custom vocabulary.
    "nerve drum":
    Text("nirvdrum"),
    "chat laugh":
    Text("Heh."),
    "J ruby":
    Text("jruby"),
    "you tills":
    Text("utils"),
    "firefox you tills":
    Text("FirefoxUtils"),
    "IE 601":
    Text("ie601"),
Example #10
0
class CodeMappings(MappingRule):
    mapping = {
        'close tab':
        Key('c-w'),
        'open tab':
        Key('c-t'),
        'restore tab':
        Key('cs-t'),
        'last tab':
        Key('cs-t'),
        'book snap':
        Key('cs-b'),
        'book add':
        Key('c-d'),
        'tab <tab>':
        Key('c-%(tab)d'),
        'down <number>':
        Key('down:%(number)d'),
        'up <number>':
        Key('up:%(number)d'),
        'down':
        Key('down'),
        'up':
        Key('up'),
        'downy':
        Key('d'),
        'upy':
        Key('u'),
        'go back':
        Key('a-left'),
        'go forward':
        Key('a-right'),
        'load':
        Key('f5'),
        'snurch':
        Key('c-l'),

        # code - bricks
        'line nip':
        Key('c-slash'),
        'run me':
        Key('c-enter'),
        'run it':
        Key('s-enter'),
        'run up':
        Key('sa-up'),
        'run down':
        Key('sa-down'),
        'nexty':
        Key('c-pgdown'),
        'previ':
        Key('c-pgup'),
        'insert up':
        Key('ca-p'),
        'insert down':
        Key('ca-n'),
        'insert display':
        Key('ca-p') + Pause('100') + Text('display('),
        'split cell':
        Key('ca-n'),
        'copy cell':
        Key('ca-c'),
        'cut cell':
        Key('ca-x'),
        'del cell':
        Key('ca-d'),
        'del line':
        Key('s-delete'),
        'cell down':
        Key('ca-down'),
        'indent me':
        Key('c-]'),
        'dedent me':
        Key('c-['),
        'find me':
        Key('ca-f'),
        'paste wheel':
        Text('dbfs:/FileStore/jars/passlist-1.0.0-py3-none-any.whl'),

        #snippets
        'magic mark':
        Key('percent, m, d, space, #,#'),
        'magic run':
        Key('percent, r, u, n, space'),
        'con blob':
        Key('percent, r, u, n, space') + Text(' "../ConnectBlob"'),
        'snip display':
        Text('display('),
        'snip alias':
        Text(".alias('')") + Key('left:2'),
        'snip show':
        Text(".show()"),
        'snip select':
        Text(".select("),

        #azure
        'Open bricks':
        Key("c-t") + Text(
            R'https://adb-1477701841953214.14.azuredatabricks.net/?o=1477701841953214#joblist'
        ) + Key("enter"),
    }
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 99999),
        Dictation("text"),
        Dictation("pascal_text", default="").title().replace(" ", ""),
    ]
Example #11
0
def visual_studio_action(s):
    return toggle_vim() + focus_search() + Text(s) + Pause('10') + Key('enter/10') + toggle_vim()
Example #12
0
class AcrobatRule(MappingRule):
    mapping = {
        "[go to] page <n>":
        R(Key("a-v, n, g/15") + Text("%(n)s") + Key("enter")),
        "set zoom <n>":
        R(Key("c-y/40") + Text("%(n)s") + Key("enter")),
        "open file":
        R(Key("c-o")),
        "duplicate tab":
        R(Key("a-w,n/40,ws-left")),
        "enable scrolling":
        R(Key("a-v, p, c")),
        "(disable scrolling | single page mode)":
        R(Key("a-v, p, s")),
        "next tab [<n>]":
        R(Key("c-tab")) * Repeat(extra="n"),
        "prior tab [<n>]":
        R(Key("cs-tab")) * Repeat(extra="n"),
        "home button":
        R(Mouse("[100, 101], left")),  # coordinates may be user dependent

        # Sticky Note Commands
        # must have the cursor over the location where you want the sticky note
        "add note [<dict>]":
        R(Mouse("right") + Key("t/5") + Text("%(dict)s")),
        "fast [add] note [<dict>]":
        R(
            Mouse("right") + Key("t/5") + Text("%(dict)s") + Pause("10") +
            Key("escape/5, c-s")),
        "open blank note":
        R(Mouse("right") + Key("t/5")),
        "add blank note":
        R(Mouse("right") + Key("t/5, escape/5, c-s")),
        "delete note":
        R(Mouse("right") + Key("l, c-s")),
        "go back [<n>]":
        R(Key("a-left")) * Repeat(extra='n'),
        "save as":
        R(Key("a-f, a")),

        # when you open up a document that you have previously saved, and then click save,
        # Adobe will sometimes make you go back into the save dialogbox
        # and choose the location you want to save it in and then make you say that you want
        # to overwrite the file. This is annoying, but this command "fast save" will automatically
        # do all that for you.
        "fast save":
        R(Key("c-s/10, enter/10, enter/10, left, enter")),

        # if page down goes too far down then try this command
        "down it [<n>]":
        R(Key("pgdown:%(n)s, up:4")),
        "up it [<n>]":
        R(Key("pgup:%(n)s, down:4")),
        "tools pane":
        R(_SHOW_HIDE_MENU + Key("t")),
        "menu bar":
        R(_SHOW_HIDE_MENU + Key("m")),
        "model tree":
        R(_SHOW_HIDE_MENU + Key("n, e")),
        "bookmarks":
        R(_SHOW_HIDE_MENU + Key("n, b")),
        "[page] thumbnails":
        R(_SHOW_HIDE_MENU + Key("n, b")),
        "rotate [<n>]":
        R(Key("c-plus")) * Repeat(extra='n'),

        # Scrolling Commands
        # Acrobat has a built-in scrolling function with nine speeds.
        # Unfortunately, there are not separate commands for our scrolling up and down
        # You have to start by scrolling in the most recently used direction and then reverse the direction
        "scroll <speed_one_to_nine>":
        R(Key("cs-h/2, %(speed_one_to_nine)s")),
        "scroll":
        R(Key("cs-h/2, 6")),
        "change speed <speed_one_to_nine>":
        R(Key("%(speed_one_to_nine)s, %(speed_one_to_nine)s")),
        "reverse [direction]":
        R(Key("minus")),
        "stop [scrolling]":
        R(Key("escape")),

        # cursor commands
        # (must enable "you single key accelerators to access tools" by going to: edit -> preferences -> general)
        "highlight":
        R(Key("u")),
        "hand tool":
        R(Key("h")),
        "select tool":
        R(Key("v")),
    }
    extras = [
        Dictation("dict"),
        IntegerRefST("n", 1, 1000),
        IntegerRefST("m", 1, 9),
        IntegerRefST("speed_one_to_nine", 1, 9),
    ]
    defaults = {"n": 1, "dict": "nothing"}
Example #13
0
class RStudioRule(MappingRule):
    mapping = {
        "new file":
        R(Key("cs-n")),
        "open file":
        R(Key("c-o")),
        "open recent project":
        R(Key("a-f, j")),
        "open project":
        R(Key("a-f, n, enter")),
        "save all":
        R(Key("ac-s")),
        "select all":
        R(Key("c-a")),
        "find":
        R(Key("c-f")),
        "[go to] line <ln1>":
        R(Key("as-g") + Pause("10") + Text("%(ln1)s") + Key("enter")),
        "<action> [line] <ln1> [by <ln2>]":
        R(
            Function(navigation.action_lines,
                     go_to_line="as-g/10",
                     select_line_down="s-down",
                     wait="/3",
                     upon_arrival="home, ")),
        "focus console":
        R(Key("c-2")),
        "focus main":
        R(Key("c-1")),
        "next tab":
        R(Key("c-f12")),
        "first tab":
        R(Key("cs-f11")),
        "previous tab":
        R(Key("c-f11")),
        "last tab":
        R(Key("cs-f12")),
        "close tab":
        R(Key("c-w")),
        "run line":
        R(Key("c-enter")),
        "run document":
        R(Key("ac-r")),
        "comment (line | selected)":
        R(Key("cs-c")),
        "next plot":
        R(Key("ac-f12")),
        "previous plot":
        R(Key("ac-f11")),
        "(help | document) that":
        R(Store() + Key("c-2, question") + Retrieve() + Key("enter, c-3")),
        "glimpse that":
        R(Store() + Key("c-2") + Retrieve() +
          Key("space, percent, rangle, percent") + Text(" glimpse()") +
          Key("enter/50, c-1")),
        "vee table that":
        R(Store() + Key("c-2") + Text("library(vtable)") + Key("enter/50") +
          Retrieve() + Key("space, percent, rangle, percent") +
          Text(" vtable()") + Key("enter/50, c-1")),
    }
    extras = [
        IntegerRefST("ln1", 1, 10000),
        IntegerRefST("ln2", 1, 10000),
        Choice("action", navigation.actions),
    ]
    defaults = {"ln2": ""}
Example #14
0
 def __init__(self, confirm, data, type=TYPE):
     StackItemAsynchronous.__init__(self, confirm, data, type)
     self.base = Pause("50") + confirm.base  # TODO: fix this race condition
     self.rspec = confirm.rspec
     self.hmc_response = 0
Example #15
0
class VisualModeCommands(MappingRule):
    mapping = {
        "slap":
        Key('enter'),
        '[<n>] <optional_count_motion>':
        Text('%(n)d') + Key('%(optional_count_motion)s'),
        '<no_count_motion>':
        Key('%(no_count_motion)s'),
        '<ln> <mandatory_count_motion>':
        Text('%(ln)d') + Key('%(mandatory_count_motion)s'),
        '<text_object_selection>':
        Key('%(text_object_selection)s'),
        '[<n>] <find_motion>':
        Text('%(n)d') + Key('%(find_motion)s'),
        'other':
        Key('o'),
        'other side':
        Key('O'),
        "Center":
        Key("z,dot"),
        "replace <letter>":
        Key("r,%(letter)s"),
        'Mark <letter>':
        Key('m,%(letter)s'),
        'jump <letter>':
        Key('backtick,%(letter)s'),
        'jump old':
        Key('c-o'),
        'jump new':
        Key('c-i'),
        "reverse inside singles":
        Text("/)?'.\\{-}'\n") + Pause('30') + Key('l'),
        "reverse inside doubles":
        Text('?".\\{-}"\n') + Pause('30') + Key('l'),
        "inside singles":
        Text("/'.\\{-}'\n") + Pause('30') + Key('l'),
        "inside doubles":
        Text('/".\\{-}"\n') + Pause('30') + Key('l'),
        "inside parens":
        Text("/(\n") + Pause('30') + Key('l'),
        "inside brackets":
        Text("/\\[\n") + Pause('30') + Key('l'),
        "inside braces":
        Text("/{\n") + Pause('30') + Key('l'),
        "inside angles":
        Text("/<\n") + Pause('30') + Key('l'),
        '(after|outside) parens':
        Text('/)\nl'),
        '(after|outside) brackets':
        Text('/]\nl'),
        '(after|outside) braces':
        Text('/}\nl'),
        '(after|outside) singles':
        Text('/\'\nl'),
        '(after|outside) doubles':
        Text('/"\nl'),
        '(after|outside) angles':
        Text('/>\nl'),
        'after dot':
        Text('/\\.\nl'),
        'after comma':
        Text('/,\nl'),
        "cursor top":
        Key("s-h"),
        "cursor middle":
        Key("s-m"),
        "cursor (low | bottom)":
        Key("s-l"),
        "search <text>":
        Key("slash/10") + Text("%(text)s\n"),
        "search this":
        Key("asterisk"),
        "shift search <text>":
        Key("question/10") + Text("%(text)s\n"),
    }
    extras = [
        Dictation("text"),
        IntegerRef("n", 1, 101, default=1),
        ShortIntegerRef("ln", 1, 10000, default=1),
        ShortIntegerRef("lm", 1, 10000, default=1),
        LetterRef('letter'),
        Choice('no_count_motion', no_count_motion_keys),
        Choice('optional_count_motion', optional_count_motion_keys),
        Choice('mandatory_count_motion', mandatory_count_motion_keys),
        Choice('text_object_selection', text_object_keys),
        FindMotionRef('find_motion'),
        Choice('register', register_keys, default='dquote'),
        Choice('paired_symbol', paired_symbol_keys),
        Choice('paired_symbols', paired_symbols_keys),
    ]
Example #16
0
class NormalModeCommands(MappingRule):
    mapping = {
        "kay":
        Key("escape"),
        "slap":
        Key('enter'),
        '[<n>] <optional_count_motion>':
        Text('%(n)d') + Key('%(optional_count_motion)s'),
        '<no_count_motion>':
        Key('%(no_count_motion)s'),
        '<ln> <mandatory_count_motion>':
        Text('%(ln)d') + Key('%(mandatory_count_motion)s'),
        '[<n>] <find_motion>':
        Text('%(n)d') + Key('%(find_motion)s'),
        '[<n>] lower case <optional_count_motion>':
        Text('%(n)d') + Key("g,u") + Key('%(optional_count_motion)s'),
        'lower case <no_count_motion>':
        Key("g,u") + Key('%(no_count_motion)s'),
        '[<n>] lower case <text_object_selection>':
        Text('%(n)d') + Key("g,u") + Key('%(text_object_selection)s'),
        '<ln> lower case <mandatory_count_motion>':
        Text('%(ln)d') + Key("g,u") + Key('%(mandatory_count_motion)s'),
        '[<n>] lower case <find_motion>':
        Text('%(n)d') + Key("g,u") + Key('%(find_motion)s'),
        '[<n>] upper case <optional_count_motion>':
        Text('%(n)d') + Key("g,U") + Key('%(optional_count_motion)s'),
        'upper case <no_count_motion>':
        Key("g,U") + Key('%(no_count_motion)s'),
        '[<n>] upper case <text_object_selection>':
        Text('%(n)d') + Key("g,U") + Key('%(text_object_selection)s'),
        '<ln> upper case <mandatory_count_motion>':
        Text('%(ln)d') + Key("g,U") + Key('%(mandatory_count_motion)s'),
        '[<n>] upper case <find_motion>':
        Text('%(n)d') + Key("g,U") + Key('%(find_motion)s'),
        "(swap case|tilde)":
        Key("tilde"),
        "Center":
        Key("z,dot"),
        "[<n>] Dell <optional_count_motion> [register <register>]":
        Text('%(n)d') + Key('dquote,%(register)s,d,%(optional_count_motion)s'),
        "Dell <no_count_motion> [register <register>]":
        Key('dquote,%(register)s,d,%(no_count_motion)s'),
        '[<n>] Dell <text_object_selection> [register <register>]':
        Text('%(n)d') + Key('dquote,%(register)s,d,%(text_object_selection)s'),
        '[<n>] Dell <find_motion> [register <register>]':
        Text('%(n)d') + Key('dquote,%(register)s,d,%(find_motion)s'),
        "[<n>] Pete macro":
        Key("at,at:%(n)d"),
        "[<n>] join":
        Key("J:%(n)d"),
        '[<n>] deed':
        Text('d%(n)dd'),
        "Dell pair":
        Key("m,z,percent,m,y,percent,x,backtick,y,x,backtick,z,left"),
        "[<n>] (increment|increase)":
        Key("c-a:%(n)d"),
        "[<n>] (decrement|decrease)":
        Key("c-x:%(n)d"),
        "shift Dell":
        Key("s-d"),

        # to do: how to make commands undoable in a single keystroke
        "[<n>] undo":
        Key("u:%(n)d"),
        "[<n>] redo":
        Key("c-r:%(n)d"),
        "[<n>] (yank|copy) <optional_count_motion> [register <register>]":
        Text('%(n)d') + Key('dquote,%(register)s,y,%(optional_count_motion)s'),
        "(yank|copy) <no_count_motion> [register <register>]":
        Key('dquote,%(register)s,y,%(no_count_motion)s'),
        '[<n>] (yank|copy) <text_object_selection> [register <register>]':
        Text('%(n)d') + Key('dquote,%(register)s,y,%(text_object_selection)s'),
        '[<n>] (yank|copy) <find_motion> [register <register>]':
        Text('%(n)d') + Key('dquote,%(register)s,y,%(find_motion)s'),
        '[<n>] (duplicate|dupe) [line]':
        Text('Y%(n)dp'),
        "(yank|copy) line [register <register>]":
        Key("dquote,%(register)s,y,y"),
        "(yank|copy) <n> lines [register <register>]":
        Key("dquote,%(register)s") + Text("%(n)dY"),
        "(paste|put) [register <register>]":
        Key("dquote,%(register)s,p"),
        "(shift|big) (paste|put) [register <register>]":
        Key("dquote,%(register)s,P"),
        "replace <letter>":
        Key("r,%(letter)s"),
        "[<n>] (shift left|unindent)":
        Text('%(n)d') + Key("langle,langle"),
        "[<n>] (shift right|indent)":
        Text('%(n)d') + Key("rangle,rangle"),
        'Mark <letter>':
        Key('m,%(letter)s'),
        'jump <letter>':
        Key('backtick,%(letter)s'),
        'jump old':
        Key('c-o'),
        'jump new':
        Key('c-i'),
        '<ln> thru <lm> comment':
        mark('z') + go_line('lm') + mark('y') + go_line('ln') + Text('V') +
        jump_mark('y') + Key('c-slash') + Key('escape') + jump_mark('z'),
        '<ln> thru <lm> (copy|yank)':
        Key('colon/10') + Text("%(ln)d,%(lm)dy\n"),

        # Pete is shorthand for repeat
        "[<n>] Pete":
        Key("dot:%(n)d"),
        "reverse inside singles":
        Text("/)?'.\\{-}'\n") + Pause('30') + Key('l'),
        "reverse inside doubles":
        Text('?".\\{-}"\n') + Pause('30') + Key('l'),
        "inside singles":
        Text("/'.\\{-}'\n") + Pause('30') + Key('l'),
        "inside doubles":
        Text('/".\\{-}"\n') + Pause('30') + Key('l'),
        "inside parens":
        Text("/(\n") + Pause('30') + Key('l'),
        "inside brackets":
        Text("/\\[\n") + Pause('30') + Key('l'),
        "inside braces":
        Text("/{\n") + Pause('30') + Key('l'),
        "inside angles":
        Text("/<\n") + Pause('30') + Key('l'),
        "transpose":
        Key("x, p"),
        '(after|outside) parens':
        Text('/)\nl'),
        '(after|outside) brackets':
        Text('/]\nl'),
        '(after|outside) braces':
        Text('/}\nl'),
        '(after|outside) singles':
        Text('/\'\nl'),
        '(after|outside) doubles':
        Text('/"\nl'),
        '(after|outside) angles':
        Text('/>\nl'),
        'after dot':
        Text('/\\.\nl'),
        'after comma':
        Text('/,\nl'),
        "[<n>] strip <paired_symbol>":
        Text('%(n)d') +
        Key("dquote,z,d,i,%(paired_symbol)s,left,2,x,dquote,z,P"),
        "[<n>] swap <swap_quotes>":
        Function(swap_quotes_action),
        'surround <text_object_selection> with <paired_symbols>':
        Key('dquote,z,d,%(text_object_selection)s,i,%(paired_symbols)s,escape,dquote,z,P'
            ),
        'record macro':
        Key('q,a'),
        'stop recording':
        Key('q'),
        'play macro':
        Key('at,a'),
        "window left":
        Key("c-w,h"),
        "window right":
        Key("c-w,l"),
        "window up":
        Key("c-w,k"),
        "window down":
        Key("c-w,j"),
        "window split":
        Key("c-w,s"),
        "window vertical split":
        Key("c-w,v"),
        "[<n>] table (next|right)":
        Key("g,t/10") * Repeat('n'),
        "[<n>] table (previous|left)":
        Key("g,T/10") * Repeat('n'),
        "cursor top":
        Key("s-h"),
        "cursor middle":
        Key("s-m"),
        "cursor (low | bottom)":
        Key("s-l"),
        "search <text>":
        Key("slash/10") + Text("%(text)s\n"),
        "shift search <text>":
        Key("question/10") + Text("%(text)s\n"),
        "search this":
        Key("asterisk"),
        '[<n>] swap up [<m> lines]':
        Text('%(n)d') + Key('d,d') + Text('%(m)d') + Key('k,P'),
        '[<n>] swap down [<m> lines]':
        Text('%(n)d') + Key('d,d') + Text('%(m)d') + Key('j,P'),
    }
    extras = [
        Dictation("text"),
        IntegerRef("n", 1, 101, default=1),
        IntegerRef('m', 1, 101, default=1),
        ShortIntegerRef("ln", 1, 10000, default=1),
        ShortIntegerRef("lm", 1, 10000, default=1),
        LetterRef('letter'),
        Choice('no_count_motion', no_count_motion_keys),
        Choice('optional_count_motion', optional_count_motion_keys),
        Choice('mandatory_count_motion', mandatory_count_motion_keys),
        Choice('text_object_selection', text_object_keys),
        FindMotionRef('find_motion'),
        Choice('register', register_keys, default='dquote'),
        Choice('paired_symbol', paired_symbol_keys),
        Choice('paired_symbols', paired_symbols_keys),
        Choice('swap_quotes',
               choices={
                   "(double quote|D quote|doubles)": "dquote",
                   "(quote|singles)": "squote",
               })
    ]
Example #17
0
def ACP(command):
    """Utilize the Palette UI to execute commands."""
    return R(Key("cs-p") + Pause(str(atom_palette_wait)) + Text(command) + Key("enter"))
Example #18
0
class MergeRule(MappingRule):
    @staticmethod
    def _get_next_id():
        if not hasattr(MergeRule._get_next_id, "id"):
            MergeRule._get_next_id.id = 0
        MergeRule._get_next_id.id += 1
        return MergeRule._get_next_id.id

    @staticmethod
    def get_merge_name():  # returns unique str(int) for procedural rule names
        return str(MergeRule._get_next_id())

    mapping = {"hello world default macro": Pause("10")}
    '''MergeRules which define `pronunciation` will use
    the pronunciation string rather than their class name
    for their respective enable/disable commands'''
    pronunciation = None
    '''MergeRules which define `non` will instantiate
    their paired non-CCR MergeRule and activate it 
    alongside themselves'''
    non = None
    '''MergeRules which define `mcontext` with a 
    Dragonfly AppContext become non-global; this
    is the same as adding a context to a Grammar'''
    mcontext = None
    '''app MergeRules MUST define `mwith` in order to
    define what else they can merge with -- this is an
    optimization to prevent pointlessly large global
    CCR copies; mwith is a list of get_pronunciation()s'''
    mwith = None

    def __init__(self,
                 name=None,
                 mapping=None,
                 extras=None,
                 defaults=None,
                 exported=None,
                 ID=None,
                 composite=None,
                 compatible=None,
                 mcontext=None,
                 mwith=None):

        self.ID = ID if ID is not None else MergeRule._get_next_id()
        self.compatible = {} if compatible is None else compatible
        '''composite is the IDs of the rules which this MergeRule is composed of: '''
        self.composite = composite if composite is not None else set([self.ID])
        self._mcontext = self.__class__.mcontext
        if self._mcontext is None: self._mcontext = mcontext
        self._mwith = self.__class__.mwith
        if self._mwith is None: self._mwith = mwith

        if mapping is not None:
            mapping["display available commands"] = Function(
                lambda: self._display_available_commands())

        MappingRule.__init__(self, name, mapping, extras, defaults, exported)

    def __eq__(self, other):
        if not isinstance(other, MergeRule):
            return False
        return self.ID == other.ID

    ''' "copy" getters used for safe merging;
    "actual" versions used for filter functions'''

    def mapping_copy(self):
        return self._mapping.copy()

    def mapping_actual(self):
        return self._mapping

    def extras_copy(self):
        return self._extras.copy()

    def extras_actual(self):
        return self._extras

    def defaults_copy(self):
        return self._defaults.copy()

    def defaults_actual(self):
        return self._defaults

    def merge(self, other):
        mapping = self.mapping_copy()
        mapping.update(other.mapping_copy())
        extras_dict = self.extras_copy()
        extras_dict.update(
            other.extras_copy())  # not just combining lists avoids duplicates
        extras = extras_dict.values()
        defaults = self.defaults_copy()
        defaults.update(other.defaults_copy())
        context = self._mcontext if self._mcontext is not None else other.get_context(
        )  # one of these should always be None; contexts don't mix here
        return MergeRule(
            "Merged" + MergeRule.get_merge_name() + self.get_pronunciation()[0] +
            other.get_pronunciation()[0],
            mapping,
            extras,
            defaults,
            self._exported and other._exported,  # no ID
            composite=self.composite.union(other.composite),
            mcontext=context)

    def get_pronunciation(self):
        return self.pronunciation if self.pronunciation is not None else self.name

    def copy(self):
        return MergeRule(self.name, self._mapping.copy(), self._extras.values(),
                         self._defaults.copy(), self._exported, self.ID, self.composite,
                         self.compatible, self._mcontext, self._mwith)

    def compatibility_check(self, other):
        if other.ID in self.compatible:
            return self.compatible[other.ID]  # lazily
        compatible = True
        for key in self._mapping.keys():
            if key in other.mapping_actual().keys():
                compatible = False
                break
        self.compatible[other.ID] = compatible
        other.compatible[self.ID] = compatible
        return compatible

    def incompatible_IDs(self):
        return [ID for ID in self.compatible if not self.compatible[ID]]

    def get_context(self):
        return self._mcontext

    def set_context(self, context):
        self._mcontext = context

    def get_merge_with(self):
        return self._mwith

    def _display_available_commands(self):
        for spec in self.mapping_actual().keys():
            print(spec)  # do something fancier when the ui is better
Example #19
0
class AtomRule(MappingRule):
    """
    Commands for the Atom editor.

    `R(Key("command keys"))`
        Registers a key and label combination for use in a voice commands.
    `ACP("command name")`
        Registers an Atom Palette Command and label combination for use in voice commands.

    Spoken commands that are commented out do not have assigned default shortcut keys or
    are incompatible. The '#extra' subsection of commands are commands that fit within
    the category but are not displayed by the menu or UI Legend: '#' for not assigned,
    '##' for shortcut or functional duplicate.
    """

    mapping = {
        # Menu UI------------------------------------------------------------------------
        #File Menu
        "[open] new window":
            R(Key("cs-n")),
        "new file":
            R(Key("c-n")),
        "open file":
            R(Key("c-o")),
        "open folder":
            R(Key("cs-o")),
        "add project folder":
            R(Key("ac-o")),
        "open settings":
            R(Key("c-comma")),
        "reopen closed item":
            ACP("Reopen Closed Item"),
        "open [your] config":
            ACP("Open Your Config"),
        "open [your] int script":
            ACP("Open Your Int Script"),
        "open [your] key map":
            ACP("Open Your Key Map"),
        "open [your] snippet":
            ACP("Open Your Snippet"),
        "open [your] style sheet":
            ACP("Open your Stylesheet"),
        "save as":
            R(Key("cs-s")),
        "save all":
            ACP("Save All"),
        "close pane":
            R(Key("c-k, c-w")),
        "close pane others":
            R(Key("c-k, ca-w")),
        "close window":
            R(Key("cs-w")),
        #Extra
        #Edit Menu
        "copy path":
            R(Key("cs-c")),
        "select all":
            R(Key("c-a")),
        "[toggle] (comments | comment line)":
            R(Key("c-slash")),
        "reflow section":
            R(Key("ac-q")),
        "select encoding":
            R(Key("cs-u")),
        "[go to] line <ln1>":
            R(
                Key("c-g") + Pause(str(atom_palette_wait)) + Text("%(ln1)s") +
                Key("enter")),
        "<action> [line] <ln1> [by <ln2>]":
            R(Function(navigation.action_lines)),
        "select grammar":
            R(Key("cs-l")),
        #Lines Submenu
        "toggle out dent":
            R(Key("c-rightbrace")),
        "auto indent windows":
            ACP("Window Auto Indent"),
        "[move] line up [<n>]":
            R(Key("c-up")*Repeat(extra="n")),
        "[move] line down [<n>]":
            R(Key("c-down")*Repeat(extra="n")),
        "delete line [<n>]":
            R(Key("cs-k")*Repeat(extra="n")),
        "join line":
            R(Key("c-j")),
        #Text Submenu
        "uppercase":
            ACP("Editor Upper Case"),
        "lowercase":
            ACP("Editor Lower Case"),
        "delete sub [word] [<n>]":
            R(Key("a-backspace")*Repeat(extra="n")),
        "delete [to] previous [word] [<n>]":
            ACP("Delete to Previous Word boundary")*Repeat(extra="n"),
        "delete [to] next [word] [<n>]":
            ACP("Delete to Next Word Boundary")*Repeat(extra="n"),
        "transpose":
            ACP("Transpose"),
        #Folding Submenu
        "fold":
            R(Key("ac-lbrace")),
        "unfold":
            R(Key("ac-rightbrace")),
        "unfold all":
            R(Key("c-k, c-0, acs-rightbrace")),
        "fold [level] <n2>":
            R(Key("c-k, c-%(n2)s")),
        #Bookmarks Submenu
        "view (all | [all] bookmarks)":
            R(Key("c-f2")),
        "bookmark | book":
            R(Key("ca-f2")),
        "next (bookmark | book)":
            R(Key("f2")),
        "previous (bookmark | book)":
            R(Key("s-f2")),
        #View Menu
        "reload file":
            R(Key("ac-r")),
        "full screen":
            R(Key("f11")),
        "toggle menu bar":
            ACP("Toggle Menu Bar"),
        "increase font [size] [<n>]":
            R(Key("cs-equals")*Repeat(extra="n")),
        "decrease font [size] [<n>]":
            R(Key("cs-minus")*Repeat(extra="n")),
        "reset font [size]":
            R(Key("c-0")),
        "toggle soft wrap":
            ACP("Toggle Soft Wrap"),
        "[toggle] tree view":
            R(Key("c-backslash")),
        #Panes Submenu
        "split [pane] above":
            R(Key("c-k, up")),
        "split [pane] below":
            R(Key("c-k, down")),
        "split [pane] left":
            R(Key("c-k, left")),
        "split [pane] right":
            R(Key("c-k, right")),
        "[focus [on]] next pane":
            R(Key("c-k, c-n")),
        "[focus [on]] previous pane":
            R(Key("c-k, c-p")),
        "(focus [on] [pane] | pane) above":
            R(Key("c-k, c-up")),
        "(focus [on] [pane] | pane) below":
            R(Key("c-k, c-down")),
        "(focus [on] [pane] | pane) left":
            R(Key("c-k, c-left")),
        "(focus [on] [pane] | pane) right":
            R(Key("c-k, c-right")),
        #extras
        "[go to] pane [item] <n2>":
            R(Key("a-%(n2)s")),
        "[go to] <nrw> (tab | pane [item])":
            R(Key("a-%(nrw)s")),
        #Developer Submenu
        #"open in development mode":    R(Key("", "Open in Development Mode")),
        "run atom [specs]":
            R(Key("ac-s")),
        "run package [specs]":
            R(Key("ac-p")),
        "[toggle] developer tools":
            R(Key("ac-i")),
        #Selection Menu
        "[add] select above [<n>]":
            R(Key("ac-up")*Repeat(extra="n")),
        "[add] select below [<n>]":
            R(Key("ac-down")*Repeat(extra="n")),
        "split into lines":
            ACP("Split Into Lines"),
        "select line":
            R(Key("c-l")),
        "[select] [to] (begin | beginning) [of] line":
            ACP("Editor: Select to Beginning of Line"),
        "[select] inside brackets":
            R(Key("ac-comma")),
        #Find Menu
        "find (selection | selected)":
            R(Key("c-e")),
        "find [and] select all":
            R(Key("a-f3")),
        "[find] select next [<n>]":
            R(Key("c-d")*Repeat(extra="n")),
        "[find] select skip [this] [<n>]":
            R(Key("c-k, c-d")*Repeat(extra="n")),
        "[find] select skip next [<n>]":
            R(Key("c-d")) + R(Key("c-k, c-d")*Repeat(extra="n")),
        "find replace next":
            ACP("Find and Replace: Replace Next"),
        "find replace all":
            ACP("Find and Replace: Replace All"),
        "find buffer":
            R(Key("c-b")),
        "(find | go to) file":
            R(Key("c-p")),
        "find modified file":
            R(Key("cs-b")),
        #Packages Menu
        #Bracket Matcher Submenu
        "bracket [go to] match":
            R(Key("c-m")),
        "bracket remove [from] selection":
            R(Key("c-lbrace")),
        "close [current] tag":
            ACP("Bracket Matcher: Close Tag"),
        "bracket remove matching":
            R(Key("ac-backspace")),
        #Command Palette Submenu
        "[toggle] [command] palette":
            R(Key("cs-p")),
        #Dev Live Reload Submenu
        "reload [all] styles":
            R(Key("acs-r")),
        #Git Diff Submenu
        "move to next diff [different]":
            ACP("Move to Next Diff"),
        "move to previous diff [different]":
            ACP("Move to Previous Diff"),
        "[toggle] diff List":
            ACP("Toggle Diff List"),
        #Keybinding Resolver Submenu
        "toggle key [binding] resolver":
            ACP("Key Binding Resolver: Toggle"),
        #Markdown Preview Submenu
        "markdown preview":
            R(Key("cs-m")),
        #Extras
        "markdown copy html":
            ACP("Markdown Preview: Copy HTML"),
        "markdown toggle break on new line":
            ACP("Markdown Preview: Toggle Break On Single Newline"),
        #Package Generator Submenu
        "(make|generate) package":
            ACP("Package Generator: Generate Package"),
        "(make|generate) syntax theme":
            ACP("Package Generator: Generate Syntax Theme"),
        #Settings View Submenu
        ##"open setting":                             R(Key("c-comma")),
        "show key bindings":
            ACP("Settings View: Show Key Bindings"),
        "installed themes":
            ACP("Settings View: Installed Themes"),
        "uninstalled themes":
            ACP("Settings View: Uninstall Themes"),
        "installed packages":
            ACP("Settings View: Installed Packages"),
        "uninstalled packages":
            ACP("Settings View: Uninstalled Packages"),
        "search (packages|themes)":
            ACP("Settings View: Install Packages and Themes"),
        "update packages":
            ACP("Settings View: Check for Package Update"),
        #Snippets Submenu
        "expand snippets":
            ACP("Snippets: Expand"),
        "next snippet":
            R(Key("tab")),
        "previous snippet":
            R(Key("a-tab")),
        "available snippet":
            R(Key("as-tab")),
        #Styleguide Submenu
        "show style [guide]":
            R(Key("cs-g")),
        #Symbol
        "find symbol":
            R(Key("c-r")),
        "project symbol":
            R(Key("cs-r")),
        #Timecop Submenu
        "time cop":
            ACP("Timecop: View"),
        #Tree View Submenu
        "tree focus":
            R(Key("c-0")),
        "tree [View] [toggle] view":
            R(Key("c-backslash")),
        "tree [View] [reveal] active file":
            R(Key("cs-backslash")),
        "tree [View] [toggle] side":
            ACP("Tree View: show"),
        #Extras
        "tree show":
            ACP("Tree View: Show"),
        "tree rename":
            ACP("Tree View: Rename"),
        "tree remove":
            ACP("Tree View: Remove"),
        "tree add file":
            ACP("Tree View: Add File"),
        "tree duplicate":
            ACP("Tree View: Duplicate"),
        "tree add folder":
            ACP("Tree View: Add Folder"),
        #Whitespaces Submenu
        "remove trailing [white] spaces":
            ACP("Whitespace: Remove Trailing Whitespace"),
        "convert tabs [to] spaces":
            ACP("Whitespace: Convert Tabs to Spaces"),
        "convert spaces [to] tabs":
            ACP("Whitespace: Convert Spaces to Tabs"),
        #Open on GitHub
        "github [open] blame":
            ACP("Open on GitHub: Blame"),
        "github [open] [branch] compare":
            ACP("Open on GitHub: Branch Compare"),
        "github [open] [copy] URL":
            ACP("Open on GitHub: Copy URL"),
        "github [open] file":
            ACP("Open on GitHub: File"),
        "github [open] history":
            ACP("Open on GitHub: History"),
        "github [open] issues":
            ACP("Open on GitHub: Issues"),
        "github [open] repository":
            ACP("Open on GitHub: Repository"),
        #Open on GitHub
        "github close different":
            ACP("GitHub: Close All Diff Views"),
        "github empty different":
            ACP("GitHub: Close Empty Diff Views"),
        "github [show waterfall] diagnostics":
            ACP("GitHub:Okay Show Waterfall Diagnostics"),
        "github [open] (issues | pull request)":
            ACP("GitHub: Open Issue or Pull Request"),
        "github view staged changes [for current file]":
            ACP("GitHub: View Staged Changes for Current File"),
        "github view unstaged changes [for current file]":
            ACP("GitHub: View Unstaged Changes for Current File"),
        #Open on GitHub
        "github pull":
            R(Key("a-g, s-f")),
        "github push":
            R(Key("a-g, p")),
        "github clone":
            R(Key("a-g, equal")),
        "github fetch":
            R(Key("a-g, f")),
        "github logout":
            ACP("GitHub: Logout"),
        "github force push":
            R(Key("a-g, s-p")),
        "github tab [toggle]":
            R(Key("c-8")),
        "github focus [tab]":
            R(Key("c-9")),
        # Atom Development
        "dev (restart | reload) [atom]":
            ACP("Window: Reload"),

        # ----Atom Optional Third-Party Packages and Dependencies-----------------------------------------------------------------------------
        #Install through command prompt, Atom install manager or a .bat file at http://tinyurl.com/Atom-Dependencies
        # pip install --upgrade autopep8T
        # apm install project-sidebar
        # apm install project-manager
        # apm install git-plus
        # apm install script
        # apm install atom-beautify
        # apm install goto-last-edit
        # apm install tab-numbers
        # apm install menu-manager
        # apm install string-looper
        # apm install toggle-quotes
        # apm install delete-Plus
        # apm install expand-selection-to-quotes
        # apm install highlight-selected
        # apm install sublime-style-column-selection

        #Atom Third-Party Package Commands-------------------------------------------------------------------------------------------------
        #Atom Beautify
        "beautify editor":
            ACP("Atom Beautify: Beautify Editor"),
        "beautify migrate settings":
            ACP("Atom Beautify: Migrate Settings"),
        "beautify debug editor":
            ACP("Atom Beautify: Help Debug Editor"),
        #Toggle Quotes
        "toggle quotes":
            R(Key("cs-apostrophe")),
        #Script
        "script run":
            ACP("Script: Run"),
        "script [run] options":
            ACP("Script: Run Options"),
        "script [run] profile":
            ACP("Script: Run With Profile"),
        "script run [by] line":
            ACP("Script: Run By Line Number"),
        "script kill [process]":
            ACP("Script: Kill Process"),
        "script close view":
            ACP("Script: Close View"),
        "script copy [run] [results]":
            ACP("Script: Copy Run Results"),
        #"script close window and stop script":     ACP("Script: Close Window and Stop Script"),
        #Delete Plus
        "delete words":
            ACP("Delete Plus: Delete"),
        #Last Edit
        "back edit":
            R(Key("c-i")),
        "next edit":
            R(Key("ca-i")),
        #Looper
        #"cursor loud|capitalize [<n3>]":           R(Key("a-down") * Repeat(extra="n")), # Not fully implemented
        #"cursor camel [<n4>]":                     R(Key("a-down") * Repeat(extra="n")), # Not fully implemented
        #"cursor lowercase [<n5>]":                 R(Key("a-down") * Repeat(extra="n")), # Not fully implemented
        "looping down cursor":
            R(Key("a-down")),
        "looping up cursor":
            R(Key("a-up")),
        "looping up":
            R(Key("wa-up")),
        #Git Plus
        "git (custom|run)":
            ACP("Git Plus: Run"),
        "git log":
            ACP("Git Plus: Log"),
        "git log current [file]":
            ACP("Git Plus: Log Current File"),
        "git status":
            ACP("Git Plus: Status"),
        "git show":
            ACP("Git Plus: Show"),
        "git tags":
            ACP("Git Plus: Tags"),
        "git open changed files":
            ACP("Git Plus: Git Open Changed Files"),
        "git checkout [branch|tag]":
            ACP("Git Plus: Checkout"),
        "git menu":
            ACP("Git Plus: Menu"),
        "git pull":
            ACP("Git Plus: Pull"),
        "git pull [using] rebase":
            ACP("Git Plus: Pull Using Rebase"),
        "git push":
            ACP("Git Plus: Push"),
        "git commit":
            ACP("Git Plus: Commit"),
        "git commit amend":
            ACP("Git Plus: Commit Amend"),
        "git merge":
            ACP("Git Plus: Merge"),
        "git merge remote":
            ACP("Git Plus: Merge Remote"),
        "git diff":
            ACP("Git Plus: Diff"),
        "git diff all":
            ACP("Git Plus: Diff All"),
        "git add":
            ACP("Git Plus: Add"),
        "git add all":
            ACP("Git plus: Add All"),
        "git add [and] commit":
            ACP("Git Plus: Add And Commit"),
        "git add all [and] commit":
            ACP("Git Plus: Add All and Commit"),
        "git add all commit [and] push":
            ACP("Git Plus: Add All Commit And Push"),
        "git new branch":
            ACP("Git Plus: New Branch"),
        "git (rm|remove)":
            ACP("Git Plus: Remove"),
        #Project Manager
        "project manager [list]":
            ACP("Project Manager:List"),
        "project manager save":
            ACP("Project Manager:Save Project"),
        "project manager edit":
            ACP("Project Manager:Edit Project"),
        #Menu Sidebar
        "[project manager] sidebar":
            ACP("Project Sidebar: Toggle"),
        #Expand Selection to Quotes
        "(expand|fill) quotes":
            R(Key("c-apostrophe")),
        #Auto Complete
        "auto [complete]":
            R(Key("c-space")),
        #Highlight Selected---- #Placeholder
        #Sublime Style Column Selection---- #Placeholder

        #Atom | Dragonfly Development--------------------------------------------------------------------------------------------------------------------------------------------------------
        # Template to create more commands. Documentation: https://dragonfly.readthedocs.org/en/latest/actions.html and http://castervoice.readthedocs.io/en/latest/castervoice/doc/Intro/
        # Used for basic key shortcuts
        #"text for voice command":               R(Key("modifier-key", "program name: command name/description")),
        #"":                                     R(Key("")),
        # Used for command that utilizes the "command palette" shortcut in the absence of assigned keyboard shortcut.
        #"text for voice command":               ACP("text as described in command palette", "command name/description"),
        #"":                                     ACP(""),
        #Atom Shortcut Snippets
        "dev keys [input] [<n>]":
            R(Text('#"": R(Key("-"),') + Key("enter"))*Repeat(extra="n"),
        "dev [command] palette [<n>]":
            R(Text('#"": ACP(""),') + Key("enter"))*Repeat(extra="n"),
        #Repeatable Snippets
        "dev numb keys [input] [<n>]":
            R(Text('#" [<n>]": R(Key("-") * Repeat(extra="n"),') + Key("enter"))*
            Repeat(extra="n"),
        "dev numb [command] palette [<n>]":
            R(Text('#" [<n>]": ACP("") * Repeat(extra="n"),') + Key("enter"))*
            Repeat(extra="n"),
        #Basic Dragonfly Snippets
        "dev key [<n>]":
            R(Text('"": Key(""),'))*Repeat(extra="n"),
        "dev text [<n>]":
            R(Text('"": Text(""),'))*Repeat(extra="n"),
        "send command [<n>]":
            R(Text('"": R(Function(SendJsonCommands, a_command=""), rdescript=""),'))*
            Repeat(extra="n"),
    }

    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("n", 1, 50),
        IntegerRefST("ln1", 1, 50000),
        IntegerRefST("ln2", 1, 50000),
        IntegerRefST("n2", 1, 10),
        Choice("action", navigation.actions),
        Choice(
            "nrw", {
                "first": 1,
                "second": 2,
                "third": 3,
                "fourth": 4,
                "fifth": 5,
                "sixth": 6,
                "seventh": 7,
                "eighth": 8,
                "(ninth | last)": 9,
            }),
    ]
    defaults = {
        "n": 1,
        "ln2": "",
        "mim": "",
    }
Example #20
0
class VoiceDevCommands(MergeRule):
    pronunciation = "voice dev commands"

    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":
            R(Text('Text("")') + Key("left:2"), rdescript="DragonflyDev: Snippet for Text Action"),
        "dev pause":
            R(Text('Pause("")') + Key("left:2"), rdescript="DragonflyDev: Snippet for Pause Action"),
        "dev function":
            R(Text("Function()") + Key("left")),
        "dev repeat":
            R(Text(" * Repeat(extra='n')"), rdescript="DragonflyDev: Snippet for Repeat"),
        "dev choice":
            R(Text('Choice("", {') + Pause("10") + Key("enter, up, right:4"),
              rdescript="DragonflyDev: Snippet for the Choice Extra"),
        "dev mouse [<mouse_button>]":
            R(Function(type_mouse), rdescript="DragonflyDev: Snippet for Mouse Click Command"),
        "dev mouse current [position]":
            R(Function(type_mouse_current),
              rdescript="DragonflyDev: Snippet for Making a Command for Clicking at the Current Cursor Position"),
        "dev execute": R(Key("end")+Text(".execute()"),
            rdescript="call 'execute' method at end of line"),

        # Caster Snippets
        "dev bring app":
            R(Text("BringApp()") + Key("left"), rdescript="CasterDev: Snippet for Bring App"),
        "dev descript":
            R(Text(' rdescript="MyGrammar: "') + Key("left"), rdescript="CasterDev: Add the rdescript"),

        # Snippets for emulating Dragonfly or Caster recognition.
        "dev mimic [<text>]":
            R(Function(type_mimic),
              rdescript="DragonflyDev: Snippet for Mimic"),
        "dev playback [<text>]": # This command has been inconsistent.
            # maybe because it's automatically putting in two of each parable character e.g. brackets
            R(Function(type_playback),
              rdescript="DragonflyDev: Snippet for Playback"),
        "dev split dictation [<text>]":
            R(Function(type_split_dictation),
              rdescript="DragonflyDev: Puts Quotes Around Each Word and Separated by Commas"),

        # Dragonfly Development: Standard dragonfly commands
        "command [<spec>] key":
            R(Text('"%(spec)s": Key(""),') + Key("left:3"),
              rdescript="DragonflyDev: Automatically Create Key Command with Given Spec"),
        "command [<spec>] key repeat":
            R(Text('"%(spec)s [<n>]": Key("") * Repeat(extra="n"),') + Key("left:23"),
              rdescript="DragonflyDev: Automatically Create Repeatable Key Command with Given Spec"),
        "command [<spec>] text":
            R(Text('"%(spec)s": Text(""),') + Key("left:3"),
              rdescript="DragonflyDev: Automatically Create Text Command with Given Spec"),
        "command [<spec>] [bring] app":
            R(Text('"%(spec)s": BringApp(),') + Key("left"),
              rdescript="DragonflyDev: Automatically Create Bring App with Given Spec"),
        "command [<spec>] function":
            R(Text('"%(spec)s": Function()') + Key("left"),
              rdescript="DragonflyDev: Automatically Create Function Command with Given Spec"),
        "command [<spec>] mimic [<text>]":
            R(Text('"%(spec)s": ,') + Key("left") + Function(type_mimic),
              rdescript="DragonflyDev: Automatically Create Mimic Command with Given Spec"),
        "command [<spec>] playback [<text>]":# This command has been inconsistent.
                                             # maybe because it's automatically putting in two of each parable character e.g. bracket
                                             # might have to adjust it depending on the editor
            R(Text('"%(spec)s": ,') + Key("left") + Function(type_playback),
              rdescript="DragonflyDev: Automatically Create Playback Command with Given Spec"),
        "command [<spec>] mouse [<mouse_button>]": # for some reason the above command is not putting in the left click by default.
                                                   # perhaps someone can fix this
            R(Text('"%(spec)s": ,') + Key("left") + Function(
                type_mouse_current_position_button, extra={"mouse_button"}),
                rdescript="DragonflyDev: Automatically Create a Command to Click at the Current Mouse Position with Given Spec"),


        # Caster Development: commands uses the caster standard format with the R and rdescript.
        # Use Editors 'find and replace' to edit 'MyGrammar' to application or grammar name.
        # maybe somebody knows how to make it so that you can tab through the relevant places
        "commander [<spec>] key":
            R(Text('"%(spec)s": R(Key(""), rdescript="MyGrammar: "') + Key("right, comma") +
              Key("left:18"),
              rdescript="CasterDev: Automatically Create Key Command with Given Spec"),
        "commander [<spec>] key repeat":
            R(Text('"%(spec)s [<n>]": R(Key(""), rdescript="MyGrammar: "') + Key("right") +
              Text(" * Repeat(extra='n'),") + Key("left:38"),
              rdescript="CasterDev: Automatically Create Repeatable Key Command with Given Spec"),
        "commander [<spec>] text":
            R(Text('"%(spec)s": R(Text(""), rdescript="MyGrammar: "') + Key("right, comma") +
              Key("left:18"),
              rdescript="CasterDev: Automatically Create Text Command with Given Spec"),
        "commander [<spec>] [bring] app":
            R(Text('"%(spec)s": R(BringApp(), rdescript="MyGrammar: "') + Key("right, comma") +
              Key("left:17"),
              rdescript="CasterDev: Automatically Create Bing App Command with Given Spec"),
        "commander [<spec>] function":
            R(Text('"%(spec)s": R(Function(), rdescript="MyGrammar: "') + Key("right, comma") +
              Key("left:17"),
              rdescript="CasterDev: Automatically Create Function Command with Given Spec"),
        "commander [<spec>] mimic [<text>]":
            R(Text('"%(spec)s": R(') + Function(type_mimic) + Text(', rdescript="MyGrammar: "') +
              Key("right, comma, left:3"),
              rdescript="CasterDev: Automatically Create Mimic Command with Given Spec"),
        "commander [<spec>] mouse [<mouse_button>]":
            R(Text('"%(spec)s": R(') + Function(type_mouse_current_position_button,
              extra={"mouse_button"}) + Key("right") + Text(', rdescript=""') + Key("right, comma, left:3"),
              rdescript="CasterDev: Automatically Create Command to Click at Current Mouse Position with Given Spec"),
            # I couldn't get "commander [<spec>] playback [<text>]" to work
            # "commander [<spec>] playback [<text>]": Text('"%(spec)s": R(')
            #   + Function(type_playback) + Key("down:2") + Text(", rdescript=''") + Key("right, comma, left:3"),
    }

    extras = [
        new_modifier_choice_object,
        Choice("combined_button_dictionary",
               Navigation.combined_button_dictionary),
        Dictation("text"),
        Dictation("dict"),
        Dictation("spec"),
        Choice("mouse_button", {
            "left": "left",
            "right": "right",
            "middle": "middle",
        }),
        Choice("left_right", {
            "left": "left",
            "right": "right",
        }),
        Choice("up_down", {
            "up": "up",
            "down": "down",
        }),
        IntegerRefST("distance_1", 1, 500),
        IntegerRefST("distance_2", 1, 500),
    ]
    defaults = {"spec": "", "dict": "", "text": "", "mouse_button": ""}
Example #21
0
def selectAndMove(dest):
    Key("x/30,v/30").execute()
    Text(dest).execute()
    Pause("50").execute()
    Key("enter").execute()
Example #22
0
class CodeMappings(MappingRule):
    mapping = {
        # Snippets
        'crag test snip':
        Text('text'),
        'key snip':
        Text('key') + Pause('50') + Key('tab'),
        'pause snip':
        Text('pau') + Pause('50') + Key('tab'),
        'pie def':
        Text('def'),
        'in com':
        Text('# COMMAND ----------'),
        'if main':
        Text("if __name__ == '__main__':"),

        # Python
        'py commment':
        Text('##############################') + Key('enter') + Text('# '),
        'py commment end':
        Text('##############################') + Key('enter'),

        # debugging
        'run it':
        Key("s-f10"),
        'bug it':
        Key("s-f9"),
        'play it':
        Key("f9"),
        'kill it':
        Key("c-f2"),
        # 'restart': Key("cs-f5"),
        'step in':
        Key('as-f7'),
        'step over':
        Key('f8'),
        'step out':
        Key("s-8"),
        'step to':
        Key("a-f9"),
        'break snap':
        Key("c-f8"),
        'break mute':
        Key("cas-f8"),

        # open files
        "Open pie":
        Key("c-k,c-o,a-d") + Pause('50') +
        Text(R'C:\NatLink\NatLink\MacroSystem') + Key("enter:2"),
        "Open react":
        Key("c-k,c-o,a-d") + Pause('50') +
        Text(R"D:\GitProjects\react-components") + Key("enter:2"),
        "Open code":
        Key("c-k,c-o,a-d") + Pause('50') + Text(R"D:\GitProjects") +
        Key("enter:2"),
        'open scratch':
        Key("cas-insert") + Text('py') + Key('enter'),

        # Editing
        'get usage':
        Key("a-f7"),
        'replace global':
        Key("cs-r"),
        'back space':
        Key('backspace'),
        'Div <text>':
        Text('<div>%(text)s</div>'),
        'Open folder':
        Key('c-k,c-o'),
        'New copy':
        Key('c-c,c-v'),
        'copy down':
        Key('c-d'),
        'move up':
        Key('cs-up'),
        'move down':
        Key('cs-down'),
        'Load web':
        Key('w-4') + Pause('50') + Key('f5') + Pause('50') + Key('w-5'),
        'copy line <number>':
        Key('c-g') + Text('%(number)d') + Key('enter,s-end,c-c'),
        'select line <number>':
        Key('c-g') + Text('%(number)d') + Key('enter,s-end'),
        'select multi <number>':
        Key("shift:down, ctrl:down, alt:down, down:%(number)d, shift:up, ctrl:up, alt:up,"
            ),
        # 'line <number>': Key('c-g') + Pause('5') + Text('%(number)d'),
        'line <number>':
        Key('c-g') + Pause('15') + Text('%(number)d') + Key('enter') +
        Pause('10') + Key('end'),
        # 'line <number> <n>': Key('c-g') + Text('%(number)d') + Key('enter,end') + Key('left:%(n)d'),
        'zap':
        Key("c-k,c-c"),
        'meow':
        Key("c-k,c-u"),
        'nick':
        Key("a-left"),
        'del line':
        Key("s-delete"),
        'tab <number>':
        Key('c-t,%(number)d'),
        # 'pin it': Key('c-It,%(number)d'),
        'Change language':
        Key('c-k,m'),
        'py Phi':
        Key('a-insert,p,f, enter'),
        'py package':
        Key('a-insert,p, enter'),
        'py directory':
        Key('a-insert,d, enter'),
        'open in files':
        Key('csa-o'),
        'Reload disk':
        Key('ca-y'),
        'bug con':
        Key('csa-r'),

        # Re-factorring
        'loot':
        Key('a-enter'),
        'loot hint':
        Key('c-q'),
        'loot method':
        Key('ca-m'),
        'loot Sig':
        Key('c-f6'),
        'loot do':
        Key('a-d'),
        'loot move':
        Key('f6'),
        'loot surround':
        Key('ca-t'),
        'loot up':
        Key('cs-up'),
        'loot down':
        Key('cs-down'),
        'to do':
        Text('# TODO:'),

        # Navigation
        'snurch':
        Key('cs-f'),
        'snurch win':
        Key('csa-y'),
        'previ':
        Key('a-left'),
        'nexty':
        Key('a-right'),
        # 'Save all': Key('c-k,s'),
        # 'Save': Key('c-s'),
        'clean code':
        Key('ca-l'),
        'clean file':
        Key('cas-l'),
        'Edit config':
        Key('csa-e '),
        'select run':
        Key('c-s, c-r'),

        # views
        'commit view':
        Key('a-0'),
        'see view':
        Key('a-1'),
        'see hide':
        Key('s-escape'),
        'favorite view':
        Key('a-2'),
        'find view':
        Key('a-3'),
        'run view':
        Key('a-4'),
        'bug view':
        Key('a-5'),
        'prob view':
        Key('a-6'),
        'con view':
        Key('a-7'),
        'git view':
        Key('a-9'),
        'see match':
        Key('a-f1,1'),
        'see minus':
        Key('c-minus'),
        'see plus':
        Key('c-plus'),
        'set view':
        Key('ca-s'),
        'term view':
        Key("a-f12"),
        'book view':
        Key("s-f11"),
        'break view':
        Key("cs-f8"),
        'sigh view':
        Key('a-2'),
        'sigh pan':
        Text('.limit(20).toPandas()') + Key('enter'),
        'to pan':
        Text('.toPandas()') + Key('enter'),
        'show me':
        Text('.show()') + Key('enter'),
        'count me':
        Text('.count()') + Key('enter'),

        # Navigation
        # 'Open tab': Key('c-n'),
        'book snap':
        Key('f11'),
        'book snap <number>':
        Key('c-f11') + Pause('50') + Key('%(number)d'),
        'book <number>':
        Key('c-%(number)d'),
        'find death':
        Key('sa-f12'),
        'goat in':
        Key('ca-b'),
        'Goat':
        Key('shift,shift'),
        'Goater':
        Key('c-e'),
        'Goat funk':
        Key('cs-o'),
        'Goat prop':
        Key('cs-p'),
        'close all':
        Key('cs-f4'),
        'close tab':
        Key('c-f4'),
        'close others':
        Key('cas-f4'),
        'close pin':
        Key('cas-p'),
        'close right':
        Key('cas-r'),
        'pin it':
        Key('cas-q'),
        'key cuts':
        Key('c-k, c-s'),
        'rename':
        Key('s-f6'),
        'doneUnder':
        Text('__'),
        'quote':
        Text("'"),
        'Eck':
        Text(" = "),
        'py con':
        Key('cs-u'),
        'replace':
        Key('c-r'),
        # '<nocaps>': Text('%(noccaps)s'),
        # Commands
        'Execute <text>':
        Key('cs-p') + Text('Execute %(text)s') +
        Key('enter'),  #Query, selected

        # terminal navigation
        'cd <lowtext>':
        Function(gitPause) + Text('cd %(lowtext)s') + Key('enter'),
        'cd back':
        Function(gitPause) + Text('cd ..') + Key('enter'),
        'cd <number>':
        Function(repeat) + Key('enter'),

        # git
        'get check out main':
        Function(gitPause) + Text("git co main && git pull && git fetch") +
        Key("enter"),
        'get check out feature':
        Function(gitPause) + Text("git co feature/"),
        'get fetch':
        Function(gitPause) + Text("git fetch") + Key('enter'),
        'get called <nospace>':
        Function(gitPause) + Text("git cob %(nospace)s/"),
        'get called ticket':
        Function(gitPause) + Text("git cob feature/DP-"),
        'get checkout <text>':
        Function(gitPause) + Text("git co %(text)s/"),
        'get merge <text>':
        Function(gitPause) + Text("git merge --%(text)s"),  #Continue, abort
        'get merge develop':
        Function(gitPause) + Text("git merge origin/develop") + Key('enter'),
        'get merge main':
        Function(gitPause) + Text("git merge origin/main") + Key('enter'),
        'get tags':
        Function(gitPause) + Text('git tag -l --sort=-v:refname') +
        Key('enter'),
        'get tag pass':
        Function(gitPause) + Text('git tag passlist/'),
        'get tag push':
        Text(' & git push origin --tag') + Key('enter'),
        'get commit':
        Function(gitPause) + Text('git commit -am ""') + Pause("10") +
        Key('left'),
        'get commit wip':
        Function(gitPause) + Text('git commit -am wip') + Key('enter'),
        'get push yes':
        Function(gitPause) + Text('git push') + Pause("10") + Key('enter'),
        'get push':
        Function(gitPause) + Text('git push --no-verify') + Pause("10") +
        Key('enter'),
        'Get push menu':
        Key("c-g,p"),
        'get pull':
        Function(gitPause) + Text('git pull') + Pause("10") + Key('enter'),
        'get branch':
        Function(gitPause) + Text('git branch -r') + Pause("10") +
        Key('enter'),
        'get branches':
        Key('cs-`'),
        'get branch delete':
        Key('shift,shift') + Text('delete old branch') + Key('enter'),
        'get discard':
        Function(gitPause) + Text("git checkout -- .") + Pause("10") +
        Key('enter'),
        'get stash <text>':
        Function(gitPause) + Text("git stash %(text)s") +
        Key("enter"),  #drop/pop
        'get stash':
        Function(gitPause) + Text("git stash") + Key("enter"),  #drop/pop
        'get prune':
        Function(gitPause) + Text("git remote prune origin") + Key("enter"),
        'get PR':
        Key("cs-x,p"),
        'get recent':
        Key("as-c"),
        'get add':
        Key("ca-a"),

        # bazel
        'bay shut down':
        Function(gitPause) + Text("bazel shutdown") + Key("enter"),
        'bay version':
        Function(gitPause) + Text("bazel version") + Key("enter"),
        'bay build':
        Function(gitPause) + Text("bazel build "),

        # tests
        'test all':
        Function(gitPause) + Text("python -m unittest") +
        Key("enter"),  #drop/pop

        #pip
        'pip install':
        Function(gitPause) + Text("pipenv install") + Key('enter'),
        'pip develop':
        Function(gitPause) + Text("pipenv install --dev") + Key('enter'),
        'pip run':
        Function(gitPause) + Text("pipenv run "),
        'pip instally':
        Function(gitPause) + Text("pipenv install '-e .'"),
        'pip install edit':
        Function(gitPause) + Text("pipenv install --editable "),
        'pip list':
        Function(gitPause) + Text("pipenv run pip list") + Key('enter'),
        'pip shell':
        Function(gitPause) + Text("pipenv shell") + Key('enter'),
        'pip sync':
        Function(gitPause) + Text("pipenv run Develop") + Key('enter'),
        'pip exit':
        Function(gitPause) + Text("exit") + Key('enter'),

        # databricks cli
        'bricks <nocaps>':
        Function(gitPause) + Text("databricks %(nocaps)s"),
        'bricks secrets':
        Function(gitPause) + Text("databricks secrets list-scopes") +
        Key('enter'),
        'bricks scopes':
        Function(gitPause) + Text("databricks secrets list --scope"),
        'bricks connect':
        Function(gitPause) + Text("databricks-connect configure"),
        'bricks test':
        Function(gitPause) + Text("databricks-connect test"),
        'bricks push':
        Function(gitPause) +
        Text("databricks workspace import_dir . /passlist -o") + Key('enter'),

        # docker
        'dock list':
        Function(gitPause) + Text('docker ps -a') + Key('enter'),
        'dock rem':
        Function(gitPause) + Text('docker rm'),
        'dock start':
        Function(gitPause) + Text('docker start'),
        'dock stop':
        Function(gitPause) + Text('docker stop'),
        'dock logs':
        Function(gitPause) + Text('docker logs'),
        'dock compose':
        Function(gitPause) + Text('docker-compose up') + Key('enter'),
        'dock build ':
        Function(gitPause) + Text('docker-compose up --build') + Key('enter'),
        'dock to air':
        Function(gitPause) +
        Text('docker exec -it airflow_airflow-webserver_1 bash') +
        Key('enter'),
        # 'dock red': Function(gitPause) + Text('docker run --name redis -p 6379:6379 -d redis') + Key('enter'),
        # 'dock start red': Function(gitPause) + Text('docker start redis') + Key('enter'),

        # Builds
        'yarn <text>':
        Key('csa-t') + Pause('10') + Text("yarn %(text)s") +
        Key("enter"),  #install, lint, clean, build, dev
        'load wheel':
        Function(gitPause) + Text('loadWheel.sh') + Key('enter'),
        'build wheel':
        Function(gitPause) + Text('buildWheel.sh') + Key('enter'),

        # 'test': bar("text"),
    }
    extras = [
        Integer('number', 1, 9999),
        Integer('numberdot', 1, 9999),
        Integer('n', 1, 9999),
        Dictation("text"),
        Dictation("nocaps", default="").lower(),
        Dictation("camel_text", default="").camel(),
        Dictation("snaketext", default="").lower().replace(" ", "_"),
        Dictation("nospace", default="").lower().replace(" ", ""),
        Dictation("lowtext", default="").lower(),
    ]
Example #23
0
def pycharm_action(s):
    return Key("cs-a/10") + Text(s) + Pause("50") + Key("enter")
Example #24
0
class VisualStudioMappings(MappingRule):
    mapping = {
        # temp
        'Add navigation':
        Text('~/Views/Navigation/Header/Navigation'),
        'Add header':
        Text('~/Views/Navigation/Header'),
        'Add Extension':
        Text('.cshtml'),

        # Bookmarks
        'book <number>':
        Key("c-%(number)s"),
        'book <number> snap':
        Key("cs-%(number)s"),
        'book view':
        Key("c-`,"),

        # Navigation
        'snurch':
        Key("cs-f"),
        'goat death':
        Key('c-f12'),
        'peak death':
        Key('a-f12'),
        'view recent':
        Key('c-comma'),
        'view edits':
        Key('cs-comma'),
        'line <number>':
        Key("c-g") + Text("%(number)s") + Key("enter,end"),
        'close all':
        Key("a-minus") + Pause('50') + Key('a'),
        'close pinned':
        Key("a-minus") + Pause('50') + Key('down:6, enter'),
        'pin tab':
        Key("a-minus") + Pause('50') + Key('p'),
        'save all':
        Key("cs-s"),
        'delete line':
        Key("s-delete"),
        'Sink dock':
        Key("c-[,s"),
        'goat':
        Key("c-t"),
        'X open':
        Key("ca-l"),
        'PM open':
        Key("alt,t,n,o"),
        'tab select':
        Key('ctrl:down,tab'),
        'pick <number>':
        Key('down:%(number)s, enter, ctrl:up'),

        # Debugging
        'step in':
        Key('f5'),
        'step over':
        Key('f10'),
        'step out':
        Key("s-f11"),
        'Break snap':
        Key("f9"),
        'Break view':
        Key("ca-b"),
        'Run it':
        Key("f5"),
        'Attach <number>':
        Key("c-r,c-%(number)s"),
        'watch <number>':
        Key('ca-w,%(number)s'),
        'tests run':
        Key('c-r,c-t'),
        'test debug':
        Key('c-u,c-d'),
        'Blossom':
        Key("cs-b"),
        'blessed load':
        Key("cs-b") + Pause('800') + Key('w-4') + Pause('50') + Key('c-1,f5') +
        Pause('50') + Key('w-6'),
        'Load web':
        Key('w-4') + Pause('50') + Key('c-1,f5') + Pause('50') + Key('w-6'),

        # editing
        'Blossom':
        Key("cs-b"),
        'blessed load':
        Key("cs-b") + Pause('800') + Key('w-4') + Pause('50') + Key('c-1,f5') +
        Pause('50') + Key('w-6'),
        'Load web':
        Key('w-4') + Pause('50') + Key('c-1,f5') + Pause('50') + Key('w-6'),
        'surround with':
        Key('c-e, c-u'),
        'line comment':
        Key('c-k,c-c'),
        'line uncomment':
        Key('c-k,c-u'),
        'Replace all':
        Key('a-a'),
        'goat replace':
        Key('c-h'),
        'Clean code':
        Key('c-e,c-f'),
        'add class':
        Key('ca-insert, down:6, enter'),
        'add controller':
        Key('ca-insert,enter'),

        # git
        'get called <number> <dashtext>':
        Key("alt,t,n,o") + Text("git cob feature/DF-%(number)s-%(dashtext)s"),
        'get check out develop':
        Key("alt,t,n,o") + Text("git co develop") + Key("enter"),
        'get check out <nospace>':
        Key("alt,t,n,o") + Text("git co %(nospace)s/"),
        'get check out MC':
        Key("alt,t,n,o") + Text("git co feature/new-mcapi-integration") +
        Key('enter'),
        'get discard':
        Key("alt,t,n,o") + Text("git checkout -- .") + Key("enter"),
        'get merge <text>':
        Key("alt,t,n,o") + Text("git merge --%(text)s") +
        Key("enter"),  #Abort, merge
        'get merge develop':
        Key("alt,t,n,o") + Text("git merge origin/develop") + Key("enter"),
        'get merge feature':
        Key("alt,t,n,o") + Text("git merge feature/DF-"),
        'get pull':
        Key("alt,t,n,o") + Text("git pull") + Key("enter"),
        'get push':
        Key("alt,t,n,o") + Text("git push") + Key("enter"),
        'get stash':
        Key("alt,t,n,o") + Text("git stash") + Key("enter"),
        'get stash <text>':
        Key("alt,t,n,o") + Text("git stash %(text)s") +
        Key("enter"),  #drop/pop
        'get commit <text>':
        Key("alt,t,n,o") + Text('git add -A && git commit -m "%(text)s"'),
        # 'get add': Key("alt,t,n,o") + Text('git add -A') + Key('enter'),

        # Snippets
        'Open snippets':
        Key('c-k,c-b'),
        'prop snip':
        Text('prop') + Key('tab'),
        'See tour snip':
        Text('ctor') + Key('tab'),

        # Opening solutions
        'Open solution':
        Key("cs-o"),
    }
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 0, 9999),
        Dictation("text"),
        Dictation("dashtext", default="").lower().replace(" ", "-"),
        Dictation("nospace", default="").lower().replace(" ", ""),
    ]
Example #25
0
class GlobalMappings(MappingRule):
    mapping = {
        # Keys
        'plus':
        Key('plus'),
        'bat':
        Key('backspace'),
        'bat <number>':
        Key('backspace:%(number)d'),
        'nip':
        Key('escape'),
        'Spat':
        Key('space'),
        'Dink':
        Key('delete'),
        'down':
        Key('down'),
        'connect cisco':
        Function(connect_cisco),
        'find <text>':
        Key("c-f") + Text("%(text)s"),
        'find':
        Key("c-f"),
        'Dunk':
        Key('s-delete'),
        'snap':
        Key('a-tab'),
        'snap hold':
        Key('alt:down, tab'),
        'pick':
        Key('enter,alt:up'),
        'slap':
        Key('c-tab'),
        'down <number>':
        Key('down:%(number)d'),
        # 'up': Key('up'),
        'up <number>':
        Key('up:%(number)d'),
        'law':
        Key("pgup"),
        'raw':
        Key("pgdown"),
        'ga':
        Key("enter"),
        'Back tab':
        Key('s-tab'),
        'left [<number>]':
        Key('left:%(number)d'),
        'left dub <number>':
        Key("ctrl:down, left:%(number)d, ctrl:up"),
        'right [<number>]':
        Key('right:%(number)d'),
        'right dub <number>':
        Key("ctrl:down, right:%(number)d, ctrl:up"),
        "cam [under] <camel_text>":
        Text("%(under)s%(camel_text)s"),
        "snake [<under>] <snaketext>":
        Text("%(under)s%(snaketext)s"),
        "low <lowtext>":
        Text("%(lowtext)s"),
        "dash [<dash>] <dashtext>":
        Text("%(dash)s%(dashtext)s"),
        "skull [<pascaltext>]":
        Text("%(pascaltext)s"),
        "title [<titletext>]":
        Text("%(titletext)s"),
        'select down <number>':
        Key("home, shift:down, down:%(number)d, up, end, shift:up"),
        'select up <number>':
        Key("end, shift:down, up:%(number)d, down, home, shift:up"),
        'select right <number>':
        Key("ctrl:down, shift:down, right:%(number)d, ctrl:up, shift:up"),
        'select left <number>':
        Key("ctrl:down, shift:down, left:%(number)d, ctrl:up, shift:up"),
        'select end':
        Key('s-end'),
        'select home':
        Key('s-home'),
        'copy end':
        Key('s-end,c-c'),
        'copy home':
        Key('s-home, c-c'),
        'select all':
        Key("c-a"),
        'copy all':
        Key("c-a,c-c"),
        'line end':
        Key("end"),
        'line end <number>':
        Key("end") + Key("left:%(number)d"),
        'line home':
        Key("home"),
        'line home <number>':
        Key("home") + Key("right:%(number)d"),
        'undo':
        Key("c-z"),
        'undo <number>':
        Key("c-z:%(number)d"),
        'redo ':
        Key("c-y"),
        'redo <number>':
        Key("c-y:%(number)d"),
        'win up':
        Key('win:down, up, win:up'),
        'win right':
        Key('win:down, right, win:up'),
        'win down':
        Key('win:down, down, win:up'),
        'win left':
        Key('win:down, left, win:up'),
        'win search':
        Key('win:down, s, win:up'),
        'win snip':
        Key('win:down, s-s, win:up'),
        'copy':
        Key('c-c'),
        'cut':
        Key('c-x'),
        'paste':
        Key('c-v'),
        'del':
        Key('del'),
        'quote':
        Key('squote'),
        'comma':
        Key('comma'),
        'snooze':
        Key('csa-slash'),
        'snap load':
        Key('w-4') + Pause("10") + Key('c-1') + Pause("10") + Key('f5') +
        Pause("10") + Key('a-tab'),
        'to files':
        Key("w-1"),
        'to mail':
        Key("w-2"),
        'to Teams':
        Key("w-3"),
        'to Web':
        Key("w-4"),
        # 'to web': Key("w-4") + Pause('10') + Key("enter"),
        #'to bricks': Key("win:down, 4, 4, win:up") + Pause('50') + Key("enter"),
        # 'to pie': Key("w-5") + Pause('10') + Key("enter"),
        'to py':
        Key("w-5"),
        'to code':
        Key("w-6"),
        # 'to code': Key("win:down, 5, 5, win:up") + Pause('50') + Key("enter"),
        # 'to stud': Key("w-7"),
        'to excel':
        Key("w-7"),
        # 'to stud': Key("w-7") + Pause('10') + Key("enter"),
        # 'to study': Key("win:down, 7, 7, win:up") + Pause('50') + Key("enter"),

        # 'to studs': Key("win:down, 6, 6, 6, win:up") + Pause('50') + Key("enter"),
        # 'to data': Key("w-7"),
        'to post':
        Key("w-8"),
        # 'to shell': Key("w-8") + Pause('10') + Key("enter"),
        'to bricks':
        Key("w-9"),
        # 'to data': Key("w-0"),
        # 'to dragon': Key("w-1,0"),
        # 'to Notepad': Key("w-11"),

        ##############################
        # passwords
        ##############################
        'craig pass':
        Text(craig_pass),
        'in pass':
        Text(in_pass),
        'Prod pass':
        Text(prod_pass),
        'Sand pass':
        Text(sand_pass),
        # 'test pass': Text(testy_pass),
        'in email':
        Text("*****@*****.**"),
        'in User':
        Text("csalzsieder"),
        'open dock':
        Key('win,s') + Pause('20') + Text('docker') + Pause('20') +
        Key('enter'),

        # 'open pie': StartApp(R"C:\Users\csalzsieder\AppData\Local\Programs\Microsoft VS Code\Code.exe")
        #     + Pause('500') + Key("cs-o,a-d") + Key("c-k,c-o,a-d") + Pause('50')
        #     + Text(R'C:\NatLink\NatLink\MacroSystem') + Key("enter, tab:8, enter"),
        # 'open react': StartApp(R"C:\Users\csalzsieder\AppData\Local\Programs\Microsoft VS Code\Code.exe")
        #     + Pause('500') + Key("cs-o,a-d") + Key("c-k,c-o,a-d") + Pause('50')
        #     + Text(R'D:\GitProjects\react-components') + Key("enter, tab:8, enter"),
        #         "Open dry fly": Key("cs-o,a-d") + Text('D:\GitProjects\dryfly\FreeStone\DryFly.sln') + Key('enter'),
        # "Open MC API": Key("cs-o,a-d") + Text('D:\GitProjects\marketing-content-api\src\MarketingContent.Api.sln') + Key('enter'),
        'connect pre':
        Function(connect_pre),
        '[<number>] tab':
        Key('tab:%(number)d'),
        'Start day':
        Function(start_day),

        # Temporary
        'flag it':
        Key("enter") +
        Text("//ToDo: DF-10303 remove unused fields, delete later") +
        Key("down,c-k,c-c"),

        #postman
        'Post run':
        Key("w-8") + Pause('50') + Key("c-enter") + Pause('50') + Key("a-tab")
    }

    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("camel_text").camel(),
        # Define a Dictation element that produces snake case text,
        # e.g. hello_world.
        Dictation("snaketext").lower().replace(" ", "_"),
        Dictation("dashtext").lower().replace(" ", "-"),
        Dictation("lowtext").lower(),
        # Define a Dictation element that produces text matching Python's
        # class casing, e.g. DictationContainer.
        Dictation("pascaltext").title().replace(" ", ""),
        Dictation("titletext").title().replace(" ", " "),
        # Allow adding underscores before cased text.
        Choice("under", {"under": "_"}),
        Choice("dash", {"dash": "-"}),
        Dictation("text")
    ]
Example #26
0
def blitz_natlink_status():
    win = Window.get_foreground()
    FocusWindow(executable="natspeak", title="Messages from NatLink").execute()
    Pause("100").execute()
    win.set_foreground()
Example #27
0
class DragonRule(MappingRule):
    mapping = {
        '(lock Dragon | deactivate)':
        R(Playback([(["go", "to", "sleep"], 0.0)])),
        '(number|numbers) mode':
        R(Playback([(["numbers", "mode", "on"], 0.0)])),
        'spell mode':
        R(Playback([(["spell", "mode", "on"], 0.0)])),
        'dictation mode':
        R(Playback([(["dictation", "mode", "on"], 0.0)])),
        'normal mode':
        R(Playback([(["normal", "mode", "on"], 0.0)])),
        '(command mode | command on | com on)':
        R(Playback([(["command", "mode", "on"], 0.0)])),
        '(command off | com off)':
        R(Playback([(["command", "mode", "off"], 0.0)])),
        "fix dragon double":
        R(Function(fix_dragon_double)),
        "left point":
        R(
            Playback([(["MouseGrid"], 0.1), (["four", "four"], 0.1),
                      (["click"], 0.0)])),
        "right point":
        R(
            Playback([(["MouseGrid"], 0.1), (["six", "six"], 0.1),
                      (["click"], 0.0)])),
        "center point":
        R(Playback([(["MouseGrid"], 0.1), (["click"], 0.0)]),
          rdescript="Mouse: Center Point"),
        "show windows":
        R(Mimic("list", "all", "windows"),
          rdescript="Dragon: emulate Dragon command for listing windows"),
        "cory <text>":
        R(Mimic("correct", extra="text") +
          WaitWindow(title="spelling window") + Mimic("choose", "one"),
          rdescript=
          "Dragon: brings up the correction menu for the phrase spoken in the command and chooses the 1st choice"
          ),
        "cory that":
        R(Mimic("correct", "that") + WaitWindow(title="spelling window") +
          Mimic("choose", "one"),
          rdescript=
          "Dragon: brings up the correction menu for the previously spoken phrase and chooses the first choice"
          ),
        "make that <text>":
        R(Mimic("scratch", "that") + Mimic(extra="text"),
          rdescript=
          "Dragon: deletes the dictation generated by the previous utterance and replaces it with what you say next"
          ),
        "scratch [<n10>]":
        R(Playback([(["scratch", "that"], 0.03)]),
          rdescript="Dragon: delete dictation from previous n utterances") *
        Repeat(extra="n10"),

        # Users may want to adjust the wait time on the next few commands
        "train word":
        R(Mimic("train", "that") + Pause("75") + Key("a-r/250, s"),
          rdescript=
          "Dragon: quickly train word when you have it selected in a Dragon friendly text field"
          ),
        "word train":
        R(Key("c-c/20") + Mimic("edit", "vocabulary") +
          Key("c-v/5, tab, down, up, a-t/50, enter/50, a-r/250, s/50, escape"),
          rdescript=
          "train word quickly once you have it selected in non-full text control application"
          ),
        "(add train | train from add word)":
        R(Key("a-a/2, enter/300, a-s"),
          rdescript="Dragon: quickly train word from the add word dialogbox"),
        "(train from vocab | cab train)":
        R(Key("a-t/50, enter/50, a-r/250, s"),
          rdescript="Dragon: quickly train word from Vocabulary Editor"),
        "(train from vocab | cab train)":
        R(Key("a-t/50, enter/50, a-r/250, s"),
          rdescript="Dragon: quickly train word from Vocabulary Editor"),
        "remove from vocab":
        R(Key("c-c/5") + Mimic("edit", "vocabulary") + Pause("20") +
          Key("c-v/10, tab, down, up/5, a-d, y, escape/30, right"),
          rdescript="Dragon: remove selected word from vocabulary"),
        "(add to vocab | vocab that)":
        R(Key("c-c/5") + Mimic("add", "word") + Pause("20") +
          Key("c-v, a-a/2, enter/300, a-s/30, right"),
          rdescript="Dragon: add selected word to vocabulary and train it"),
        "recognition history":
        R(Playback([(["view", "recognition", "history"], 0.03)]),
          rdescript="Dragon: open Dragon recognition history"),
        "peak [recognition] history":
        R(Playback([(["view", "recognition", "history"], 0.03)]) +
          Pause("300") + Key("escape"),
          rdescript="Dragon: open Dragon recognition history then close it"),
        "[dictation] sources":
        R(Mimic("manage", "dictation", "sources"),
          rdescript="Dragon: manage dictation sources"),

        # A Natlink Command
        "clear caster log":
        R(Function(utilities.clear_log)),
    }
    # see above
    extras = extras_for_whole_file()
    defaults = defaults_for_whole_file()
class BrowserSharedCommands(object):

    @staticmethod
    def merge_dictionaries(x, y):
        z = x.copy()
        z.update(y)
        return z

    chromeAndFirefoxMapping = {
        browser_shared.OPEN_NEW_WINDOW:
            R(Key("c-n")),
        browser_shared.OPEN_NEW_INCOGNITO_WINDOW:
            R(Key("cs-n")),
        browser_shared.NEW_TAB_N_TIMES:
            R(Key("c-t") * Repeat(extra="n")),
        browser_shared.REOPEN_TAB_N_TIMES:
            R(Key("cs-t")) * Repeat(extra="n"),
        browser_shared.CLOSE_TAB_N_TIMES:
            R(Key("c-w")) * Repeat(extra='n'),
        browser_shared.CLOSE_WINDOW:
            R(Key("cs-w")),
        browser_shared.NEXT_TAB_N_TIMES:
            R(Key("c-tab")) * Repeat(extra="n"),
        browser_shared.OPEN_NEW_TAB_BASED_ON_CURSOR:
            R(Mouse("middle") + Pause("20") + Key("c-tab")),
        browser_shared.GO_BACK_N_TIMES:
            R(Key("a-left/20")) * Repeat(extra="n"),
        browser_shared.GO_FORWARD_N_TIMES:
            R(Key("a-right/20")) * Repeat(extra="n"),
        browser_shared.ZOOM_IN_N_TIMES:
            R(Key("c-plus/20")) * Repeat(extra="n"),
        browser_shared.ZOOM_OUT_N_TIMES:
            R(Key("c-minus/20")) * Repeat(extra="n"),
        browser_shared.ZOOM_RESET_DEFAULT:
            R(Key("c-0")),
        browser_shared.FORCE_HARD_REFRESH:
            R(Key("c-f5")),
        browser_shared.FIND_NEXT_MATCH:
            R(Key("c-g/20")) * Repeat(extra="n"),
        browser_shared.FIND_PREVIOUS_MATCH:
            R(Key("cs-g/20")) * Repeat(extra="n"),
        # requires an extension in some browsers such as chrome
        browser_shared.TOGGLE_CARET_BROWSING:
            R(Key("f7")),
        browser_shared.GO_TO_HOMEPAGE:
            R(Key("a-home")),
        browser_shared.SHOW_HISTORY:
            R(Key("c-h")),
        browser_shared.SELECT_ADDRESS_BAR:
            R(Key("c-l")),
        browser_shared.SHOW_DOWNLOADS:
            R(Key("c-j")),
        browser_shared.ADD_BOOKMARK:
            R(Key("c-d")),
        browser_shared.BOOKMARK_ALL_TABS:
            R(Key("cs-d")),
        browser_shared.SHOW_BOOKMARKS:
            R(Key("cs-o")),
        browser_shared.TOGGLE_FULL_SCREEN:
            R(Key("f11")),
        browser_shared.SHOW_PAGE_SOURCE:
            R(Key("c-u")),
        browser_shared.DEBUG_RESUME:
            R(Key("f8")),
        browser_shared.DEBUG_STEP_OVER:
            R(Key("f10")),
        browser_shared.DEBUG_STEP_INTO:
            R(Key("f11")),
        browser_shared.DEBUG_STEP_OUT:
            R(Key("s-f11")),
        browser_shared.DUPLICATE_TAB:
            R(Key("a-d,a-c,c-t/15,c-v/15, enter")),
        browser_shared.DUPLICATE_WINDOW:
            R(Key("a-d,a-c,c-n/15,c-v/15, enter")),
        browser_shared.SHOW_MENU:
            R(Key("a-f")),
        browser_shared.SHOW_SETTINGS:
            R(Key("a-f/5, s")),
        browser_shared.SHOW_TASK_MANAGER:
            R(Key("s-escape")),
        browser_shared.CLEAR_BROWSING_DATA:
            R(Key("cs-del")),
        browser_shared.SHOW_DEVELOPER_TOOLS:
            R(Key("cs-i")),
        browser_shared.CHECKOUT_PR:
            R(Function(github_automation.github_checkoutupdate_pull_request, new=True)),
        browser_shared.UPDATE_PR:
            R(Function(github_automation.github_checkoutupdate_pull_request, new=False)),
        "IRC identify":
            R(Text("/msg NickServ identify PASSWORD")),
    }
Example #29
0
def P(*args, **kws):
    return Pause(*args, **kws)
Example #30
0
class FirefoxRule(MappingRule):
    mapping = {
        "(new window|win new)":
        R(Key("c-n")),
        "(new incognito window | incognito)":
        R(Key("cs-n")),
        "new tab [<n>]|tab new [<n>]":
        R(Key("c-t") * Repeat(extra="n")),
        "reopen tab [<n>]|tab reopen [<n>]":
        R(Key("cs-t")) * Repeat(extra="n"),
        "close tab [<n>]|tab close [<n>]":
        R(Key("c-w")) * Repeat(extra='n'),
        "win close|close all tabs":
        R(Key("cs-w")),
        "(next|forward) tab [<n>]|tab (right|sauce) [<n>]":
        R(Key("c-tab")) * Repeat(extra="n"),
        "(back|previous) tab [<n>]|tab (left|lease) [<n>]":
        # control shift tab doesn't work and this appears to be an undocumented workaround
        R(Key("c-tab/30")) * Repeat(extra="n"),
        "new tab that":
        R(Mouse("middle") + Pause("20") + Key("c-tab")),
        "go (back|prev|prior|previous) [<n>]":
        R(Key("a-left/20")) * Repeat(extra="n"),
        "go (next|forward) [<n>]":
        R(Key("a-right/20")) * Repeat(extra="n"),
        "zoom in [<n>]":
        R(Key("c-plus/20")) * Repeat(extra="n"),
        "zoom out [<n>]":
        R(Key("c-minus/20")) * Repeat(extra="n"),
        "zoom reset":
        R(Key("c-0")),
        "(hard refresh|super refresh)":
        R(Key("c-f5")),
        "find (next|forward) [match] [<n>]":
        R(Key("c-g/20")) * Repeat(extra="n"),
        # requires an extension in some browsers such as chrome
        "[toggle] caret browsing":
        R(Key("f7")),
        "[go] home [page]":
        R(Key("a-home")),
        "[show] history":
        R(Key("c-h")),
        "address bar":
        R(Key("c-l")),
        "[show] downloads":
        R(Key("c-j")),
        "[add] bookmark":
        R(Key("c-d")),
        "bookmark all [tabs]":
        R(Key("cs-d")),
        "[show] bookmarks":
        R(Key("cs-o")),
        "[toggle] full screen":
        R(Key("f11")),
        "(show|view) page source":
        R(Key("c-u")),
        "resume":
        R(Key("f8")),
        "step over":
        R(Key("f10")),
        "step into":
        R(Key("f11")),
        "step out":
        R(Key("s-f11")),
        "(duplicate tab|tab duple)":
        R(Key("a-d,a-c,c-t/15,c-v/15, enter")),
        "(duplicate window|win duple)":
        R(Key("a-d,a-c,c-n/15,c-v/15, enter")),
        "[show] (menu | three dots)":
        R(Key("a-f")),
        "[show] settings":
        R(Key("a-f/5, s")),
        "(clear history|clear browsing data)":
        R(Key("cs-del")),
        "[show] developer tools":
        R(Key("cs-i")),
        "checkout [this] pull request [locally]":
        R(
            Function(github_automation.github_checkoutupdate_pull_request,
                     new=True)),
        "update [this] pull request [locally]":
        R(
            Function(github_automation.github_checkoutupdate_pull_request,
                     new=False)),
        "IRC identify":
        R(Text("/msg NickServ identify PASSWORD")),
        "[toggle] bookmark bar":
        R(Key("c-b")),
        "[show] (extensions|plugins)":
        R(Key("a-a, l, e/15, enter")),
        "google that":
        R(Store(remove_cr=True) + Key("c-t") + Retrieve() + Key("enter")),
        "wikipedia that":
        R(
            Store(space="+", remove_cr=True) + Key("c-t") +
            Text("https://en.wikipedia.org/w/index.php?search=") + Retrieve() +
            Key("enter")),
    }
    extras = [
        Choice(
            "nth", {
                "first": "1",
                "second": "2",
                "third": "3",
                "fourth": "4",
                "fifth": "5",
                "sixth": "6",
                "seventh": "7",
                "eighth": "8",
            }),
        ShortIntegerRef("n", 1, 100),
        ShortIntegerRef("m", 1, 10)
    ]
    defaults = {"n": 1, "m": "", "nth": ""}
Example #31
0
class Python(MergeRule):

    mapping = {
        SymbolSpecs.IF:
            R(Key("i,f,space,colon,left")),
        SymbolSpecs.ELSE:
            R(Text("else:") + Key("enter")),
        # (no switch in Python)
        SymbolSpecs.BREAK:
            R(Text("break")),
        SymbolSpecs.FOR_EACH_LOOP:
            R(Store() + Text("for  in :") + Key("left:5") +
              Retrieve(action_if_text="right:5")),
        SymbolSpecs.FOR_LOOP:
            R(Store() + Text("for i in range(0, ):") + Key("left:2") +
              Retrieve(action_if_text="right:2")),
        SymbolSpecs.WHILE_LOOP:
            R(Store() + Text("while :") + Key("left") + Retrieve(action_if_text="right")),
        # (no do-while in Python)
        SymbolSpecs.TO_INTEGER:
            R(Store() + Text("int()") + Key("left") + Retrieve(action_if_text="right")),
        SymbolSpecs.TO_FLOAT:
            R(Store() + Text("float()") + Key("left") + Retrieve(action_if_text="right")),
        SymbolSpecs.TO_STRING:
            R(Store() + Text("str()") + Key("left") + Retrieve(action_if_text="right")),
        SymbolSpecs.AND:
            R(Text(" and ")),
        SymbolSpecs.OR:
            R(Text(" or ")),
        SymbolSpecs.NOT:
            R(Text("!")),
        SymbolSpecs.SYSOUT:
            R(Store() + Text("print()") + Key("left") + Retrieve(action_if_text="right")),
        SymbolSpecs.IMPORT:
            R(Text("import ")),
        SymbolSpecs.FUNCTION:
            R(Store() + Text("def ():") + Key("left:3") +
              Retrieve(action_if_text="right:3")),
        SymbolSpecs.CLASS:
            R(Store() + Text("class :") + Key("left") + Retrieve(action_if_text="right")),
        SymbolSpecs.COMMENT:
            R(Store() + Text("#") + Key("space") + Retrieve(action_if_text="right")),
        SymbolSpecs.LONG_COMMENT:
            R(Store() + Text("''''''") + Key("left:3") +
              Retrieve(action_if_text="right:3")),
        SymbolSpecs.NULL:
            R(Text("None")),
        SymbolSpecs.RETURN:
            R(Text("return ")),
        SymbolSpecs.TRUE:
            R(Text("True")),
        SymbolSpecs.FALSE:
            R(Text("False")),

        # Python specific
        "sue iffae":
            R(Text("if ")),
        "sue shells":
            R(Text("else ")),
        "from":
            R(Text("from ")),
        "self":
            R(Text("self")),
        "long not":
            R(Text(" not ")),
        "it are in":
            R(Text(" in ")),
        "shell iffae | LFA":
            R(Key("e,l,i,f,space,colon,left")),
        "convert to character":
            R(Store() + Text("chr()") + Key("left") + Retrieve(action_if_text="right")),
        "length of":
            R(Store() + Text("len()") + Key("left") + Retrieve(action_if_text="right")),
        "global":
            R(Text("global ")),
        "make assertion":
            R(Text("assert ")),
        "list (comprehension | comp)":
            R(Text("[x for x in TOKEN if TOKEN]")),
        "[dot] (pie | pi)":
            R(Text(".py")),
        "toml":
            R(Text("toml")),
        "jason":
            R(Text("toml")),
        "identity is":
            R(Text(" is ")),
        "yield":
            R(Text("yield ")),

        # Essentially an improved version of the try catch command above
        # probably a better option than this is to use snippets with tab stops
        # VS code has the extension Python-snippets. these are activated by
        # going into the command pallet (cs-p) and typing in "insert snippet"
        # then press enter and then you have choices of snippets show up in the drop-down list.
        # you can also make your own snippets.
        "try [<exception>]":
            R(
                Text("try : ") + Pause("10") + Key("enter/2") +
                Text("except %(exception)s:") + Pause("10") + Key("enter/2")),
        "try [<exception>] as":
            R(
                Text("try :") + Pause("10") + Key("enter/2") +
                Text("except %(exception)s as :") + Pause("10") + Key("enter/2")),

        # class and class methods
        "sub class":
            R(Store() + Text("class ():") + Key("left:3") +
              Retrieve(action_if_text="right:3")),
        "dunder":
            R(Store() + Text("____()") + Key("left:4") +
              Retrieve(action_if_text="right:4")),
        "init":
            R(Store() + Text("__init__()") + Key("left") +
              Retrieve(action_if_text="right")),
        "meth [<binary_meth>]":
            R(Text("__%(binary_meth)s__(self, other):")),
        "meth [<unary_meth>]":
            R(Text("__%(unary_meth)s__(self):")),
    }

    extras = [
        Dictation("text"),
        Choice("unary_meth", {
            "reper": "reper",
            "stir": "str",
            "len": "len",
        }),
        Choice("binary_meth", {
            "add": "add",
            "subtract": "sub",
        }),
        Choice(
            "exception", {
                "exception": "Exception",
                "stop iteration": "StopIteration",
                "system exit": "SystemExit",
                "standard": "StandardError",
                "arithmetic": "ArithmeticError",
                "overflow": "OverflowError",
                "floating point": "FloatingPointError",
                "zero division": "ZeroDivisionError",
                "assertion": "AssertionError",
                "EOF": "EOFError",
                "import": "ImportError",
                "keyboard interrupt": "KeyboardInterrupt",
                "lookup": "LookupError",
                "index": "IndexError",
                "key": "KeyError",
                "name": "NameError",
                "unbound local": "UnboundLocalError",
                "environment": "EnvironmentError",
                "IO": "IOError",
                "OS": "OSError",
                "syntax": "SyntaxError",
                "system exit": "SystemExit",
                "type": "TypeError",
                "value": "ValueError",
                "run time": "RuntimeError",
                "not implemented": "NotImplementedError",
            })
    ]
    defaults = {"unary_meth": "", "binary_meth": "", "exception": ""}
Example #32
0
 def __init__(self, confirm, data, type=TYPE):
     StackItemAsynchronous.__init__(self, confirm, data, type)
     self.base = Pause("50") + confirm.base # TODO: fix this race condition
     self.rspec = confirm.rspec
     self.hmc_response = 0
Example #33
0
def go_line(s):
    return Key("colon") + Text("%(" + s + ")d\n") + Pause('10')