示例#1
0
class MSTeamsRule(MappingRule):
    name = "microsoft teams"
    mapping = {
        # General
        "search":
            R(Key("c-e")),
        "keyboard shortcuts":
            R(Key("c-.")),
        "settings":
            R(Key("c-comma")),
        "help":
            R(Key("f1")),
        "commands":
            R(Key("c-slash")),
        "filter":
            R(Key("cs-f")),
        "go to":
            R(Key("c-g")),
        "new chat":
            R(Key("c-n")),

        # Navigation
        "activity":
            R(Key("c-1")),
        "chat":
            R(Key("c-2")),
        "teams":
            R(Key("c-3")),
        "calendar":
            R(Key("c-4")),
        "calls":
            R(Key("c-5")),
        "files":
            R(Key("c-6")),
        "shifts":
            R(Key("c-7")),
        "previous item [<nnavi10>]":
            R(Key("a-up"))*Repeat(extra="nnavi10"),
        "next item [<nnavi10>]":
            R(Key("a-down"))*Repeat(extra="nnavi10"),
        "previous team":
            R(Key("cs-up")),
        "next team":
            R(Key("cs-down")),
        "previous section":
            R(Key("cs-f6")),
        "next section":  
            R(Key("c-f6")),

        # Messaging
        "focus compose":
            R(Key("c")),
        "expand compose":
            R(Key("cs-x")),
        "send":
            R(Key("c-enter")),
        "attach":
            R(Key("c-o")),
        "new-line":
            R(Key("s-enter")),
        "reply":
            R(Key("r")),

        # meetings calls and calendar
        "Accept [video] call":
            R(Key("cs-a")),
        "Accept [audio] call":
            R(Key("cs-s")),
        "decline [call]":
            R(Key("cs-d")),
        "start audio call":
            R(Key("cs-c")),
        "Start video call":
            R(Key("cs-u")),
        "toggle mute":
            R(Key("cs-m")),
        "screen share":
            R(Key("cs-e")),
        "toggle video":
            R(Key("cs-o")),
        "sharing toolbar":
            R(Key("cs-space")),
        "decline screen share":
            R(Key("cs-d")),
        "Accept screen share":
            R(Key("cs-a")),
        "Schedule meeting":
            R(Key("as-n")),
         "go to current time":
            R(Key("a-.")),
         "go to previous (day | week)":
            R(Key("ca-left")),
         "go to next (day | week)":
            R(Key("ca-right")),
         "View day":
            R(Key("ca-1")),
         "View workweek":
            R(Key("ca-2")),
         "View week":
            R(Key("ca-3")),
   }
    exported = True
    extras = [
        IntegerRefST("nnavi10", 1, 11)
    ]
    defaults = {
        "nnavi10": 1
    }
示例#2
0
文件: nav2.py 项目: tlappas/Caster
class NavigationNon(MappingRule):

    pronunciation = "navigation companion"

    mapping = {
        "<direction> <time_in_seconds>":
            AsynchronousAction(
                [L(S(["cancel"], Key("%(direction)s"), consume=False))],
                repetitions=1000,
                blocking=False),
        "erase multi clipboard":
            R(Function(navigation.erase_multi_clipboard)),
        "find":
            R(Key("c-f")),
        "find next [<n>]":
            R(Key("f3"))*Repeat(extra="n"),
        "find prior [<n>]":
            R(Key("s-f3"))*Repeat(extra="n"),
        "find everywhere":
            R(Key("cs-f")),
        "replace":
            R(Key("c-h")),
        "F<function_key>":
            R(Key("f%(function_key)s")),
        "[show] context menu":
            R(Key("s-f10")),
        "lean":
            R(Function(navigation.right_down)),
        "hoist":
            R(Function(navigation.right_up)),
        "kick mid":
            R(Function(navigation.middle_click)),
        "shift right click":
            R(Key("shift:down") + Mouse("right") + Key("shift:up")),
        "curse <direction> [<direction2>] [<nnavi500>] [<dokick>]":
            R(Function(navigation.curse)),
        "scree <direction> [<nnavi500>]":
            R(Function(navigation.wheel_scroll)),
        "colic":
            R(Key("control:down") + Mouse("left") + Key("control:up")),
        "garb [<nnavi500>]":
            R(Mouse("left") + Mouse("left") + Function(
                navigation.stoosh_keep_clipboard)),
        "drop [<nnavi500>]":
            R(Mouse("left") + Mouse("left") + Function(
                navigation.drop_keep_clipboard,
                capitalization=0,
                spacing=0)),
        "sure stoosh":
            R(Key("c-c")),
        "sure cut":
            R(Key("c-x")),
        "sure spark":
            R(Key("c-v")),
        "refresh":
            R(Key("c-r")),
        "maxiwin":
            R(Key("w-up")),
        "move window":
            R(Key("a-space, r, a-space, m")),
        "window (left | lease) [<n>]":
            R(Key("w-left"))*Repeat(extra="n"),
        "window (right | ross) [<n>]":
            R(Key("w-right"))*Repeat(extra="n"),
        "monitor (left | lease) [<n>]":
            R(Key("sw-left"))*Repeat(extra="n"),
        "monitor (right | ross) [<n>]":
            R(Key("sw-right"))*Repeat(extra="n"),
        "(next | prior) window":
            R(Key("ca-tab, enter")),
        "switch (window | windows)":
            R(Key("ca-tab"))*Repeat(extra="n"),
        "next tab [<n>]":
            R(Key("c-pgdown"))*Repeat(extra="n"),
        "prior tab [<n>]":
            R(Key("c-pgup"))*Repeat(extra="n"),
        "close tab [<n>]":
            R(Key("c-w/20"))*Repeat(extra="n"),
        "elite translation <text>":
            R(Function(alphabet_support.elite_text)),
    }

    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("function_key", 1, 13),
        IntegerRefST("n", 1, 50),
        IntegerRefST("nnavi500", 1, 500),
        Choice("time_in_seconds", {
            "super slow": 5,
            "slow": 2,
            "normal": 0.6,
            "fast": 0.1,
            "superfast": 0.05
        }),
        navigation_support.get_direction_choice("direction"),
        navigation_support.get_direction_choice("direction2"),
        navigation_support.TARGET_CHOICE,
        Choice("dokick", {
            "kick": 1,
            "psychic": 2
        }),
        Choice("wm", {
            "ex": 1,
            "tie": 2
        }),
    ]
    defaults = {
        "n": 1,
        "mim": "",
        "nnavi500": 1,
        "direction2": "",
        "dokick": 0,
        "text": "",
        "wm": 2
    }
示例#3
0
文件: firefox.py 项目: pimp22/Caster
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|prev|prior|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",
            }),
        IntegerRefST("n", 1, 100),
        IntegerRefST("m", 1, 10)
    ]
    defaults = {"n": 1, "m":"", "nth": ""}
示例#4
0
class GitBashRule(MappingRule):
    GIT_ADD_ALL = "g, i, t, space, a, d, d, space, minus, A"
    GIT_COMMIT = "g, i, t, space, c, o, m, m, i, t, space, minus, m, space, quote, quote, left"
    mapping = {
        "(git|get) base":
            Text("git "),
        "(git|get) (initialize repository|init)":
            Text("git init"),
        "(git|get) add":
            R(Key("g, i, t, space, a, d, d, space, dot")),
        "(git|get) add all":
            R(Key(GIT_ADD_ALL)),
        "(git|get) commit all":
            R(Key("%s, ;, space, %s" % (GIT_ADD_ALL, GIT_COMMIT))),
        "(git|get) status":
            R(Key("g, i, t, space, s, t, a, t, u, s")),
        "(git|get) commit":
            R(Key(GIT_COMMIT)),
        "(git|get) bug fix commit <n>":
            R(Mimic("get", "commit") + Text("fixes #%(n)d ") + Key("backspace")),
        "(git|get) reference commit <n>":
            R(Mimic("get", "commit") + Text("refs #%(n)d ") + Key("backspace")),
        "(git|get) checkout":
            R(Text("git checkout ")),
        "(git|get) branch":
            R(Text("git branch ")),
        "(git|get) remote":
            R(Text("git remote ")),
        "(git|get) merge":
            R(Text("git merge ")),
        "(git|get) merge tool":
            R(Text("git mergetool")),
        "(git|get) fetch":
            R(Text("git fetch ")),
        "(git|get) push":
            R(Text("git push ")),
        "(git|get) pull":
            R(Text("git pull ")),
        "CD up":
            R(Text("cd ..")),
        "CD":
            R(Text("cd ")),
        "list":
            R(Text("ls")),
        "make directory":
            R(Text("mkdir ")),
        "undo [last] commit | (git|get) reset soft head":
            R(Text("git reset --soft HEAD~1")),
        "(undo changes | (git|get) reset hard)":
            R(Text("git reset --hard")),
        "stop tracking [file] | (git|get) remove":
            R(Text("git rm --cached ")),
        "preview remove untracked | (git|get) clean preview":
            R(Text("git clean -nd")),
        "remove untracked | (git|get) clean untracked":
            R(Text("git clean -fd")),
        "(git|get) visualize":
            R(Text("gitk")),
        "(git|get) visualize file":
            R(Text("gitk -- PATH")),
        "(git|get) visualize all":
            R(Text("gitk --all")),
        "(git|get) stash":
            R(Text("git stash")),
        "(git|get) stash apply [<n>]":
            R(Text("git stash apply") + Function(_apply)),
        "(git|get) stash list":
            R(Text("git stash list")),
        "(git|get) stash branch":
            R(Text("git stash branch NAME")),
        "(git|get) cherry pick":
            R(Text("git cherry-pick ")),
        "(git|get) (abort cherry pick | cherry pick abort)":
            R(Text("git cherry-pick --abort")),
        "(git|get) (GUI | gooey)":
            R(Text("git gui")),
        "(git|get) blame":
            R(Text("git blame PATH -L FIRSTLINE,LASTLINE")),
        "(git|get) gooey blame":
            R(Text("git gui blame PATH")),
        "search recursive":
            R(Text("grep -rinH \"PATTERN\" *")),
        "search recursive count":
            R(Text("grep -rinH \"PATTERN\" * | wc -l")),
        "search recursive file type":
            R(Text("find . -name \"*.java\" -exec grep -rinH \"PATTERN\" {} \\;")),
        "to file":
            R(Text(" > FILENAME")),
    }
    extras = [
        IntegerRefST("n", 1, 10000),
    ]
    defaults = {"n": 0}
示例#5
0
class VisualStudioRule(MappingRule):
    mapping = {
        "next tab [<n>]":
        R(Key("ca-pgdown")) * Repeat(extra="n"),
        "prior tab [<n>]":
        R(Key("ca-pgup")) * Repeat(extra="n"),
        "close tab [<n>]":
        R(Key("c-f4/20")) * Repeat(extra="n"),
        "(list | show) documents":
        R(Key("a-w, w")),
        "[focus] document (window | pane)":
        R(Key("a-w, w, enter")),
        "solution explorer":
        R(Key("ca-l")),
        "team explorer":
        R(Key("c-backslash, c-m")),
        "source control explorer":
        R(Key("c-q") + Text("Source Control Explorer") + Key("enter")),
        "quick launch":
        R(Key("c-q")),
        "go to line":
        R(Key("c-g")),
        "comment line":
        R(Key("c-k, c-c")),
        "comment block":
        R(Key("c-k, c-c")),
        "(un | on) comment line":
        R(Key("c-k/50, c-u")),
        "(un | on) comment block":
        R(Key("c-k/50, c-u")),
        "[toggle] full screen":
        R(Key("sa-enter")),
        "(set | toggle) bookmark":
        R(Key("c-k, c-k")),
        "next bookmark":
        R(Key("c-k, c-n")),
        "prior bookmark":
        R(Key("c-k, c-p")),
        "collapse to definitions":
        R(Key("c-m, c-o")),
        "toggle [section] outlining":
        R(Key("c-m, c-m")),
        "toggle all outlining":
        R(Key("c-m, c-l")),
        "[toggle] break point":
        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 | go debug)":
        R(Key("f5")),
        "run tests":
        R(Key("c-r, t")),
        "run all tests":
        R(Key("c-r, a")),
        "build solution":
        R(Key("cs-b")),
        "get latest [version]":
        R(Key("a-f, r, l")),
        "(show | view) history":
        R(Key("a-f, r, h")),
        "compare (files | versions)":
        R(Key("a-f, r, h")),
        "undo (checkout | pending changes)":
        R(Key("a-f, r, u")),
        "[open] [go to] work item":
        R(Key("a-m, g")),
        "[add] [new] linked work item":
        R(Key("sa-l")),
        "go back":
        R(Key("c--")),
        "go forward":
        R(Key("cs--")),
        "go to definition":
        R(Key("f12")),
        "show refs":
        R(Key("a-2")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("n", 1, 1000),
    ]
    defaults = {"n": 1, "mim": ""}
示例#6
0
文件: typora.py 项目: lahwran/Caster
class TyporaRule(MappingRule):
    mapping = {
        # File
        "new file": R(Key("c-n")),
        "new window":  # Listed but not implemented
            R(Key("cs-n")),
        # "new tab":      R(Key("")), # Not implemented in Windows OS
        "open file": R(Key("c-o")),
        "go [to] file": R(Key("c-p")),
        "reopen [closed] file": R(Key("cs-t")),
        "save as": R(Key("cs-s")),
        "close file": R(Key("c-w")),
        # Edit
        # "new paragraph": R(Key("enter")) * Repeat(extra="h"), # Caster: "shock"
        "new line <h>": R(Key("s-enter"))*Repeat(extra="h"),
        "copy [as] markdown": R(Key("cs-c")),
        "delete row <n>": R(Key("cs-backspace"))*Repeat(extra="n"),
        "select [cell | scope]": R(Key("c-e")),
        "[select] word <n>": R(Key("c-d"))*Repeat(extra="n"),
        "delete word <n>": R(Key("cs-d"))*Repeat(extra="n"),
        # "jump [to] top":    R(Key("c-home")), # Caster: "sauce wally"
        # "jump [to] selection":  R(Key("c-j")), # Caster: "dunce wally"
        "jump [to] buttom": R(Key("c-end")),
        "find":  # Say "escape" to exit the find/replace context
            R(Key("c-f")),
        "find next": R(Key("f3")),
        "replace": R(Key("c-h")),
        # Paragraph
        "heading <h>": R(Key("c-%(h)d")),
        "paragraph": R(Key("c-o")),
        "increase heading [level] <h>": R(Key("c-equal"))*Repeat(extra="h"),
        "decrease heading [level] <h>": R(Key("c-minus"))*Repeat(extra="h"),
        "table": R(Key("c-t")),  # could be automated.
        "code fences": R(Key("cs-k")),
        "math block": R(Key("cs-m")),
        "quote": R(Key("cs-q")),
        "ordered list": R(Key("cs-[")),
        "indent <h>": R(Key("cs-]"))*Repeat(extra="h"),
        "out dent <h>": R(Key("cs-["))*Repeat(extra="h"),
        # Format
        "strong | bold": R(Key("c-b")),
        "emphasis | italicize": R(Key("c-i")),
        "underline": R(Key("c-u")),
        "code": R(Key("cs-`")),
        "strike": R(Key("as-5")),
        "hyperlink": R(Key("c-k")),
        "image": R(Key("cs-i")),
        "clear [format]": R(Key("c-\\")),
        # View
        "[toggle] sidebar": R(Key("cs-l")),
        "outline": R(Key("cs-1")),
        "articles": R(Key("sc-2")),
        "file tree": R(Key("cs-3")),
        "source code [mode]": R(Key("c-slash")),
        "focus mode": R(Key("f8")),
        "typewriter [mode]": R(Key("f9")),
        "[toggle] fullscreen": R(Key("f11")),
        "actual size": R(Key("cs-0")),
        "zoom in <n>": R(Key("cs-="))*Repeat(extra="n"),
        "zoom out <n>": R(Key("cs--"))*Repeat(extra="n"),
        "switch documnets": R(Key("c-tab")),
        "toggle [dev] tools": R(Key("cs-f12")),
    }

    extras = [
        Dictation("text"),
        IntegerRefST("h", 0, 6),
        IntegerRefST("n", 1, 30),
    ]

    defaults = {"n": 1, "h": 1}
示例#7
0
文件: rust.py 项目: lahwran/Caster
class Rust(MergeRule):

    pronunciation = "rust"

    mapping = {
        SymbolSpecs.IF:
            R(Text("if  {}") + Key("left/5:3")),
        SymbolSpecs.ELSE:
            R(Text("else {}") + Key("left/5:3")),
        #
        SymbolSpecs.SWITCH:
            R(Text("match ")),
        SymbolSpecs.CASE:
            R(Text(" => ")),
        SymbolSpecs.BREAK:
            R(Text("break;")),
        SymbolSpecs.DEFAULT:
            R(Text("_")),
        #
        SymbolSpecs.DO_LOOP:
            R(Text("while {TOKEN;TOKEN}{}")),
        SymbolSpecs.WHILE_LOOP:
            R(Text("while TOKEN {}") + Key("left")),
        "for loop [of <a> [in <n>]]":
            R(Text("for %(a)s in 0..%(n)d {}") + Key("left")),
        SymbolSpecs.FOR_EACH_LOOP:
            R(Text("for TOKEN in TOKEN {}") + Key("left")),
        #
        SymbolSpecs.TO_INTEGER:
            R(Text("parse::<i32>().unwrap()")),
        SymbolSpecs.TO_FLOAT:
            R(Text("parse::<f64>().unwrap()")),
        SymbolSpecs.TO_STRING:
            R(Text("to_string()")),
        #
        SymbolSpecs.AND:
            R(Text(" && ")),
        SymbolSpecs.OR:
            R(Text(" || ")),
        SymbolSpecs.NOT:
            R(Text("!")),
        #
        SymbolSpecs.SYSOUT:
            R(Text("println!()") + Key("left")),
        #
        SymbolSpecs.IMPORT:
            R(Text("use ")),
        #
        # function moved to ncmap
        SymbolSpecs.CLASS:
            R(Text("struct ")),
        #
        SymbolSpecs.COMMENT:
            R(Text("// ")),
        SymbolSpecs.LONG_COMMENT:
            R(Text("/// ")),
        #
        SymbolSpecs.NULL:
            R(Text("None")),
        #
        SymbolSpecs.RETURN:
            R(Text("return ")),
        #
        SymbolSpecs.TRUE:
            R(Text("true")),
        SymbolSpecs.FALSE:
            R(Text("false")),

        # Rust specific
        "value some":
            R(Text("Some()") + Key("left")),
        "enumerate for loop [of <a> [in <n>]]":
            R(Text("for (%(a)s, TOKEN) in (0..%(n)d).enumerate() {}") + Key("left")),
        "enumerate for each [<a> <b>]":
            R(Text("for (%(a)s, %(b)s) in TOKEN.enumerate() {}") + Key("left")),
        "bind [<mutability>]":
            R(Text("let %(mutability)s")),
        "of type":
            R(Text(": ")),
        "[<signed>] integer [<ibits>]":
            R(Text("%(signed)s%(bits)s ")),
        "float [<fbits>]":
            R(Text("f%(fbits)s ")),
        "boolean":
            R(Text("bool ")),
        "string":
            R(Text("String ")),
        "array [of] size <n>":
            R(Text("[TOKEN; %(n)d]")),
        "macro vector":
            R(Text("vec![]") + Key("left")),
        "refer to [<mutability>]":
            R(Text("&%(mutability)s")),
        "lifetime":
            R(Text("'")),
        "static":
            R(Text("static ")),
        "self":
            R(Text("self")),
        "brace pan":
            R(Key("escape, escape, end, left, enter, enter, up, tab")),
        "enum":
            R(Text("enum ")),
        "await":
            R(Text(".await")),
        "async":
            R(Text("async ")),
        "clone":
            R(Text(".clone()")),
        "name space":
            R(Key("colon, colon")),
    }

    extras = [
        Choice("ibits", {
            "eight": "8",
            "sixteen": "16",
            "thirty two": "32",
            "sixty four": "64"
        }),
        Choice("fbits", {
            "thirty two": "32",
            "sixty four": "64"
        }),
        Choice("signed", {"unsigned": "u"}),
        Choice("mutability", {"mute ah | mute": "mut "}),
        IntegerRefST("n", 0, 1000),
        alphabet_support.get_alphabet_choice("a"),
        alphabet_support.get_alphabet_choice("b"),
    ]
    defaults = {"bits": "32", "signed": "i", "mutability": "", "a": "i", "b": "j", "n": 1}
示例#8
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"}
示例#9
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": "",
    }
示例#10
0
class SublimeRulePlugin(MappingRule):
    mapping = {
        # alternative rule
        "[smart] alternative <alternative_index>":
        lazy_value("alternative", 1),
        "smart <color> [alternative]":
        lazy_value("alternative", 2),

        # paste back rule
        "[smart] paste back [<paste_back_index>]":
        lazy_value("paste_back", 1),
        "[smart] paste <color> back":
        lazy_value("paste_back", 2),

        # argument rule
        "[smart] [<adjective>] argument <argument_index>":
        lazy_value("argument", 1),
        "[smart] <vertical_direction> [<ndir>] [<adjective>] argument <argument_index>":
        lazy_value("argument", 2),
        "[smart] [<adjective>] <level> [<level_index>]  argument <argument_index>":
        lazy_value("argument", 3),
        "[smart] <level> [<level_index>] <adjective> argument <argument_index>":
        lazy_value("argument", 4),

        # big roi rule
        "smart <big_roi> [<big_roi_sub_index>]":
        lazy_value("big_roi", 1),
        "[smart] <adjective> <big_roi> [<big_roi_sub_index>]":
        lazy_value("big_roi", 2),
        "[smart] <vertical_abstract_only_direction> [<ndir>] <big_roi> [<big_roi_sub_index>]":
        lazy_value("big_roi", 3),
        "[smart] <vertical_abstract_only_direction> [<ndir>] <block> [<adjective>] <big_roi> [<big_roi_sub_index>]":
        lazy_value("big_roi", 4),

        # insert rule
        "(smart insert|insert item) <item_index>":
        lazy_value("insert_item", 1),

        # collect rule
        "[smart] collect <collectable>":
        lazy_value("collect_indexable", 1),
        "[smart] variable <collect_index>":
        lazy_value("collect_variable", 2),
        "[smart] parameter <collect_index>":
        lazy_value("collect_parameter", 2),
        "[smart] module <collect_index>":
        lazy_value("collect_module", 2),
        "[smart] imported (value|object) <collect_index>":
        lazy_value("collect_imported_value", 2),

        # banana example
        # "banana [<adjective>] <big_roi> [<big_roi_sub_index>]":
        # lazy_value("big_roi",4,vertical_abstract_only_direction = "above",
        # ndir = 1,block = "function"),
    }
    extras = [
        IntegerRefST("argument_index", 1, 10),
        IntegerRefST("alternative_index", 1, 10),
        IntegerRefST("ndir", 1, 20),
        IntegerRefST("level_index", 1, 10),
        IntegerRefST("big_roi_sub_index", 0, 10),
        IntegerRefST("paste_back_index", 0, 10),
        IntegerRefST("collect_index", 1, 30),
        IntegerRefST("item_index", 1, 30),
        Choice(
            "adjective", {
                "first": "first",
                "second": "second",
                "third": "third",
                "fourth": "fourth",
                "fifth": "fifth",
                "sixth": "sixth",
                "seventh": "seventh",
                "eighth": "eighth",
                "ninth": "ninth",
                "last": "last",
                "second last": "second last",
                "third last": "third last",
                "fourth last": "fourth last",
            }),
        Choice("vertical_direction", {
            "up": "up",
            "down": "down",
            "above": "above",
            "below": "below",
        }),
        Choice("vertical_abstract_only_direction", {
            "above": "above",
            "below": "below",
        }),
        Choice("color", {
            "red": 1,
            "blue": 2,
            "green": 3,
            "yellow": 4,
            "orange": 5,
        }),
        Choice("level", {
            "inside": "inside",
        }),
        Choice(
            "big_roi",
            {
                "if condition": "if condition",
                "else if condition": "else if condition",
                "while condition": "while condition",
                "if expression condition": "if expression condition",
                "if expression body": "if expression body",
                "if expression": "if expression",
                "comprehension condition": "comprehension condition",
                "return value": "return value",
                "pass": "******",
                "break": "break",
                "continue": "continue",
                "assertion message": "assertion message",
                "assertion condition": "assertion condition",
                "(assignment right| right)": "assignment right",
                "(assignment left| left)": "assignment left",
                "assignment full": "assignment full",
                "import statement": "import statement",
                #"(import|imported) (value|item|object|element)":"import value",
                #"module" : "module",
                "(expression statement|expression)": "expression statement",
                "iterator": "iterator",
                "iterable": "iterable",
            }),
        Choice("block", {
            "(function|functions)": "function",
        }),
        Choice(
            "collectable", {
                "(variable|variables)": "variable",
                "( parameter | parameters)": "parameter",
                "(module|modules)": "module",
                "(import|imported) (value|item|object|element)":
                "import value",
                "function ( name |names)": "function name",
            }),
    ]
    defaults = {
        "adjective": "None",
        "ndir": 1,
        "level_index": 1,
        "big_roi_sub_index": 0,
        "paste_back_index": 0,
    }
示例#11
0
class JetbrainsRule(MappingRule):
    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("n", 1, 1000),
    ]

    DELAY = "20"

    mapping = {
        ide_shared.QUICK_FIX:
        R(Key("a-enter")),
        ide_shared.DUPLICATE_LINE_DOWN:
        R(Key("c-d")),
        "auto complete":
        R(Key("cs-a")),
        ide_shared.FORMAT_ALL_CODE:
        R(Key("ca-l")),
        "show doc":
        R(Key("c-q")),
        "show param":
        R(Key("c-p")),
        ide_shared.GENERATE_CODE:
        R(Key("a-insert")),
        ide_shared.NEW_FILE:
        R(Key("a-insert")),
        "jump to source":
        R(Key("f4")),
        ide_shared.DELETE_LINE:
        R(Key("c-y")),
        ide_shared.SEARCH_FOR_SYMBOL_IN_ALL_FILES:
        R(Key("cas-n")),
        ide_shared.SEARCH_FOR_FILE_IN_ALL_FILES:
        R(Key("c-n")),
        ide_shared.SEARCH_FOR_CLASS_IN_ALL_FILES:
        R(Key("c-n")),
        ide_shared.BUILD_PROJECT:
        R(Key("c-f9")),
        ide_shared.BUILD_AND_RUN_PROJECT:
        R(Key("s-f10")),
        ide_shared.NEXT_TAB:
        R(Key("a-right/%s" % DELAY)) * Repeat(extra="n"),
        ide_shared.PREVIOUS_TAB:
        R(Key("a-left/%s" % DELAY)) * Repeat(extra="n"),
        ide_shared.COMMENT_LINE:
        R(Key("c-slash")),
        ide_shared.UNCOMMENT_LINE:
        R(Key("cs-slash")),
        "select ex":
        R(Key("c-w")),
        "select ex down":
        R(Key("cs-w")),
        ide_shared.SEARCH_FOR_ALL_IN_ALL_FILES:
        R(Key("shift, shift")),
        ide_shared.FIND_IN_CURRENT_FILE:
        R(Key("c-f")),
        ide_shared.FIND_NEXT_MATCH:
        R(Key("enter")) * Repeat(extra="n"),
        ide_shared.FIND_PREVIOUS_MATCH:
        R(Key("s-enter")) * Repeat(extra="n"),
        ide_shared.REPLACE_IN_CURRENT_FILE:
        R(Key("c-r")),
        ide_shared.FIND_IN_ALL_FILES:
        R(Key("cs-f")),
        ide_shared.REPLACE_IN_ALL_FILES:
        R(Key("cs-r")),
        ide_shared.GO_TO_LINE:
        R(Key("c-g/%s" % DELAY) + Text("%(n)s") + Key("enter")),
        ide_shared.IMPLEMENT_METHODS:
        R(Key("c-i")),
        ide_shared.OVERRIDE_METHOD:
        R(Key("c-o")),
        "run config":
        R(Key("as-f10")),
        ide_shared.FIND_USAGE:
        R(Key("a-f7")),
        ide_shared.GO_TO_DECLARATION:
        R(Key("c-b")),
        ide_shared.SMART_AUTO_COMPLETE:
        R(Key("cs-space")),
        ide_shared.NAVIGATE_BACKWARD:
        R(Key("ca-left")) * Repeat(extra="n"),
        ide_shared.NAVIGATE_FORWARD:
        R(Key("ca-right")) * Repeat(extra="n"),
        ide_shared.METHOD_FORWARD:
        R(Key("a-down")) * Repeat(extra="n"),
        ide_shared.METHOD_BACKWARD:
        R(Key("a-up")) * Repeat(extra="n"),
        ide_shared.NEXT_ERROR:
        R(Key("f2")) * Repeat(extra="n"),
        ide_shared.PREVIOUS_ERROR:
        R(Key("s-f2")) * Repeat(extra="n"),
        ide_shared.OPTIMIZE_IMPORTS:
        R(Key("ca-o")) * Repeat(extra="n"),
        ide_shared.MOVE_LINE_UP:
        R(Key("as-up")) * Repeat(extra="n"),
        ide_shared.MOVE_LINE_DOWN:
        R(Key("as-down")) * Repeat(extra="n"),
        ide_shared.EXPAND_SELECTION:
        R(Key("c-w")) * Repeat(extra="n"),
        ide_shared.SHRINK_SELECTION:
        R(Key("cs-w")) * Repeat(extra="n"),
        ide_shared.AUTO_INDENT:
        R(Key("ca-i")),
        ide_shared.CLOSE_TAB_N_TIMES:
        R(Key("c-f4/%s" % DELAY)) * Repeat(extra="n"),
        ide_shared.RUN_PROJECT:
        R(Key("s-f10")),
        ide_shared.DEBUG_PROJECT:
        R(Key("s-f9")),
        ide_shared.REDO:
        R(Key("cs-z")) * Repeat(extra="n"),
        ide_shared.SHOW_SETTINGS:
        R(Key("ca-s")),
        # only works if you disable tabs.
        ide_shared.CLOSE_PANE_N_TIMES:
        R(Key("c-f4/%s" % DELAY)) * Repeat(extra="n"),

        # refactoring
        ide_shared.REFACTOR:
        R(Key("cas-t")),
        ide_shared.RENAME:
        R(Key("s-f6")),
        ide_shared.INLINE:
        R(Key("ca-n")),
        ide_shared.EXTRACT_METHOD:
        R(Key("ca-m")),
        ide_shared.EXTRACT_VARIABLE:
        R(Key("ca-v")) * Repeat(extra="n"),
        ide_shared.EXTRACT_FIELD:
        R(Key("ca-f")) * Repeat(extra="n"),
        ide_shared.EXTRACT_CONSTANT:
        R(Key("ca-c")) * Repeat(extra="n"),
        ide_shared.EXTRACT_PARAMETER:
        R(Key("ca-p")) * Repeat(extra="n"),

        # window navigation
        ide_shared.GO_TO_EDITOR:
        R(Key("escape")),
        ide_shared.GO_TO_PROJECT_EXPLORER:
        R(Key("a-1")),
        ide_shared.TOGGLE_TERMINAL:
        R(Key("a-f12")),

        # must be bound manually below this point
        ide_shared.DELETE_TO_LINE_START:
        R(Key("a-d,0")),
        ide_shared.DELETE_TO_LINE_END:
        R(Key("a-d,$")),
        # jet brains can only split horizontally or vertically
        ide_shared.SPLIT_WINDOW_UP:
        R(Key("cs-s,h")),
        ide_shared.SPLIT_WINDOW_DOWN:
        R(Key("cs-s,h")),
        ide_shared.SPLIT_WINDOW_RIGHT:
        R(Key("cs-s,v")),
        ide_shared.SPLIT_WINDOW_LEFT:
        R(Key("cs-s,v")),
        ide_shared.SPLIT_MOVE_UP:
        R(Key("cs-s,up")) * Repeat(extra="n"),
        ide_shared.SPLIT_MOVE_DOWN:
        R(Key("cs-s,down")) * Repeat(extra="n"),
        ide_shared.SPLIT_MOVE_RIGHT:
        R(Key("cs-s,right")) * Repeat(extra="n"),
        ide_shared.SPLIT_MOVE_LEFT:
        R(Key("cs-s,left")) * Repeat(extra="n"),
        ide_shared.RENAME_CURRENT_FILE:
        R(Key("cas-r")),
    }

    defaults = {"n": 1, "mim": ""}
示例#12
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": ""}
示例#13
0
class VoiceCpp(MappingRule):
    mapping = {
        "include <library>": R(Text("#include <%(library)s>")),
        "document <item>": R(Function(show_documentation)),
        "nice <item>": R(Function(insert_snippet)),
    }
    extras = [
        Dictation("description"),
        IntegerRefST("nn", 1, 10),
        Choice("item", spoken_mapping),
        Choice(
            "library", {
                'algorithm': 'algorithm',
                'any': 'any',
                'array': 'array',
                'atomic': 'atomic',
                'bit': 'bit',
                'bit set': 'bitset',
                'char convert': 'charconv',
                'chrono': 'chrono',
                'code convert': 'codecvt',
                'compare': 'compare',
                'complex': 'complex',
                'concepts': 'concepts',
                'condition variable': 'condition_variable',
                'contract': 'contract',
                'deque': 'deque',
                'exception': 'exception',
                'execution': 'execution',
                'file SYSTEM': 'filesystem',
                'forward list': 'forward_list',
                'F stream': 'fstream',
                'functional': 'functional',
                'future': 'future',
                'initializer list': 'initializer_list',
                'io manipulation': 'iomanip',
                'ios': 'ios',
                'io SFWD': 'iosfwd',
                'io STREAM': 'iostream',
                'I stream': 'istream',
                'iterator': 'iterator',
                'limits': 'limits',
                'list': 'list',
                'locale': 'locale',
                'map': 'map',
                'memory': 'memory',
                'memory resource': 'memory_resource',
                'mu TEX': 'mutex',
                'new': 'new',
                'numeric': 'numeric',
                'optional': 'optional',
                'O stream': 'ostream',
                'queue': 'queue',
                'random': 'random',
                'ranges': 'ranges',
                'ratio': 'ratio',
                'regular expression': 'regex',
                'scoped allocator': 'scoped_allocator',
                'set': 'set',
                'shared mutex': 'shared_mutex',
                'span': 'span',
                'S stream': 'sstream',
                'stack': 'stack',
                'STD except': 'stdexcept',
                'stream BUF': 'streambuf',
                'string': 'string',
                'string view': 'string_view',
                'string stream': 'strstream',
                'SYNC stream': 'syncstream',
                'system error': 'system_error',
                'thread': 'thread',
                'tuple': 'tuple',
                'type INDEX': 'typeindex',
                'type INFO': 'typeinfo',
                'type traits': 'type_traits',
                'unordered map': 'unordered_map',
                'unordered set': 'unordered_set',
                'utility': 'utility',
                'val ARRAY': 'valarray',
                'variant': 'variant',
                'vector': 'vector',
                'version': 'version'
            })
    ]
    defaults = {
        "nn": 1,
    }
示例#14
0
class NavigationNon(MappingRule):

    pronunciation = "navigation companion"

    mapping = {
        "<direction> <time_in_seconds>":
        AsynchronousAction(
            [L(S(["cancel"], Key("%(direction)s"), consume=False))],
            repetitions=1000,
            blocking=False),
        "erase multi clipboard":
        R(Function(navigation.erase_multi_clipboard)),
        "undo [repeat <nnavi10>]":
        R(Key("c-z")) * Repeat(extra="nnavi10"),
        "redo [repeat <nnavi10>]":
        R(
            ContextAction(
                default=Key("c-y") * Repeat(extra="nnavi10"),
                actions=[
                    (AppContext(executable=["rstudio", "foxitreader"]),
                     Key("cs-z") * Repeat(extra="nnavi10")),
                ])),
        "shift click":
        R(Key("shift:down") + Mouse("left") + Key("shift:up")),
        "find":
        R(Key("c-f")),
        "find next [<n>]":
        R(Key("f3")) * Repeat(extra="n"),
        "find prior [<n>]":
        R(Key("s-f3")) * Repeat(extra="n"),
        "find everywhere":
        R(Key("cs-f")),
        "replace":
        R(Key("c-h")),
        "F<function_key>":
        R(Key("f%(function_key)s")),
        "[show] context menu":
        R(Key("s-f10")),
        "lean":
        R(Function(navigation.right_down)),
        "hoist":
        R(Function(navigation.right_up)),
        "kick mid":
        R(Function(navigation.middle_click)),
        "shift right click":
        R(Key("shift:down") + Mouse("right") + Key("shift:up")),
        "curse <direction> [<direction2>] [<nnavi500>] [<dokick>]":
        R(Function(navigation.curse)),
        "scree <direction> [<nnavi500>]":
        R(Function(navigation.wheel_scroll)),
        "scree <direction> <time_in_seconds>":
        R(
            AsynchronousAction([
                L(S(["cancel"], Function(navigation.wheel_scroll, nnavi500=1)))
            ],
                               repetitions=1000,
                               blocking=False)),
        "colic":
        R(Key("control:down") + Mouse("left") + Key("control:up")),
        "garb [<nnavi500>]":
        R(
            Mouse("left") + Mouse("left") +
            Function(navigation.stoosh_keep_clipboard)),
        "drop [<nnavi500>]":
        R(
            Mouse("left") + Mouse("left") + Function(
                navigation.drop_keep_clipboard, capitalization=0, spacing=0)),
        "sure stoosh":
        R(Key("c-c")),
        "sure cut":
        R(Key("c-x")),
        "sure spark":
        R(Key("c-v")),
        "(reload|refresh)":
        R(Key("c-r")),
        "maxiwin":
        R(Key("w-up")),
        "move window":
        R(Key("a-space, r, a-space, m")),
        "window left [<n>]":
        R(Key("w-left")) * Repeat(extra="n"),
        "window right [<n>]":
        R(Key("w-right")) * Repeat(extra="n"),
        "window up [<n>]":
        R(Key("w-up")) * Repeat(extra="n"),
        "window down [<n>]":
        R(Key("w-down")) * Repeat(extra="n"),
        "window expand left [<n>]":
        R(Key("wac-left")) * Repeat(extra="n"),
        "window expand right [<n>]":
        R(Key("wac-right")) * Repeat(extra="n"),
        "window expand up [<n>]":
        R(Key("wac-up")) * Repeat(extra="n"),
        "window expand down [<n>]":
        R(Key("wac-down")) * Repeat(extra="n"),
        "take screenshot":
        R(Key("ws-s")),
        "monitor (left | lease) [<n>]":
        R(Key("sw-left")) * Repeat(extra="n"),
        "monitor (right | ross) [<n>]":
        R(Key("sw-right")) * Repeat(extra="n"),
        "(next | prior) window":
        R(Key("ca-tab, enter")),
        "switch (window | windows)":
        R(Key("ca-tab")) * Repeat(extra="n"),
        "next tab [<n>]":
        R(Key("c-pgdown")) * Repeat(extra="n"),
        "prior tab [<n>]":
        R(Key("c-pgup")) * Repeat(extra="n"),
        "close tab [<n>]":
        R(Key("c-w/20")) * Repeat(extra="n"),
        "<capitalization> <textnv>":
        R(Function(textformat.nonccr_format_text)),
    }

    extras = [
        Dictation("text"),
        Dictation("textnv"),
        Dictation("mim"),
        IntegerRefST("function_key", 1, 13),
        IntegerRefST("n", 1, 50),
        IntegerRefST("nnavi500", 1, 5000),
        IntegerRefST("nnavi10", 1, 10),
        Choice(
            "time_in_seconds", {
                "super slow": 5,
                "slow": 2,
                "normal": 0.6,
                "fast": 0.1,
                "superfast": 0.05
            }),
        navigation_support.get_direction_choice("direction"),
        navigation_support.get_direction_choice("direction2"),
        navigation_support.TARGET_CHOICE,
        Choice("dokick", {
            "kick": 1,
            "psychic": 2
        }),
        Choice("capitalization", {
            "say": 6,
            "cop": 7,
            "slip": 8,
        }),
        Choice("wm", {
            "ex": 1,
            "tie": 2
        }),
    ]
    defaults = {
        "n": 1,
        "mim": "",
        "nnavi500": 1,
        "direction2": "",
        "dokick": 0,
        "text": "",
        "wm": 2
    }
示例#15
0
文件: vscode2.py 项目: pimp22/Caster
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":
        R(Key("cs-p"), 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 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
        "[show] terminal":
        R(Key("c-backtick")),
        "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")),

        # 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": ""}
示例#16
0
文件: sublime.py 项目: lahwran/Caster
class SublimeRule(MappingRule):
    mapping = {
        "new file":
        R(Key("c-n")),
        "new window":
        R(Key("cs-n")),
        "open file":
        R(Key("c-o")),
        "open folder":
        R(Key("f10, f, down:2, enter")),
        "open recent":
        R(Key("f10, f, down:3, enter")),
        "save as":
        R(Key("cs-s")),
        #
        "comment line":
        R(Key("c-slash")),
        "comment block":
        R(Key("cs-slash")),
        "outdent lines":
        R(Key("c-lbracket")),
        "join lines":
        R(Key("c-j")),
        "match bracket":
        R(Key("c-m")),
        #
        "(select | sell) all":
        R(Key("c-a")),
        "(select | sell) scope [<n2>]":
        R(Key("cs-space") * Repeat(extra="n2")),
        "(select | sell) brackets [<n2>]":
        R(Key("cs-m") * Repeat(extra="n2")),
        "(select | sell) indent":
        R(Key("cs-j")),
        #
        "find":
        R(Key("c-f")),
        "get all":
        R(Key("a-enter")),
        "replace":
        R(Key("c-h")),
        "replace all":
        R(Key("ca-enter")),
        "paste from history":
        R(Key("c-k,c-v")),
        "edit lines":
        R(Key("cs-l")),
        "edit next [<n3>]":
        R(Key("c-d/10")) * Repeat(extra="n3"),
        "edit only next [<n3>]":
        R(Key("c-k,c-d/10")) * Repeat(extra="n3"),
        "edit up [<n3>]":
        R(Key("ac-up")) * Repeat(extra="n3"),
        "edit down [<n3>]":
        R(Key("ac-down")) * Repeat(extra="n3"),
        "edit all":
        R(Key("a-f3")),
        #
        "transform upper":
        R(Key("c-k, c-u")),
        "transform lower":
        R(Key("c-k, c-l")),
        #
        "line <ln1>":
        R(Key("c-g/10") + Text("%(ln1)s") + Key("enter")),
        "<action> [line] <ln1> [by <ln2>]":
        R(Function(navigation.action_lines)),
        "[move] line down [<n3>]":
        R(Key("cs-down") * Repeat(extra='n3')),
        "[move] line up [<n3>]":
        R(Key("cs-up") * Repeat(extra='n3')),
        #
        "go to file":
        R(Key("c-p")),
        "go to <dict> [<filetype>]":
        R(Key("c-p") + Text("%(dict)s" + "%(filetype)s") + Key("enter")),
        "file back [<n2>]":
        R(Key("c-p") + Key("down") * Repeat(extra="n2") + Key("enter")),
        #
        "go to word":
        R(Key("c-semicolon")),
        "go to symbol":
        R(Key("c-r")),
        "go to [symbol in] project":
        R(Key("cs-r")),
        "go to that":
        R(Store() + Key("cs-r") + Retrieve() + Key("enter")),
        "find that in project":
        R(Store() + Key("cs-f") + Retrieve() + Key("enter")),
        "find that":
        R(Store() + Key("c-f") + Retrieve() + Key("enter")),
        "command pallette":
        R(Key("cs-p")),
        #
        "go back [<n2>]":
        R(Key("a-minus") * Repeat(extra="n2")),
        "go forward [<n2>]":
        R(Key("a-plus") * Repeat(extra="n2")),
        "next modification":
        R(Key("c-dot")),
        "previous modification":
        R(Key("c-comma")),
        #
        "fold":
        R(Key("cs-lbracket")),
        "unfold":
        R(Key("cs-rbracket")),
        "unfold all":
        R(Key("c-k, c-j")),
        "fold [level] <n2>":
        R(Key("c-k, c-%(n2)s")),
        #
        "full screen":
        R(Key("f11")),
        "toggle side bar":
        R(Key("c-k, c-b")),
        "show key bindings":
        R(Key("f10, p, right, k")),
        "show at center":
        R(Key("c-k,c-c")),
        "zoom in [<n2>]":
        R(Key("c-equal") * Repeat(extra="n2")),
        "zoom out [<n2>]":
        R(Key("c-minus") * Repeat(extra="n2")),
        #
        "(set | add) bookmark":
        R(Key("c-f2")),
        "next bookmark":
        R(Key("f2")),
        "previous bookmark":
        R(Key("s-f2")),
        "clear bookmarks":
        R(Key("cs-f2")),
        #
        "set mark":
        R(Key("c-k,c-space")),
        "select mark":
        R(Key("c-k,c-a")),
        "swap with mark":
        R(Key("c-k,c-x")),
        "delete mark":
        R(Key("c-k,c-w")),
        #
        "build it":
        R(Key("c-b")),
        "build with":
        R(Key("cs-b")),
        "build <nth>":
        R(Key("c-s,a-%(nth)s,c-b")),
        "build [<nth>] last":
        R(Key("c-s,a-1") + Key("c-pageup") * Repeat(extra="nth") + Key("c-b")),
        #
        "record macro":
        R(Key("c-q")),
        "play [back] macro [<n3>]":
        R(Key("cs-q/10")),
        "(new | create) snippet":
        R(Key("ac-n")),
        #
        "close tab":
        R(Key("c-w")),
        "next tab":
        R(Key("c-pgdown")),
        "previous tab":
        R(Key("c-pgup")),
        "<nth> tab":
        R(Key("a-%(nth)s")),
        "[<nth>] last tab":
        R(Key("a-1") + Key("c-pageup") * Repeat(extra="nth")),
        "column <cols>":
        R(Key("as-%(cols)s")),
        "focus <panel>":
        R(Key("c-%(panel)s")),
        "move <panel>":
        R(Key("cs-%(panel)s")),
        #
        "open terminal":
        R(Key("cs-t")),
        "open console":
        R(Key("c-`")),
    }
    extras = [
        Dictation("dict"),
        IntegerRefST("ln1", 1, 1000),
        IntegerRefST("ln2", 1, 1000),
        IntegerRefST("n2", 1, 9),
        IntegerRefST("n3", 1, 21),
        Choice("action", navigation.actions),
        Choice(
            "nth", {
                "first": "1",
                "second": "2",
                "third": "3",
                "fourth": "4",
                "fifth": "5",
                "sixth": "6",
                "seventh": "7",
                "eighth": "8",
                "ninth": "9",
            }),
        Choice("cols", {
            "one": "1",
            "two": "2",
            "three": "3",
            "grid": "5",
        }),
        Choice("panel", {
            "one": "1",
            "left": "1",
            "two": "2",
            "right": "2",
        }),
        Choice(
            "filetype", {
                "pie | python": "py",
                "mark [down]": "md",
                "tech": "tex",
                "tommel": "toml",
            }),
    ]
    defaults = {
        "ln2": "",
        "n2": 1,
        "n3": 1,
        "file type": "",
        "nth": "1",
    }
示例#17
0
class VHDL(MergeRule):

    pronunciation = "VHDL"

    mapping = {
        SymbolSpecs.COMMENT:
        R(Text("--")),
        SymbolSpecs.IF:
        R(
            Text("if () then ") + Key("enter,enter") + Text("end if;") +
            Key("home,up,up")),
        SymbolSpecs.ELSE:
        R(Key("e,l,s,e,enter")),
        "alternate":
        R(Key("e,l,s,i, f,space,T,O,K,E,N,space,t,h,e,n,enter,tab")),
        SymbolSpecs.CASE:
        R(Text("case TOKEN is") + Key("enter,tab")),
        "when":
        R(Text("when ")),
        SymbolSpecs.FOR_LOOP:
        R(Text("for  in to loop") + Key("left:12")),
        "generate":
        R(Text("GENERATE")),
        "Input":
        R(Text("in")),
        "Output":
        R(Text("out")),
        "Standard Logic":
        R(Text("std_logic")),
        "Standard Logic Vector":
        R(Text("std_logic_vector")),
        "Constant":
        R(Text("constant : ") + Key("left,left")),
        "Signal":
        R(Text("signal : ") + Key("left,left")),
        "integer":
        R(Text("integer TOKEN to TOKEN")),
        "type":
        R(Text("type :") + Key("left")),
        # Operators
        "Not Equal":
        R(Text("/=")),
        SymbolSpecs.NOT:
        R(Text("not")),
        SymbolSpecs.OR:
        R(Text("or")),
        "not and":
        R(Text("nand")),
        "XOR":
        R(Text("xor")),
        "X NOR":
        R(Text("xnor")),
        "Assignment":
        R(Text(" <= ") + Key("left")),
        "Association":
        R(Text(' => ') + Key("left")),
        "Concatenate":
        R(Text(" & ")),
        "Down To":
        R(Text("downto")),
        "Up To":
        R(Text("upto")),
        "Input":
        R(Text("in")),
        "Output":
        R(Text("out")),
        "Standard Logic":
        R(Text("std_logic")),
        "Standard Logic Vector":
        R(Text("std_logic_vector")),
        "Constant":
        R(Text("constant : ") + Key("left,left")),
        "Signal":
        R(Text("signal : ") + Key("left,left")),
        "integer":
        R(Text("integer TOKEN to TOKEN")),
        "type":
        R(Text("type :") + Key("left")),
        # Operators
        "Not Equal":
        R(Text("/=")),
        SymbolSpecs.NOT:
        R(Text("not")),
        SymbolSpecs.OR:
        R(Text("or")),
        "not and":
        R(Text("nand")),
        "XOR":
        R(Text("xor")),
        "X NOR":
        R(Text("xnor")),
        "Assignment":
        R(Text(" <= ") + Key("left")),
        "Association":
        R(Text(' => ') + Key("left")),
        "Concatenate":
        R(Text(" & ")),
        "Down To":
        R(Text("downto")),
        "Up To":
        R(Text("upto")),
        SymbolSpecs.COMMENT:
        R(Text("-- ")),
        "binary [<amount>] <digit>":
        R(Function(binary_string)),

        #VHDL specific
        "length":
        R(Text("length'")),
        SymbolSpecs.TO_INTEGER:
        R(Text("to_integer()") + Key("left")),
        "converts to signed":
        R(Text("signed()") + Key("left")),
        "converts to unsigned":
        R(Text("unsigned()") + Key("left")),
        "converts to unsigned specific":
        R(Text("conv_unsigned(,)") + Key("left:2")),
        "converts to integer specific":
        R(Text("conv_integer(,)") + Key("left:2")),
    }

    extras = [
        IntegerRefST("amount", 1, 128),
        Choice("digit", {
            "(zero|zeros)": 0,
            "(one|once)": 1
        }),
        IntegerRefST("digit", 0, 2)
    ]
    defaults = {}
示例#18
0
class JetbrainsRule(MappingRule):

    mapping = {
        "quick fix": R(Key("a-enter")),
        "(duplicate|duple) %s" % DOWN: R(Key("c-d")),
        "auto complete": R(Key("cs-a")),
        "format [code]": R(Key("ca-l")),
        "show doc": R(Key("c-q")),
        "find class": R(Key("c-n")),
        "build": R(Key("c-f9")),
        "build and run": R(Key("s-f10")),
        "%s tab [<n>]|tab %s [<n>]" % (FORWARD, RIGHT): R(Key("a-right/%s" % DELAY)) * Repeat(extra="n"),
        "%s tab [<n>]|tab %s [<n>]" % (BACK, LEFT): R(Key("a-left/%s" % DELAY)) * Repeat(extra="n"),
        "(comment|rem) [line]": R(Key("c-slash")),
        "(uncomment|unrem) [line]": R(Key("cs-slash")),
        "select ex" : R(Key("c-w")),
        "select ex down" : R(Key("cs-w")),
        "find file": R(Key("shift, shift")),
        "find": R(Key("c-f")),
        "find %s [match] [<n>]" % FORWARD: R(Key("enter")) * Repeat(extra="n"),
        "find %s [match] [<n>]" % BACK: R(Key("s-enter")) * Repeat(extra="n"),
        "replace": R(Key("c-r")),
        "find [in] (all|files)": R(Key("cs-f")),
        "replace [in] (all|files)": R(Key("cs-r")),
        "go [to line] [<n>]": R(Key("c-g/%s" % DELAY) + Text("%(n)s") + Key("enter")),
        "implement (%s|%s)" % (method, methods): R(Key("c-i")),
        "override %s" % method: R(Key("c-o")),
        "run config": R(Key("as-f10")),
        "[find] (usage|usages)": R(Key("a-f7")),
        "[go to] (source|declaration)": R(Key("c-b")),
        "(skraken|smart kraken)": R(Key("cs-space")),
        "go %s [<n>]" % FORWARD: R(Key("ca-right")) * Repeat(extra="n"),
        "go %s [<n>]" % BACK: R(Key("ca-left")) * Repeat(extra="n"),
        "%s %s [<n>]" % (method, FORWARD): R(Key("a-down")) * Repeat(extra="n"),
        "%s %s [<n>]" % (method, BACK): R(Key("a-up")) * Repeat(extra="n"),
        "(%s error|error %s)" % (FORWARD, RIGHT): R(Key("f2")) * Repeat(extra="n"),
        "(%s error|error %s)" % (BACK, LEFT): R(Key("s-f2")) * Repeat(extra="n"),
        "[organize|optimize] imports": R(Key("ca-o")) * Repeat(extra="n"),
        "[move] line %s [<n>]" % UP: R(Key("as-up")) * Repeat(extra="n"),
        "[move] line %s [<n>]" % DOWN: R(Key("as-down")) * Repeat(extra="n"),
        "expand [selection] [<n>]": R(Key("c-w")) * Repeat(extra="n"),
        "shrink [selection] [<n>]": R(Key("cs-w")) * Repeat(extra="n"),
        "auto indent": R(Key("ca-i")),
        "close tab [<n>]|tab close [<n>]": R(Key("c-f4/%s" % DELAY)) * Repeat(extra="n"),
        "run": R(Key("s-f10")),
        "debug": R(Key("s-f9")),
        "redo [<n>]": R(Key("cs-z")) * Repeat(extra="n"),
        "[show] settings": R(Key("ca-s")),

        # only works if you disable tabs.
        "close pane [<n>]|pane close [<n>]": R(Key("c-f4/%s" % DELAY)) * Repeat(extra="n"),

        # refactoring
        "refactor": R(Key("cas-t")),
        "rename": R(Key("s-f6")),
        "inline": R(Key("ca-n")),
        "(pull|extract)": R(Key("ca-m")),
        "%s [variable|var]" % extract: R(Key("ca-v")) * Repeat(extra="n"),
        "%s field" % extract: R(Key("ca-f")) * Repeat(extra="n"),
        "%s constant" % extract: R(Key("ca-c")) * Repeat(extra="n"),
        "%s (param|parameter)" % extract: R(Key("ca-p")) * Repeat(extra="n"),

        # window navigation
        "focus editor": R(Key("escape")),
        "go [to] project": R(Key("a-1")),
        "[toggle] (term|terminal)": R(Key("a-f12")),

        # must be bound manually below this point
        "(kill|delete) %s" % FORWARD: R(Key("a-d,0")),
        "(kill|delete) %s" % BACK: R(Key("a-d,$")),

        # jet brains can only split horizontally or vertically
        "split [pane] %s" % UP: R(Key("cs-s,h")),
        "split [pane] %s" % DOWN: R(Key("cs-s,h")),
        "split [pane] %s" % RIGHT: R(Key("cs-s,v")),
        "split [pane] %s" % LEFT: R(Key("cs-s,v")),
        "pane %s [<n>]" % UP: R(Key("cs-s,up")) * Repeat(extra="n"),
        "pane %s [<n>]" % DOWN: R(Key("cs-s,down")) * Repeat(extra="n"),
        "(pane %s|%s pane) [<n>]" % (RIGHT, RIGHT): R(Key("cs-s,right")) * Repeat(extra="n"),
        "(pane %s|%s pane) [<n>]" % (LEFT, LEFT): R(Key("cs-s,left")) * Repeat(extra="n"),
        "file rename | rename file": R(Key("cas-r")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("n", 1, 1000),
    ]

    defaults = {"n": 1, "mim": ""}
示例#19
0
文件: nav.py 项目: tlappas/Caster
class Navigation(MergeRule):
    pronunciation = "navigation"

    mapping = {
        # "periodic" repeats whatever comes next at 1-second intervals until "terminate"
        # or "escape" (or your SymbolSpecs.CANCEL) is spoken or 100 tries occur
        "periodic":
        ContextSeeker(forward=[
            L(
                S(["cancel"], lambda: None),
                S(["*"],
                  lambda fnparams: UntilCancelled(
                      Mimic(*filter(lambda s: s != "periodic", fnparams)), 1).
                  execute(),
                  use_spoken=True))
        ]),
        # VoiceCoder-inspired -- these should be done at the IDE level
        "fill <target>":
        R(Key("escape, escape, end"), show=False) + AsynchronousAction(
            [L(S(["cancel"], Function(context.fill_within_line)))],
            time_in_seconds=0.2,
            repetitions=50),
        "jump in":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["right", "(~[~{~<"]))],
            time_in_seconds=0.1,
            repetitions=50),
        "jump out":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["right", ")~]~}~>"]))],
            time_in_seconds=0.1,
            repetitions=50),
        "jump back":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["left", "(~[~{~<"]))],
            time_in_seconds=0.1,
            repetitions=50),
        "jump back in":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["left", "(~[~{~<"]))],
            finisher=Key("right"),
            time_in_seconds=0.1,
            repetitions=50),

        # keyboard shortcuts
        'save':
        R(Key("c-s"), rspec="save"),
        'shock [<nnavi50>]':
        R(Key("enter"), rspec="shock") * Repeat(extra="nnavi50"),
        # "(<mtn_dir> | <mtn_mode> [<mtn_dir>]) [(<nnavi500> | <extreme>)]":
        #     R(Function(text_utils.master_text_nav)), # this is now implemented below
        "shift click":
        R(Key("shift:down") + Mouse("left") + Key("shift:up")),
        "stoosh [<nnavi500>]":
        R(Function(navigation.stoosh_keep_clipboard), rspec="stoosh"),
        "cut [<nnavi500>]":
        R(Function(navigation.cut_keep_clipboard), rspec="cut"),
        "spark [<nnavi500>] [(<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)]]":
        R(Function(navigation.drop_keep_clipboard), rspec="spark"),
        "splat [<splatdir>] [<nnavi10>]":
        R(Key("c-%(splatdir)s"), rspec="splat") * Repeat(extra="nnavi10"),
        "deli [<nnavi50>]":
        R(Key("del/5"), rspec="deli") * Repeat(extra="nnavi50"),
        "clear [<nnavi50>]":
        R(Key("backspace/5:%(nnavi50)d"), rspec="clear"),
        SymbolSpecs.CANCEL:
        R(Key("escape"), rspec="cancel"),
        "shackle":
        R(Key("home/5, s-end"), rspec="shackle"),
        "(tell | tau) <semi>":
        R(Function(navigation.next_line), rspec="tell dock"),
        "duple [<nnavi50>]":
        R(Function(navigation.duple_keep_clipboard), rspec="duple"),
        "Kraken":
        R(Key("c-space"), rspec="Kraken"),
        "undo [<nnavi10>]":
        R(Key("c-z")) * Repeat(extra="nnavi10"),
        "redo [<nnavi10>]":
        R(
            ContextAction(
                default=Key("c-y") * Repeat(extra="nnavi10"),
                actions=[
                    (AppContext(executable=["rstudio", "foxitreader"]),
                     Key("cs-z") * Repeat(extra="nnavi10")),
                ])),

        # text formatting
        "set [<big>] format (<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)]":
        R(Function(textformat.set_text_format)),
        "clear castervoice [<big>] formatting":
        R(Function(textformat.clear_text_format)),
        "peek [<big>] format":
        R(Function(textformat.peek_text_format)),
        "(<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)] <textnv> [brunt]":
        R(Function(textformat.master_format_text)),
        "[<big>] format <textnv>":
        R(Function(textformat.prior_text_format)),
        "<word_limit> [<big>] format <textnv>":
        R(Function(textformat.partial_format_text)),
        "hug <enclosure>":
        R(Function(text_utils.enclose_selected)),
        "dredge [<nnavi10>]":
        R(Key("alt:down, tab/20:%(nnavi10)d, alt:up"),
          rdescript="Core: switch to most recent Windows"),

        # Ccr Mouse Commands
        "kick [<nnavi3>]":
        R(Function(navigation.left_click)) * Repeat(extra="nnavi3"),
        "psychic":
        R(Function(navigation.right_click)),
        "(kick double|double kick)":
        R(Function(navigation.left_click) * Repeat(2)),
        "squat":
        R(Function(navigation.left_down)),
        "bench":
        R(Function(navigation.left_up)),

        # keystroke commands
        "<direction> [<nnavi500>]":
        R(Key("%(direction)s") * Repeat(extra='nnavi500'),
          rdescript="arrow keys"),
        "(lease wally | latch) [<nnavi10>]":
        R(Key("home:%(nnavi10)s")),
        "(ross wally | ratch) [<nnavi10>]":
        R(Key("end:%(nnavi10)s")),
        "sauce wally [<nnavi10>]":
        R(Key("c-home:%(nnavi10)s")),
        "dunce wally [<nnavi10>]":
        R(Key("c-end:%(nnavi10)s")),
        "bird [<nnavi500>]":
        R(Key("c-left:%(nnavi500)s")),
        "firch [<nnavi500>]":
        R(Key("c-right:%(nnavi500)s")),
        "brick [<nnavi500>]":
        R(Key("s-left:%(nnavi500)s")),
        "frick [<nnavi500>]":
        R(Key("s-right:%(nnavi500)s")),
        "blitch [<nnavi500>]":
        R(Key("cs-left:%(nnavi500)s")),
        "flitch [<nnavi500>]":
        R(Key("cs-right:%(nnavi500)s")),
        "<modifier> <button_dictionary_500> [<nnavi500>]":
        R(Key("%(modifier)s%(button_dictionary_500)s") *
          Repeat(extra='nnavi500'),
          rdescript=
          "press modifier keys plus buttons from button_dictionary_500"),
        "<modifier> <button_dictionary_10> [<nnavi10>]":
        R(Key("%(modifier)s%(button_dictionary_10)s") *
          Repeat(extra='nnavi10'),
          rdescript="press modifier keys plus buttons from button_dictionary_10"
          ),
        "<modifier> <button_dictionary_1>":
        R(Key("%(modifier)s%(button_dictionary_1)s"),
          rdescript=
          "press modifiers plus buttons from button_dictionary_1, non-repeatable"
          ),

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

        # "key stroke [<modifier>] <combined_button_dictionary>":
        #     R(Text('Key("%(modifier)s%(combined_button_dictionary)s")')),
    }
    tell_commands_dict = {
        "dock": ";",
        "doc": ";",
        "sink": "",
        "com": ",",
        "deck": ":"
    }
    tell_commands_dict.update(_tpd)

    # I tried to limit which things get repeated how many times in hopes that it will help prevent the bad grammar error
    # this could definitely be changed. perhaps some of these should be made non-CCR
    button_dictionary_500 = {
        "(tab | tabby)": "tab",
        "(backspace | clear)": "backspace",
        "(delete|deli)": "del",
        "(escape | cancel)": "escape",
        "(enter | shock)": "enter",
        "(left | lease)": "left",
        "(right | ross)": "right",
        "(up | sauce)": "up",
        "(down | dunce)": "down",
        "page (down | dunce)": "pgdown",
        "page (up | sauce)": "pgup",
        "space": "space"
    }
    button_dictionary_10 = {
        "(F{}".format(i) + " | function {})".format(i): "f{}".format(i)
        for i in range(1, 13)
    }
    button_dictionary_10.update(caster_alphabet())
    button_dictionary_10.update(_tpd)
    longhand_punctuation_names = {
        "minus": "hyphen",
        "hyphen": "hyphen",
        "comma": "comma",
        "deckle": "colon",
        "colon": "colon",
        "slash": "slash",
        "backslash": "backslash"
    }
    button_dictionary_10.update(longhand_punctuation_names)
    button_dictionary_1 = {
        "(home | lease wally | latch)": "home",
        "(end | ross wally | ratch)": "end",
        "insert": "insert",
        "zero": "0",
        "one": "1",
        "two": "2",
        "three": "3",
        "four": "4",
        "five": "5",
        "six": "6",
        "seven": "7",
        "eight": "8",
        "nine": "9"
    }
    combined_button_dictionary = {}
    for dictionary in [
            button_dictionary_1, button_dictionary_10, button_dictionary_500
    ]:
        combined_button_dictionary.update(dictionary)

    modifier_choice_object = Choice(
        "modifier",
        {
            "(control | fly)": "c-",  #TODO: make DRY
            "(shift | shin)": "s-",
            "alt": "a-",
            "(control shift | que)": "cs-",
            "control alt": "ca-",
            "(shift alt | alt shift)": "sa-",
            "(control alt shift | control shift alt)":
            "csa-",  # control must go first
            "windows": "w-",  # windows should go before alt/shift
            "control windows": "cw-",
            "control windows alt": "cwa-",
            "control windows shift": "cws-",
            "windows shift alt": "wsa-",
            "windows alt shift": "was-",
            "windows shift": "ws-",
            "windows alt": "wa-",
            "control windows alt shift": "cwas-",
            "hit": "",
        })
    extras = [
        IntegerRefST("nnavi10", 1, 11),
        IntegerRefST("nnavi3", 1, 4),
        IntegerRefST("nnavi50", 1, 50),
        IntegerRefST("nnavi500", 1, 500),
        Dictation("textnv"),
        Choice("enclosure", _dtpd),
        Choice("direction", {
            "dunce": "down",
            "sauce": "up",
            "lease": "left",
            "ross": "right",
        }),
        modifier_choice_object,
        Choice("button_dictionary_1", button_dictionary_1),
        Choice("button_dictionary_10", button_dictionary_10),
        Choice("button_dictionary_500", button_dictionary_500),
        Choice("combined_button_dictionary", combined_button_dictionary),
        Choice(
            "capitalization", {
                "yell": 1,
                "tie": 2,
                "gerrish": 3,
                "sing": 4,
                "laws": 5,
                "say": 6,
                "cop": 7,
                "slip": 8,
            }),
        Choice(
            "spacing", {
                "gum": 1,
                "gun": 1,
                "spine": 2,
                "snake": 3,
                "pebble": 4,
                "incline": 5,
                "dissent": 6,
                "descent": 6,
            }),
        Choice("semi", tell_commands_dict),
        Choice("word_limit", {
            "single": 1,
            "double": 2,
            "triple": 3,
            "Quadra": 4
        }),
        navigation_support.TARGET_CHOICE,
        navigation_support.get_direction_choice("mtn_dir"),
        Choice("mtn_mode", {
            "shin": "s",
            "queue": "cs",
            "fly": "c",
        }),
        Choice("extreme", {
            "Wally": "way",
        }),
        Choice("big", {
            "big": True,
        }),
        Choice("splatdir", {
            "lease": "backspace",
            "ross": "delete",
        }),
    ]

    defaults = {
        "nnavi500": 1,
        "nnavi50": 1,
        "nnavi10": 1,
        "nnavi3": 1,
        "textnv": "",
        "capitalization": 0,
        "spacing": 0,
        "mtn_mode": None,
        "mtn_dir": "right",
        "extreme": None,
        "big": False,
        "splatdir": "backspace",
        "modifier": "",
    }
示例#20
0
class ExcelRule(MappingRule):
    mapping = {
        "next sheet [<n>]":
            R(Key("c-pgdown"))*Repeat(extra='n'),
        "(prior | previous) sheet [<n>]":
            R(Key("c-pgup"))*Repeat(extra='n'),
        "[select] cell <column_1> <row_1>":
            R(Key("c-g") + Text("%(column_1)s%(row_1)s") + Key("enter")),
        "select <column_1> <row_1> through <column_2> <row_2>":
            R(Key("c-g") + Text("%(column_1)s%(row_1)s:%(column_2)s%(row_2)s") +
              Key("enter")),
        "go to cell":
            R(Key("c-g")),
        "select current column":
            R(Key("c-space")),
        "select current row":
            R(Key("s-space")),
        "top of column":
            R(Key("c-up")),
        "beginning of row":
            R(Key("c-left")),
        "insert stuff":
            R(Key("cs-plus")),
        "insert row":
            R(Key("cs-plus, a-r, enter")),
        "insert column":
            R(Key("cs-plus, a-c, enter")),
        "insert cell [to the] left":
            R(Key("cs-plus, a-i, enter")),
        "insert cell above":
            R(Key("cs-plus, a-d, enter")),
        "insert pivot table":
            R(Key("a-n, v")),
        "insert pivot chart":
            R(Key("a-n, s, z, c")),
        "add-ins":
            R(Key("a-t, i")),
        "add border":
            R(Key("cs-ampersand")),
        "arrange Windows":
            R(Key("a-w/10, a")),
        "auto sum":
            R(Key("a-equal")),
        "freeze panes":
            R(Key("a-w, f")),

        # From Mark Lillibridge regarding the edit cell command below:
        # There are at least two modes, edit (blue background) and enter (yellow background).
        # In enter mode for formulas, arrow keys select a
        # cell (range if shifted), whereas in edit mode, they move the cursor
        # inside the formula.  For non-formulas, in enter mode, the arrows
        # finished entering the current cell and move to another cell.
        #
        #  and "edit cell" initially switch to edit mode then
        # toggle thereafter for the given cell.  Typing initially puts you in
        # enter mode.
        #

        # edit cell: always edits directly in cell (blue background)

        #
        # this has the effect of pressing F2 without DNS around.
        #
        # Want "edit directly in cell" option turned off:
        #   Office button->advanced-> turn off allow editing directly in cells
        # (Dragon handles edit in cell directly badly)
        #
        # First time, edits current cell via formula bar.  Unlike with
        # editing directly in a cell, this highlights ranges and cells used.
        "toggle edit cell":
            R(Key("f2")),
    }
    extras = [
        Dictation("dict"),
        IntegerRefST("n", 1, 10),
        IntegerRefST("row_1", 1, 100),
        IntegerRefST("row_2", 1, 100),
        # change max to 3 if you want sequences of lentgh three and so on
        Repetition(Choice("alphabet1", alphabet_support.caster_alphabet()), min=1, max=2, name="column_1"),
        Repetition(Choice("alphabet2", alphabet_support.caster_alphabet()), min=1, max=2, name="column_2")
    ]
    defaults = {"n": 1, "dict": ""}
示例#21
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": "",
    }
示例#22
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": ""}
示例#23
0
class RainbowGridRule(MappingRule):

    mapping = {
        "[<pre>] <color> <n> [<action>]":
        R(Function(send_input)),
        "[<pre1>] <color1> <n1> select [<pre2>] <color2> <n2>":
        R(Function(send_input_select)),
        "[<pre1>] <color1> <n1> select <n2>":
        R(Function(send_input_select_short)),
        "squat":
        R(Function(store_first_point)),
        "bench":
        R(Function(select_text)),
        SymbolSpecs.CANCEL:
        R(Function(kill)),
    }
    extras = [
        IntegerRefST("pre", 0, 9),
        IntegerRefST("pre1", 0, 9),
        IntegerRefST("pre2", 0, 9),
        Choice(
            "color", {
                "(red | rot)": 0,
                "(orange | tan | brown | braun)": 1,
                "(yellow | gelb)": 2,
                "(green | gruen)": 3,
                "(blue | blau)": 4,
                "(purple | lila)": 5
            }),
        Choice(
            "color1", {
                "(red | rot)": 0,
                "(orange | tan | brown | braun)": 1,
                "(yellow | gelb)": 2,
                "(green | gruen)": 3,
                "(blue | blau)": 4,
                "(purple | lila)": 5
            }),
        Choice(
            "color2", {
                "(red | rot)": 0,
                "(orange | tan | brown | braun)": 1,
                "(yellow | gelb)": 2,
                "(green | gruen)": 3,
                "(blue | blau)": 4,
                "(purple | lila)": 5
            }),
        IntegerRefST("n", 0, 100),
        IntegerRefST("n1", 0, 100),
        IntegerRefST("n2", 0, 100),
        Choice("action", {
            "kick": 0,
            "psychic": 1,
            "move": 2,
        }),
        Choice("point", {
            "one": 1,
            "two": 2,
        }),
    ]
    defaults = {
        "pre": 0,
        "pre1": 0,
        "pre2": 0,
        "action": -1,
    }
示例#24
0
class OutlookRule(MappingRule):
    mapping = {
        # create new thing
        "new (appointment | event)":
        R(Key("sc-a")),
        "new contact":
        R(Key("cs-c")),
        "new folder":
        R(Key("cs-e")),
        "advanced (search| find)":
        R(Key("cs-f")),
        "new office document":
        R(Key("cs-h")),
        "(inbox | go to inbox)":
        R(Key("cs-i")),
        "new journal entry":
        R(Key("cs-j")),
        "new task":
        R(Key("cs-k")),
        "new contact group":
        R(Key("cs-l")),
        "(new message| new mail)":
        R(Key("cs-m")),
        "new note":
        R(Key("cs-n")),
        "open the new search folder window":
        R(Key("cs-p")),
        "new meeting request":
        R(Key("cs-q")),
        "new task request":
        R(Key("cs-u")),

        # new message window
        "to field":
        R(Key("a-dot")),
        "c c field":
        R(Key("a-c")),
        "subject [field]":
        R(Key("a-u")),
        "subject <text>":
        R(Key("a-u") + Function(capitalize) + Key("tab")),
        "attach file":
        R(Key("n, a, f")),
        "add to dictionary":
        R(Key("s-f10/2, a")),
        "click send message":
        R(Key("a-s")),  # be careful
        "find and replace":
        R(Key("c-h")),
        "check names":
        R(Key("c-k")),
        "spell check":
        R(Key("f7")),
        "save as":
        R(Key("f12")),  # only in mail view

        # folders pane
        "expand [that]":
        R(Key("asterisk")),
        "collapse [that]":
        R(Key("minus")),

        # folders navigation
        # some of these may be user dependent, depends on the order of your folders
        # which you can inspect by pressing control y
        # also I think some of these are built into Dragon
        "[go to] sent mail":
        R(Key("c-y/10, s, enter")),
        "go to drafts":
        R(Key("c-y/10, d, enter")),
        "go to trash":
        R(Key("c-y/10, t, enter")),
        "go to spam":
        R(Key("c-y/10, s:2, enter")),
        "go to starred":
        R(Key("c-y/10, s:3, enter")),
        "go to important":
        R(Key("c-y/10, i:2, enter")),
        "go to outbox":
        R(Key("cs-o")),

        # center pane
        "sort by [<sort_by>]":
        R(Key("a-v/5, a, b/5, %(sort_by)s")),
        "reverse sort":
        R(Key("a-v, r, s")),
        "block sender":
        R(Key("a-h/3, j/3, b")),
        "search [bar] [<dict>]":
        R(Key("c-e") + Text("%(dict)s")),
        "(message list | messages)":
        R(Key("tab:3")),
        "(empty | clear) search [bar]":
        R(Key("c-e, c-a, del/3, escape")),
        # from the search bar to get the focus into the messages is three tabs
        # pressing escape also seems to work.
        "refresh [mail]":
        R(Key("f9")),

        # reading pane
        "open attachment":
        R(Key("s-tab, enter")),
        "[open] attachment menu":
        R(Key("s-tab, right")),
        "next message [<n>]":
        R(Key("s-f6/10, down")) * Repeat(extra='n'),
        "(prior | previous) message [<n>]":
        R(Key("s-f6/20, up")) * Repeat(extra='n'),
        "[select] next link":
        R(Key("tab")),
        "[select] (previous | prior) link":
        R(Key("s-tab")),

        # calendar
        "workweek [view]":
        R(Key("ca-2")),
        "full week [view]":
        R(Key("ca-3")),
        "month view":
        R(Key("ca-4")),

        # message shortcuts
        "reply [<dict>]":
        R(Key("c-r") + Text("%(dict)s")),
        "reply all [<dict>]":
        R(Key("cs-r") + Text("%(dict)s")),
        "forward":
        R(Key("c-f")),
        "Mark as read":
        R(Key("c-q")),
        "Mark as unread":
        R(Key("c-u")),
        "(folder | go to folder)":
        R(Key("c-y")),

        # navigation
        "next pane [<n>]":
        R(Key("f6")) * Repeat(extra='n'),
        "(un|prior|previous) pane [<n>]":
        R(Key("s-f6")) * Repeat(extra='n'),
        "mail view":
        R(Key("c-1")),
        "calendar":
        R(Key("c-2")),
        "contacts":
        R(Key("c-3")),
        "tasks":
        R(Key("c-4")),
        "go to notes":
        R(Key("c-5")),
        "folder list":
        R(Key("c-6")),
        "find contact":
        R(Key("f11")),
        "address book":
        R(Key("cs-a")),
        "next open message":
        R(Key("c-dot")),
        "(prior | previous) open message":
        R(Key("c-comma")),
        "previous view":
        R(Key("a-left")),
        "next view":
        R(Key("a-right")),

        # misc
        "[go] back":
        R(Key("a-left")),
    }
    extras = [
        Dictation("dict"),
        Dictation("text"),
        IntegerRefST("n", 1, 100),
        Choice(
            "sort_by", {
                "date": "d",
                "from": "f",
                "to": "t",
                "size": "s",
                "subject": "j",
                "type": "t",
                "attachments": "c",
                "account": "o",
            }),
    ]
    defaults = {"n": 1, "dict": "", "text": "", "sort_by": ""}
示例#25
0
class Navigation(MergeRule):
    pronunciation = "navigation"

    mapping = {
        # "periodic" repeats whatever comes next at 1-second intervals until "terminate"
        # or "escape" (or your SymbolSpecs.CANCEL) is spoken or 100 tries occur
        "periodic":
        ContextSeeker(forward=[
            L(
                S(["cancel"], lambda: None),
                S(["*"],
                  lambda fnparams: UntilCancelled(
                      Mimic(*filter(lambda s: s != "periodic", fnparams)), 1).
                  execute(),
                  use_spoken=True))
        ]),
        # VoiceCoder-inspired -- these should be done at the IDE level
        "fill <target>":
        R(Key("escape, escape, end"), show=False) + AsynchronousAction(
            [L(S(["cancel"], Function(context.fill_within_line)))],
            time_in_seconds=0.2,
            repetitions=50),
        "jump in":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["right", "(~[~{~<"]))],
            time_in_seconds=0.1,
            repetitions=50),
        "jump out":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["right", ")~]~}~>"]))],
            time_in_seconds=0.1,
            repetitions=50),
        "jump back":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["left", "(~[~{~<"]))],
            time_in_seconds=0.1,
            repetitions=50),
        "jump back in":
        AsynchronousAction(
            [L(S(["cancel"], context.nav, ["left", "(~[~{~<"]))],
            finisher=Key("right"),
            time_in_seconds=0.1,
            repetitions=50),

        # keyboard shortcuts
        'save':
        R(Key("c-s"), rspec="save"),
        "shift click":
        R(Key("shift:down") + Mouse("left") + Key("shift:up")),
        "stoosh [<nnavi500>]":
        R(Function(navigation.stoosh_keep_clipboard), rspec="stoosh"),
        "cut [<nnavi500>]":
        R(Function(navigation.cut_keep_clipboard), rspec="cut"),
        "spark [<nnavi500>] [(<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)]]":
        R(Function(navigation.drop_keep_clipboard), rspec="spark"),
        "splat [<splatdir>] [<nnavi10>]":
        R(Key("c-%(splatdir)s"), rspec="splat") * Repeat(extra="nnavi10"),
        SymbolSpecs.CANCEL:
        R(Key("escape"), rspec="cancel"),
        "shackle":
        R(Key("home/5, s-end"), rspec="shackle"),
        "(tell | tau) <semi>":
        R(Function(navigation.next_line), rspec="tell dock"),
        "(hark | heart) <semi>":
        R(Function(navigation.previous_line), rspec="hark dock"),
        "duple [<nnavi50>]":
        R(Function(navigation.duple_keep_clipboard), rspec="duple"),
        "Kraken":
        R(Key("c-space"), rspec="Kraken"),
        "undo [<nnavi10>]":
        R(Key("c-z")) * Repeat(extra="nnavi10"),
        "redo [<nnavi10>]":
        R(
            ContextAction(
                default=Key("c-y") * Repeat(extra="nnavi10"),
                actions=[
                    (AppContext(executable=["rstudio", "foxitreader"]),
                     Key("cs-z") * Repeat(extra="nnavi10")),
                ])),

        # text formatting
        "set [<big>] format (<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)]":
        R(Function(textformat.set_text_format)),
        "clear castervoice [<big>] formatting":
        R(Function(textformat.clear_text_format)),
        "peek [<big>] format":
        R(Function(textformat.peek_text_format)),
        "(<capitalization> <spacing> | <capitalization> | <spacing>) [(bow|bowel)] <textnv> [brunt]":
        R(Function(textformat.master_format_text)),
        "[<big>] format <textnv>":
        R(Function(textformat.prior_text_format)),
        "<word_limit> [<big>] format <textnv>":
        R(Function(textformat.partial_format_text)),
        "hug <enclosure>":
        R(Function(text_utils.enclose_selected)),
        "dredge [<nnavi10>]":
        R(Key("alt:down, tab/20:%(nnavi10)d, alt:up"),
          rdescript="Core: switch to most recent Windows"),

        # Ccr Mouse Commands
        "kick [<nnavi3>]":
        R(Function(navigation.left_click)) * Repeat(extra="nnavi3"),
        "psychic":
        R(Function(navigation.right_click)),
        "(kick double|double kick)":
        R(Function(navigation.left_click) * Repeat(2)),
        "squat":
        R(Function(navigation.left_down)),
        "bench":
        R(Function(navigation.left_up)),

        # special keystroke commands
        "(lease wally | latch) [<nnavi10>]":
        R(Key("home:%(nnavi10)s")),
        "(ross wally | ratch) [<nnavi10>]":
        R(Key("end:%(nnavi10)s")),
        "sauce wally [<nnavi10>]":
        R(Key("c-home:%(nnavi10)s")),
        "dunce wally [<nnavi10>]":
        R(Key("c-end:%(nnavi10)s")),
        "bird [<nnavi500>]":
        R(Key("c-left:%(nnavi500)s")),
        "firch [<nnavi500>]":
        R(Key("c-right:%(nnavi500)s")),
        "brick [<nnavi500>]":
        R(Key("s-left:%(nnavi500)s")),
        "frick [<nnavi500>]":
        R(Key("s-right:%(nnavi500)s")),
        "blitch [<nnavi500>]":
        R(Key("cs-left:%(nnavi500)s")),
        "flitch [<nnavi500>]":
        R(Key("cs-right:%(nnavi500)s")),
        "<button_dictionary_500_no_prefix_no_modifier> [<nnavi500>]":
        R(Key("%(button_dictionary_500_no_prefix_no_modifier)s") *
          Repeat(extra='nnavi500'),
          rdescript=
          "press buttons from button_dictionary_500_no_prefix_no_modifier"),
        "<modifier> <button_dictionary_500_modifier> [<nnavi500>]":
        R(Key("%(modifier)s%(button_dictionary_500_modifier)s") *
          Repeat(extra='nnavi500'),
          rdescript=
          "press modifiers plus buttons from button_dictionary_500_modifier"),
        "<modifier> <button_dictionary_1_modifier>":
        R(Key("%(modifier)s%(button_dictionary_1_modifier)s"),
          rdescript=
          "press modifiers plus buttons from button_dictionary_1_modifier"),
    }

    tell_commands_dict = {
        "dock": ";",
        "doc": ";",
        "sink": "",
        "com": ",",
        "deck": ":"
    }
    tell_commands_dict.update(_tpd)
    button_dictionary_500_no_prefix_no_modifier = {
        "tabby": "tab",
        "clear": "backspace",
        "deli": "del",
        "shock": "enter",
        "lease": "left",
        "ross": "right",
        "sauce": "up",
        "dunce": "down",
        "page (down | dunce)": "pgdown",
        "page (up | sauce)": "pgup",
    }
    button_dictionary_500_modifier = {
        key: value
        for key, value in Keyboard.button_dictionary_1.items() if value in [
            "backspace", "del", "enter", "left", "right", "up", "down",
            "pgdown", "pgup"
        ]
    }
    button_dictionary_1_modifier = {
        key: value
        for key, value in Keyboard.button_dictionary_1.items()
        if value in ["home", "end"]
    }
    extras = [
        IntegerRefST("nnavi10", 1, 11),
        IntegerRefST("nnavi3", 1, 4),
        IntegerRefST("nnavi50", 1, 50),
        IntegerRefST("nnavi500", 1, 500),
        Dictation("textnv"),
        Choice("enclosure", _dtpd),
        Choice(
            "capitalization", {
                "yell": 1,
                "tie": 2,
                "gerrish": 3,
                "sing": 4,
                "laws": 5,
                "say": 6,
                "cop": 7,
                "slip": 8,
            }),
        Choice(
            "spacing", {
                "gum": 1,
                "gun": 1,
                "spine": 2,
                "snake": 3,
                "pebble": 4,
                "incline": 5,
                "dissent": 6,
                "descent": 6,
            }),
        Choice("semi", tell_commands_dict),
        Choice("word_limit", {
            "single": 1,
            "double": 2,
            "triple": 3,
            "Quadra": 4
        }), navigation_support.TARGET_CHOICE,
        Choice("extreme", {
            "Wally": "way",
        }),
        Choice("big", {
            "big": True,
        }),
        Choice("splatdir", {
            "lease": "backspace",
            "ross": "delete",
        }), Keyboard.modifier_choice_object,
        Choice("button_dictionary_500_no_prefix_no_modifier",
               button_dictionary_500_no_prefix_no_modifier),
        Choice("button_dictionary_500_modifier",
               button_dictionary_500_modifier),
        Choice("button_dictionary_1_modifier", button_dictionary_1_modifier)
    ]

    defaults = {
        "nnavi500": 1,
        "nnavi50": 1,
        "nnavi10": 1,
        "nnavi3": 1,
        "textnv": "",
        "capitalization": 0,
        "spacing": 0,
        "extreme": None,
        "big": False,
        "splatdir": "backspace",
    }
示例#26
0
class VSCodeCcrRule(MergeRule):
    pronunciation = "visual studio code ccr"

    mapping = {
        # Note: If you get the bad grammar grammar too complex error, move some of these commands into the non-CCR rule
        # cursor/line navigation
        "scroll up [<n>]":
        R(Key("c-up") * Repeat(extra='n'),
          rdescript="VS Code: Scroll Up One Line at a Time"),
        "scroll down [<n>]":
        R(Key("c-down") * Repeat(extra='n'),
          rdescript="VS Code: Scroll Down One Line at a Time"),
        "scroll page up [<n>]":
        R(Key("a-pgup") * Repeat(extra='n'),
          rdescript="VS Code: Scroll Up One Page Up at a Time"),
        "scroll page down [<n>]":
        R(Key("a-pgdown") * Repeat(extra='n'),
          rdescript="VS Code: Scroll Down One Page Down At a Time"),
        "(unindent|out dent) [<n>]":
        R(Key("home, s-tab:%(n)s"), rdescript="VS Code: Unindent"),
        "comment [line]":
        R(Key("c-slash"), rdescript="VS Code: Line Comment"),
        "block comment":
        R(Key("sa-a"), rdescript="VS Code: Block Comment"),
        # Multi-cursor and selection
        "cursor above [<n>]":
        R(Key("ca-up") * Repeat(extra='n'),
          rdescript="VS Code: Insert Cursor Above"),
        "cursor below [<n>]":
        R(Key("ca-down") * Repeat(extra='n'),
          rdescript="VS Code: Insert Cursor Above"),
        "remove cursor":
        R(Key("csa-down"), rdescript="VS Code: Remove Cursor"
          ),  # not sure if this command works always; also try csa-up
        # csa-down/up seems to work sometimes to remove 1 of the cursors
        # but I don't really understand how this works
        "tall cursor up":
        R(Key("csa-pgup"), rdescript="VS Code: Add Cursors All The Way Up"),
        "tall cursor down":
        R(Key("csa-pgdown"),
          rdescript="VS Code: Add Cursors All The Way Down"),
        "expand  [<n>]":
        R(Key("sa-right"), rdescript="highlight current word(s)") *
        Repeat(extra='n'),
        "shrink  [<n>]":
        R(Key("sa-left"),
          rdescript="shrink the previous highlighting range or unhighlight") *
        Repeat(extra='n'),

        # Command below requires "brackets select" extension for VS code
        "select [in] brackets [<n>]":
        R(Key("ca-a") * Repeat(extra='n'),
          rdescript=
          "VS Code: Select in between parable punctuation inclusive using 'brackets select' extension"
          ) * Repeat(extra='n'),
        "all current selection":
        R(Key("c-l"),
          rdescript="VS Code: Select All Occurrences of Current Selection"),
        "all current word":
        R(Key("c-f2"),
          rdescript="VS Code: Select All Occurrences of Current Word"),
        "select next [<n>]":
        R(Key("c-f3") * Repeat(extra='n'),
          rdescript="VS Code: Select Next Occurrence of Current Word"),
        "go to next [<n>]":
        R(Key("sa-right/2, c-f3, c-left/2, escape") * Repeat(extra='n'),
          rdescript="VS Code: Go to Next Occurrence of Current Word"),
        # may or may not want the escape afterwards to close the find box
        # note the above command might sometimes be off by one so you have to say one higher
        # than what you mean e.g. if the cursor is at the beginning of the word rather
        # than in the middle or end, you will have to say "next word two" to get to the next word
        "select prior [<n>]":
        R(Key("cs-f3"),
          rdescript="VS Code: Select Prior Occurrence of Current Word"),
        "go to prior [<n>]":
        R(Key("sa-right/2, cs-f3, c-left/2, escape") * Repeat(extra='n'),
          rdescript="VS Code: Go to Prior Occurrence of Current Word"),
        # may or may not want the escape afterwards to close the find box
        "cursor all":
        R(Key("cs-l"),
          rdescript=
          "VS Code: Add Cursor to All Occurrences of Current Selection"),
        "next cursor [<n>]":
        R(Key("c-d") * Repeat(extra='n'),
          rdescript=
          "VS Code: Add Cursor to Next Occurrence of Current Selection"),
        "indent [<n>]":
        R(Key("home, tab:%(n)s"), rdescript="VS Code: Indent"),
        "hard delete [<n>]":
        R(Key("s-del"),
          rdescript="VS Code: Eliminates Line not Just the Text on it"),
        "copy line up [<n>]":
        R(Key("sa-up") * Repeat(extra='n'),
          rdescript="VS Code: Duplicate Line Above"),
        "copy line down [<n>]":
        R(Key("sa-down") * Repeat(extra='n'),
          rdescript="VS Code: Duplicate Line Below"),
        "switch line down [<n>]":
        R(Key("a-down") * Repeat(extra='n'),
          rdescript="VS Code: Switch Line With the One Below it"),
        "switch line up [<n>]":
        R(Key("a-up") * Repeat(extra='n'),
          rdescript="VS Code: Switch Line With the One Above it"),
        "match bracket":
        R(Key("cs-backslash"), rdescript="VS Code: Jump to Matching Bracket"),

        # commands for selecting between parable characters using "quick and simple text selection" VScode extension (required)
        # repetition of these commands by saying the number expands the selection to include the text between the next (i.e. outer) set of parable characters of the given type
        "select between <between_parables> [<n>]":
        R(Key("c-k, %(between_parables)s") * Repeat(extra='n'),
          rdescript=
          "VS Code: Select between parentheses noninclusive using 'quick and simple text selection' VScode extension"
          ),
        "select around <around_parables> [<n>]":
        R(Key("c-k, %(around_parables)s") * Repeat(extra='n'),
          rdescript=
          "VS Code: Select between parentheses inclusive using 'quick and simple text selection' VScode extension"
          ),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("n", 1, 100),
        IntegerRefST("m", 1, 10),
        Choice(
            "between_parables", {
                "prekris": "lparen",
                "brax": "lbracket",
                "curly": "lbrace",
                "angle": "langle",
                "single": "squote",
                "quote": "dquote",
            }),
        Choice(
            "around_parables", {
                "prekris": "rparen",
                "brax": "rbracket",
                "curly": "rbrace",
                "angle": "rangle",
            }),
    ]

    defaults = {"n": 1, "mim": "", "text": ""}
示例#27
0
class CSS(MergeRule):
    pronunciation = "css"

    mapping = {
        #Macros
        "selector":
            R(Text("{}") + Key("left/10:1") + Key("enter")),
        "property":
            R(Text(":;") + Key("left/10:1")),
        #Measurements
        "<ln1> pixel | <ln1> PX":
            R(Text("%(ln1)spx")),
        "<ln1> percentage | <ln1> percent":
            R(Text("%(ln1)s") + Key("s-5")),
        "<ln1> centimeter | <ln1> CM":
            R(Text("%(ln1)scm")),
        "<ln1> inch | <ln1> IN":
            R(Text("%(ln1)sin")),
        "<ln1> millimeter | <ln1> MM":
            R(Text("%(ln1)smm")),
        "<ln1> pica | <ln1> PC":
            R(Text("%(ln1)spc")),
        "<ln1> point | <ln1> PT":
            R(Text("%(ln1)spt")),
        "<ln1> CH":
            R(Text("%(ln1)sch")),
        "<ln1> EM":
            R(Text("%(ln1)sem")),
        "<ln1> EX":
            R(Text("%(ln1)sex")),
        "<ln1> REM":
            R(Text("%(ln1)srem")),
        "<ln1> viewport height | <ln1> VH":
            R(Text("%(ln1)svh")),
        "<ln1> viewport width | <ln1> VW":
            R(Text("%(ln1)svw")),
        "<ln1> millisecond | <ln1> MS":
            R(Text("%(ln1)sms")),
        "<ln1> second | <ln1> S":
            R(Text("%(ln1)ss")),
        #background
        "background image":
            R(Text("background-image:;") + Key("left/10:1")),
        "background position":
            R(Text("background-position:;") + Key("left/10:1")),
        "background size":
            R(Text("background-size:;") + Key("left/10:1")),
        "background repeat":
            R(Text("background-repeat:;") + Key("left/10:1")),
        "background attachment":
            R(Text("background-attachment:;") + Key("left/10:1")),
        "background origin":
            R(Text("background-origin:;") + Key("left/10:1")),
        "background clip":
            R(Text("background-clip:;") + Key("left/10:1")),
        "background color":
            R(Text("background-color:;") + Key("left/10:1")),
        "background attachment":
            R(Text("background-attachment:;") + Key("left/10:1")),
        "background origin":
            R(Text("background-origin:;") + Key("left/10:1")),
        "background clip":
            R(Text("background-clip:;") + Key("left/10:1")),
        #border
        "border":
            R(Text("border:;") + Key("left/10:1")),
        "border top":
            R(Text("border-top:;") + Key("left/10:1")),
        "border bottom":
            R(Text("border-bottom:;") + Key("left/10:1")),
        "border left":
            R(Text("border-left:;") + Key("left/10:1")),
        "border right":
            R(Text("border-right:;") + Key("left/10:1")),
        "border width":
            R(Text("border-width:;") + Key("left/10:1")),
        "border style":
            R(Text("border-style:;") + Key("left/10:1")),
        "border color":
            R(Text("border-color:;") + Key("left/10:1")),
        "border break":
            R(Text("border-break:;") + Key("left/10:1")),
        "border image":
            R(Text("border-image:;") + Key("left/10:1")),
        "border radius":
            R(Text("border-radius:;") + Key("left/10:1")),
        #box model
        "box shadow":
            R(Text("box-shadow:;") + Key("left/10:1")),
        "border-box":
            R(Text("border-box")),
        "height":
            R(Text("height:;") + Key("left/10:1")),
        "width":
            R(Text("width:;") + Key("left/10:1")),
        "min height":
            R(Text("min-height:;") + Key("left/10:1")),
        "max height":
            R(Text("max-height:;") + Key("left/10:1")),
        "min width":
            R(Text("min-width:;") + Key("left/10:1")),
        "max width":
            R(Text("max-width:;") + Key("left/10:1")),
        "padding box":
            R(Text("padding-box")),
        "content box":
            R(Text("content-box")),
        "margin":
            R(Text("margin:;") + Key("left/10:1")),
        "margin top":
            R(Text("margin-top:;") + Key("left/10:1")),
        "margin bottom":
            R(Text("margin-bottom:;") + Key("left/10:1")),
        "margin left":
            R(Text("margin-left:;") + Key("left/10:1")),
        "margin right":
            R(Text("margin-right:;") + Key("left/10:1")),
        "padding":
            R(Text("padding:;") + Key("left/10:1")),
        "padding top":
            R(Text("padding-top:;") + Key("left/10:1")),
        "padding bottom":
            R(Text("padding-bottom:;") + Key("left/10:1")),
        "padding left":
            R(Text("padding-left:;") + Key("left/10:1")),
        "padding right":
            R(Text("padding-right:;") + Key("left/10:1")),
        "display":
            R(Text("display:;") + Key("left/10:1")),
        "overflow":
            R(Text("overflow:;") + Key("left/10:1")),
        "overflow y":
            R(Text("overflow-y:;") + Key("left/10:1")),
        "overflow x":
            R(Text("overflow-x:;") + Key("left/10:1")),
        "overflow style":
            R(Text("overflow-style:;") + Key("left/10:1")),
        "visibility":
            R(Text("visibility:;") + Key("left/10:1")),
        "clear":
            R(Text("clear:;") + Key("left/10:1")),
        #Font
        "font":
            R(Text("font:;") + Key("left/10:1")),
        "font style":
            R(Text("font-style:;") + Key("left/10:1")),
        "font variant":
            R(Text("font-variant:;") + Key("left/10:1")),
        "font weight":
            R(Text("font-weight:;") + Key("left/10:1")),
        "font size":
            R(Text("font-size:;") + Key("left/10:1")),
        "font family":
            R(Text("font-family:;") + Key("left/10:1")),
        #text
        "direction":
            R(Text("direction:;") + Key("left/10:1")),
        "hanging punctuation":
            R(Text("hanging-punctuation:;") + Key("left/10:1")),
        "letter spacing":
            R(Text("letter-spacing:;") + Key("left/10:1")),
        "text outline":
            R(Text("text-outline:;") + Key("left/10:1")),
        "unicode bidi":
            R(Text("unicode-bidi:;") + Key("left/10:1")),
        "white space":
            R(Text("white-space:;") + Key("left/10:1")),
        "white space collapse":
            R(Text("white-space-collapse:;") + Key("left/10:1")),
        "punctuation trim":
            R(Text("punctuation-trim:;") + Key("left/10:1")),
        "text align":
            R(Text("text-align:;") + Key("left/10:1")),
        "text align last":
            R(Text("text-align-last:;") + Key("left/10:1")),
        "text decoration":
            R(Text("text-decoration:;") + Key("left/10:1")),
        "text shadow":
            R(Text("text-shadow:;") + Key("left/10:1")),
        "word break":
            R(Text("word-break:;") + Key("left/10:1")),
        "word wrap":
            R(Text("word-wrap:;") + Key("left/10:1")),
        "text emphasis":
            R(Text("text-emphasis:;") + Key("left/10:1")),
        "text indent":
            R(Text("text-indent:;") + Key("left/10:1")),
        "text justify":
            R(Text("text-justify:;") + Key("left/10:1")),
        "text transform":
            R(Text("text-transform:;") + Key("left/10:1")),
        "text wrap":
            R(Text("text-wrap:;") + Key("left/10:1")),
        "word spacing":
            R(Text("word-spacing:;") + Key("left/10:1")),
        #column
        "column count":
            R(Text("column-count:;") + Key("left/10:1")),
        "column fill":
            R(Text("column-fill:;") + Key("left/10:1")),
        "column gap":
            R(Text("column-gap:;") + Key("left/10:1")),
        "column rule":
            R(Text("column-rule:;") + Key("left/10:1")),
        "column rule style":
            R(Text("column-rule-style:;") + Key("left/10:1")),
        "column":
            R(Text("column:;") + Key("left/10:1")),
        "column rule width":
            R(Text("column-rule-width:;") + Key("left/10:1")),
        "column span":
            R(Text("column-span:;") + Key("left/10:1")),
        "column width":
            R(Text("column-width:;") + Key("left/10:1")),
        #colors
        "color":
            R(Text("color:;") + Key("left/10:1")),
        "opacity":
            R(Text("opacity:;") + Key("left/10:1")),
        #table
        "border collapse":
            R(Text("border-collapse:;") + Key("left/10:1")),
        "empty cells":
            R(Text("empty-cells:;") + Key("left/10:1")),
        "border spacing":
            R(Text("border-spacing:;") + Key("left/10:1")),
        "table layout":
            R(Text("table-layout:;") + Key("left/10:1")),
        "caption side":
            R(Text("caption-side:;") + Key("left/10:1")),
        #List & Markers
        "list style":
            R(Text("list-style:;") + Key("left/10:1")),
        "list style type":
            R(Text("list-style-type:;") + Key("left/10:1")),
        "list style position":
            R(Text("list-style-position:;") + Key("left/10:1")),
        "list style image":
            R(Text("list-style-image:;") + Key("left/10:1")),
        "marker offset":
            R(Text("marker-offset:;") + Key("left/10:1")),
        #Animations
        "animations":
            R(Text("animations:;") + Key("left/10:1")),
        "animation name":
            R(Text("animation-name:;") + Key("left/10:1")),
        "animation duration":
            R(Text("animation-duration:;") + Key("left/10:1")),
        "animation timing function":
            R(Text("animation-timing-function:;") + Key("left/10:1")),
        "animation delay":
            R(Text("animation-delay:;") + Key("left/10:1")),
        "animation iteration count":
            R(Text("animation-iteration-count:;") + Key("left/10:1")),
        "animation direction":
            R(Text("animation-direction:;") + Key("left/10:1")),
        "animation play state":
            R(Text("animation-play-state:;") + Key("left/10:1")),
        #Transitions
        "transitions":
            R(Text("transitions:;") + Key("left/10:1")),
        "transitions property":
            R(Text("transitions-property:;") + Key("left/10:1")),
        "transitions duration":
            R(Text("transitions-duration:;") + Key("left/10:1")),
        "transitions timing function":
            R(Text("transitions-timing-function:;") + Key("left/10:1")),
        "transitions delay":
            R(Text("transitions-delay:;") + Key("left/10:1")),
        "transitions property":
            R(Text("transitions-property:;") + Key("left/10:1")),
        #UI
        "webkit appearance | appearance":
            R(Text("-webkit-appearance:;") + Key("left/10:1")),
        "cursor":
            R(Text("cursor:;") + Key("left/10:1")),
        "resize":
            R(Text("resize:;") + Key("left/10:1")),
        #Pseudo-Class
        "active":
            R(Text(":active")),
        "focus":
            R(Text(":focus")),
        "hover":
            R(Text(":hover")),
        "link":
            R(Text(":link")),
        "disabled":
            R(Text(":disabled")),
        "enabled":
            R(Text(":enabled")),
        "checked":
            R(Text(":checked")),
        "selection":
            R(Text(":selection")),
        "lang":
            R(Text(":lang")),
        "nth child":
            R(Text(":nth-child()") + Key("left/10:1")),
        "nth last child":
            R(Text(":nth-last-child()") + Key("left/10:1")),
        "first child":
            R(Text(":first-child")),
        "last child":
            R(Text(":last-child")),
        "only-child":
            R(Text(":only-child")),
        "nth of type":
            R(Text(":nth-of-type()") + Key("left/10:1")),
        "nth last of type ":
            R(Text(":nth-last-of-type() ") + Key("left/10:1")),
        "last of type":
            R(Text(":last-of-type")),
        "first of type":
            R(Text(":first-of-type")),
        "only of type":
            R(Text(":only-of-type")),
        "empty":
            R(Text(":empty")),
        "root":
            R(Text(":root")),
        "not":
            R(Text(":not()") + Key("left/10:1")),
        "target":
            R(Text(":target")),
        "first letter":
            R(Text("::first-letter")),
        "first line":
            R(Text("::first-line")),
        "before":
            R(Text("::before")),
        "after":
            R(Text("::after")),
        #Outline
        "outline":
            R(Text("outline:;") + Key("left/10:1")),
        "outline color":
            R(Text("outline-color:;") + Key("left/10:1")),
        "outline style":
            R(Text("outline-style:;") + Key("left/10:1")),
        "outline width":
            R(Text("outline-width:;") + Key("left/10:1")),
        "outline offset":
            R(Text("outline-offset:;") + Key("left/10:1")),
        #transform
        "backface visibility":
            R(Text("backface-visibility:;") + Key("left/10:1")),
        "perspective":
            R(Text("perspective:;") + Key("left/10:1")),
        "perspective origin":
            R(Text("perspective-origin:;") + Key("left/10:1")),
        "transform":
            R(Text("transform:;") + Key("left/10:1")),
        "transform style":
            R(Text("transform-style:;") + Key("left/10:1")),
        #Positioning
        "position":
            R(Text("position:;") + Key("left/10:1")),
        "clip":
            R(Text("clip:;") + Key("left/10:1")),
        "z index":
            R(Text("z-index:;") + Key("left/10:1")),
        #flex
        "flex direction":
            R(Text("flex-direction:;") + Key("left/10:1")),
        "flex wrap":
            R(Text("flex-wrap:;") + Key("left/10:1")),
        "align items":
            R(Text("align-items:;") + Key("left/10:1")),
        "justify content":
            R(Text("justify-content:;") + Key("left/10:1")),
        "flex grow":
            R(Text("flex-grow:;") + Key("left/10:1")),
        "align self":
            R(Text("align-self:;") + Key("left/10:1")),
        "flex shrink":
            R(Text("flex-shrink:;") + Key("left/10:1")),
        "flex basis":
            R(Text("flex-basis:;") + Key("left/10:1")),
        "order":
            R(Text("order:;") + Key("left/10:1")),


        #values
        "url":
            R(Text("url()") + Key("left/10:1")),
        "rgb":
            R(Text("rgb(,,)") + Key("left/10:3")),
        "rgba":
            R(Text("rgba(,,,)") + Key("left/10:4")),
        

    }
    extras = [
        IntegerRefST("ln1", 1, 1000),
    ]
    defaults = {}
示例#28
0
class WebexTeamsRule(MappingRule):
    # See https://help.webex.com/en-us/7wr87q/Keyboard-Navigation-and-Shortcuts-for-Cisco-Webex-Teams
    mapping = {
        # Navigation - Primary
        "show spaces":
        R(Key("c-1")),
        "show teams":
        R(Key("c-2")),
        "show calls":
        R(Key("c-3")),
        "show meetings":
        R(Key("c-4")),
        "help":
        R(Key("f1")),
        "create space":
        R(Key("cs-n")),
        "contact person [<person>]":
        R(Key("c-n") + Text("%(person)s")),
        "(search | find)":
        R(Key("c-f")),

        # Navigation - Primary - Filtering
        # There does not appear to be a hotkey to reset filters at this time
        #"show all":
        #    R(Key("sa-?")),
        "show drafts":
        R(Key("sa-d")),
        "show favorites":
        R(Key("cs-u")),
        "show flags":
        R(Key("sa-f")),
        "show mentions all":
        R(Key("cs-l")),
        "show mentions me":
        R(Key("cs-o")),
        "show notifications":
        R(Key("sa-n")),
        "show unread":
        R(Key("sa-r")),

        # Navigation - Space
        # Note - A number of space navigation items do not have documented hotkeys
        "add (person | people) [<person>]":
        R(Key("cs-p") + Text("%(person)s")),
        "create whiteboard":
        R(Key("cs-b")),
        "show whiteboards":
        R(Key("cs-w")),
        "leave space":
        R(Key("cs-e")),
        "(search | find) space":
        R(Key("cs-j")),

        # Navigation - Extra
        "previous (space | item) [<nnavi10>]":
        R(Key("a-up")) * Repeat(extra="nnavi10"),
        "next (space | item) [<nnavi10>]":
        R(Key("a-down")) * Repeat(extra="nnavi10"),

        # Messaging
        "attach":
        R(Key("c-o")),
        "emoji":
        R(Key("w-.")),
        "gif | jeff":
        R(Key("c-g")),
        "toggle markdown":
        R(Key("c-m")),
        "new-line":
        R(Key("s-enter")),
        "personal meeting link":
        R(Key("sa-p")),
        "send":
        R(Key("enter")),

        # Formatting - Non-markdown
        "strong | bold":
        R(Key("c-b")),
        "emphasis | italicize":
        R(Key("c-i")),
        "underline":
        R(Key("c-u")),
        "(number | numbered) list":
        R(Key("sa-o")),
        "(bullet | bulletted) list":
        R(Key("sa-u")),
        "heading one":
        R(Key("sa-1")),
        "heading two":
        R(Key("sa-2")),
        "heading three":
        R(Key("sa-3")),

        # Formatting - markdown
        # Use "markdown" rule
    }
    exported = True
    extras = [
        IntegerRefST("nnavi10", 1, 11),
        Dictation("person"),
    ]
    defaults = {
        "nnavi10": 1,
        "person": "",
    }
示例#29
0
class TextManipulation(MergeRule):
    pronunciation = "text manipulation"

    mapping = {

        # PROBLEM: sometimes Dragon thinks the variables are part of dictation.

        # replace text or character
        "replace <direction> [<number_of_lines_to_search>] [<occurrence_number>] <dictation> with <dictation2>":
        R(Function(
            text_manipulation_support.copypaste_replace_phrase_with_phrase,
            dict(dictation="replaced_phrase", dictation2="replacement_phrase"),
            dictation_versus_character="dictation"),
          rdescript=
          "Text Manipulation: replace text to the left or right of the cursor"
          ),
        "replace <direction>  [<number_of_lines_to_search>] [<occurrence_number>] <character> with <character2>":
        R(Function(
            text_manipulation_support.copypaste_replace_phrase_with_phrase,
            dict(character="replaced_phrase", character2="replacement_phrase"),
            dictation_versus_character="character"),
          rdescript=
          "Text Manipulation: replace character to the left of the cursor"),

        # remove text or character
        "remove <direction> [<number_of_lines_to_search>] [<occurrence_number>] <dictation>":
        R(Function(text_manipulation_support.copypaste_remove_phrase_from_text,
                   dict(dictation="phrase"),
                   dictation_versus_character="dictation"),
          rdescript=
          "Text Manipulation: remove chosen phrase to the left or right of the cursor"
          ),
        "remove <direction> [<number_of_lines_to_search>] [<occurrence_number>] <character>":
        R(Function(text_manipulation_support.copypaste_remove_phrase_from_text,
                   dict(character="phrase"),
                   dictation_versus_character="character"),
          rdescript=
          "Text Manipulation: remove chosen character to the left of the cursor"
          ),

        # remove until text or character
        "remove <direction> [<number_of_lines_to_search>] until [<before_after>] [<occurrence_number>] <dictation>":
        R(Function(text_manipulation_support.copypaste_delete_until_phrase,
                   dict(dictation="phrase"),
                   dictation_versus_character="dictation"),
          rdescript="Text Manipulation: delete until chosen phrase"),
        "remove <direction> [<number_of_lines_to_search>] until [<before_after>] [<occurrence_number>] <character>":
        R(Function(text_manipulation_support.copypaste_delete_until_phrase,
                   dict(character="phrase"),
                   dictation_versus_character="character"),
          rdescript="Text Manipulation: delete until chosen character"),

        # move cursor
        "(go | move) <direction> [<number_of_lines_to_search>] [<before_after>] [<occurrence_number>] <dictation>":
        R(Function(text_manipulation_support.move_until_phrase,
                   dict(dictation="phrase"),
                   dictation_versus_character="dictation"),
          rdescript=
          "Text Manipulation: move to chosen phrase to the left or right of the cursor"
          ),
        "(go | move) <direction> [<number_of_lines_to_search>] [<before_after>] [<occurrence_number>] <character_sequence> [over]":
        Function(
            lambda direction, before_after, number_of_lines_to_search,
            occurrence_number, character_sequence:
            text_manipulation_support.move_until_phrase(
                direction, before_after, "".join(character_sequence),
                number_of_lines_to_search, occurrence_number, "character")),

        # select text or character
        "grab <direction> [<number_of_lines_to_search>] [<occurrence_number>] <dictation>":
        R(Function(text_manipulation_support.select_phrase,
                   dict(dictation="phrase"),
                   dictation_versus_character="dictation"),
          rdescript="Text Manipulation: select chosen phrase"),
        "grab <direction> [<number_of_lines_to_search>] [<occurrence_number>] <character>":
        R(Function(
            text_manipulation_support.select_phrase,
            dict(character="phrase", dictation_versus_character="character")),
          rdescript="Text Manipulation: select chosen character"),

        # select until text or character
        "grab <direction> [<number_of_lines_to_search>] until [<before_after>] [<occurrence_number>] <dictation> ":
        R(Function(text_manipulation_support.select_until_phrase,
                   dict(dictation="phrase"),
                   dictation_versus_character="dictation"),
          rdescript="Text Manipulation: select until chosen phrase"),
        "grab <direction> [<number_of_lines_to_search>] until [<before_after>] [<occurrence_number>] <character>":
        R(Function(text_manipulation_support.select_until_phrase,
                   dict(character="phrase"),
                   dictation_versus_character="character"),
          rdescript="Text Manipulation: select until chosen character"),

        # capitalized 1st word of text or character
        "capital <direction> [<number_of_lines_to_search>] [<occurrence_number>] [<letter_size>] <dictation>":
        R(Function(
            text_manipulation_support.copypaste_change_phrase_capitalization,
            dict(dictation="phrase"),
            dictation_versus_character="dictation"),
          rdescript="Text Manipulation: change capitalization phrase"),
        "capital <direction> [<number_of_lines_to_search>] [<occurrence_number>] [<letter_size>] <character>":
        R(Function(
            text_manipulation_support.copypaste_change_phrase_capitalization,
            dict(character="phrase"),
            dictation_versus_character="character"),
          rdescript="Text Manipulation: change capitalization character"),
    }
    new_text_punc_dict = text_punc_dict()
    new_text_punc_dict.update(alphabet_support.caster_alphabet())
    new_text_punc_dict.update(number_dict)
    character_dict = new_text_punc_dict
    character_choice_object = Choice("character_choice", character_dict)

    extras = [
        Repetition(character_choice_object,
                   min=1,
                   max=3,
                   name="character_sequence"),
        Dictation("dict"),
        Dictation("dictation"),
        Dictation("dictation2"),
        Dictation("text"),
        IntegerRefST("n", 1, 100),
        IntegerRefST("m", 1, 100),
        IntegerRefST("wait_time", 1, 1000),
        IntegerRefST("number_of_lines_to_search", 1, 50),
        Choice("character", character_dict),
        Choice("character2", character_dict),
        Choice("single_character", character_dict),
        Choice(
            "direction",
            {
                "lease": "left",
                "ross": "right",
                "sauce": "up",
                "dunce": "down",
                # note: "sauce" (i.e. "up") will be treated the same as "lease" (i.e. "left") except that
                # the default number_of_lines_to_search will be set to 3
                # in the same way, "dunce" (i.e. "down") will be treated the same as
                # "ross" (i.e. "right")
            }),
        Choice("before_after", {
            "before": "before",
            "after": "after",
        }),
        Choice(
            "letter_size", {
                "upper": "upper",
                "upward": "upper",
                "lower": "lower",
                "lowered": "lower",
            }),
        Choice(
            "occurrence_number", {
                "first": 1,
                "second": 2,
                "third": 3,
                "fourth": 4,
                "fifth": 5,
                "sixth": 6,
                "seventh": 7,
                "eighth": 8,
                "ninth": 9,
                "tenth": 10,
            }),
    ]
    defaults = {
        "before_after": None,
        "letter_size": "upper",
        "number_of_lines_to_search":
        0,  # before changing this default, please read the function deal_with_up_down_directions
        "occurrence_number": 1,
    }  # if direction is up or down, the default number_of_lines_to_search
示例#30
0
    #"remax":                       Key("a-space/10,r/10,a-space/10,x"),

    #"(show | open) documentation": BringApp('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe') + WaitWindow(executable="chrome.exe") + Key('c-t') + WaitWindow(title="New Tab") + Text('https://dragonfly2.readthedocs.io/en/latest') + Key('enter'),

    'reload taskbar': Function(reload),

    #"i choose <choice>":           Text("%(choice)s"),

    }
    mapping.update(info())




extras = [
    IntegerRefST("nnavi500", 1, 500),
    Dictation("textnv"),

    Choice("capitalization", {
        "capitalize": 1,  # THISISATEST
        "camelcaps": 2,  # ThisIsATest
        "camelcase": 3,  # thisIsATest
        # "caps": 4,
        "laws": 5,  # thisisatest
        "dragon say": 6,  # this is a test
        "single caps": 7,  # This is a test
        "(dragon slip|lowercase)": 8,  # this is a test
        "spongebob": 9,  # this is a test
    }),
]