Esempio n. 1
0
class NPPRule(MappingRule):

    mapping = {
        "stylize <n2>":
        R(
            Mouse("right") + Key("down:6/5, right") +
            (Key("down") * Repeat(extra="n2")) + Key("enter")),
        "remove style":
        R(Mouse("right") + Key("down:6/5, right/5, down:5/5, enter")),
        "preview in browser":
        R(Key("cas-r")),

        # requires function list plug-in:
        "function list":
        R(Key("cas-l")),
        "open":
        R(Key("c-o")),
        "go [to] line <n>":
        R(Key("c-g/10") + Text("%(n)s") + Key("enter")),
    }
    extras = [
        Dictation("text"),
        ShortIntegerRef("n", 1, 1000),
        ShortIntegerRef("n2", 1, 10),
    ]
    defaults = {"n": 1}
Esempio n. 2
0
class HardwareRule(MappingRule):
    mapping = {
        # Windows 10 changes volume by increments 2
        "volume <volume_mode> [<n_volume>]":
        R(Key("%(volume_mode)s") * Repeat(extra="n_volume")),
        "media <multimedia_control> [<n_media>]":
        R(Key("%(multimedia_control)s") * Repeat(extra="n_media")),
        "change monitor":
        R(Key("w-p") + Pause("100") + Function(change_monitor))
    }
    extras = [
        ShortIntegerRef("n_media", 1, 15),
        ShortIntegerRef("n_volume", 1, 50),
        Choice("multimedia_control", {
            "next": "tracknext",
            "back": "trackprev",
            "play|pause": "playpause",
        }),
        Choice("volume_mode", {
            "mute|unmute": "volumemute",
            "up": "volumeup",
            "down": "volumedown",
        })
    ]
    defaults = {
        "n_volume": 1,
        "n_media": 1,
        "volume_mode": "setsysvolume",
    }
Esempio n. 3
0
class SudokuGridRule(MappingRule):
    pronunciation = "sudoku grid"

    mapping = {
        "<n> [grid <s>] [<action>]":
        R(Function(move_mouse)),
        "[<n0>] [grid <s0>] (grab | select | drag) <n> [grid <s>] [<action>]":
        R(Function(drag_mouse)),
        "squat {weight=2}":
        R(Function(store_first_point)),
        "bench {weight=2}":
        R(Function(select_text)),
        SymbolSpecs.CANCEL + "{weight=2}":
        R(Function(Grid.kill)),
    }
    extras = [
        ShortIntegerRef("n", -1, 1500),
        ShortIntegerRef("n0", -1, 1500),
        ShortIntegerRef("s", 0, 10),
        ShortIntegerRef("s0", 0, 10),
        Choice("action", {
            "kick": 0,
            "kick (double | 2)": 1,
            "psychic": 2,
            "move": 3,
        }),
    ]
    defaults = {
        "n": 0,
        "n0": 0,
        "s": 0,
        "s0": 0,
        "action": -1,
    }
Esempio n. 4
0
class LegionGridRule(MappingRule):

    mapping = {
        "<n> [<action>]":
            R(Function(send_input)),
        "refresh":
            R(Function(Grid.mouse_alternates, mode="legion")),
        SymbolSpecs.CANCEL + " {weight=2}":
            R(Function(Grid.kill)),
        "<n1> (select | light) <n2>":
            R(Function(drag_highlight)),
    }
    extras = [
        Choice("action", {
            "kick": 0,
            "psychic": 1,
            "select | light": 2,
        }),
        ShortIntegerRef("n", 0, 1000),
        ShortIntegerRef("n1", 0, 1000),
        ShortIntegerRef("n2", 0, 1000),
    ]
    defaults = {
        "action": -1,
    }
Esempio n. 5
0
class CustomVSCode(MergeRule):
    pronunciation = "custom visual studio code"
    mapping = {
        "save file as":
        R(Key("cs-s"), rdescript="VS Code: Save As"),
        "uppercase":
        R(Key("csa-u"), rdescript="VS Code: uppercase"),
        "lowercase":
        R(Key("csa-l"), rdescript="VS Code: lowercase"),
        "execute":
        R(Key("s-enter"), rdescript="VS Code: Ctrl + b"),
        "[go to] group [<n2>]":
        R(Key("c-%(n2)s"), rdescript="VS Code: Go to Group #"),
        "spring <n>":
        R(Key("c-g") + Pause("10") + Text("%(n)s") + Key("enter"),
          rdescript="VS Code: Go to Line #"),
        "crew [<text>]":
        R(Key("c-f") + Pause("10") + Text("%(text)s") + Pause("10") +
          Key("escape"),
          rdescript="VS Code: Get Next"),
        "trail [<text>]":
        R(Key("c-f") + Pause("10") + Text("%(text)s") + Pause("10") +
          Key("s-enter") + Key("escape"),
          rdescript="VS Code: Get Next"),
        "expand|fill quotes":
        R(Key("cs-space"), rdescript="VS Code: Expand Selection to Quotes"),
        "(cellaring | sell rang) <n> <n3>":
        R(
            Key("c-g") + Pause("5") + Text("%(n)s") + Key("enter") +
            Pause("5") + Key("c-k") + Key("c-b") + Pause("5") + Key("c-g") +
            Pause("10") + Text("%(n3)s") + Key("enter") + Key("end") +
            Key("c-k") + Key("c-k")),

        # The following commands of been enabled via words.txt
        # If Caster gets rid of transformers, reenable these words
        # "grab it":
        #     R(Key("c-d"), rdescript="VS Code: Ctrl + d"),
        # "skip it":
        #     R(Key("c-k,c-d"), rdescript="VS Code: Ctrl + d, k"),
        # "cue jeep":
        #     R(Key("a-up"), rdescript="VS Code: uppercase"),
        # "cue doom":
        #     R(Key("a-down"), rdescript="VS Code: uppercase"),
    }

    extras = [
        Dictation("text"),
        Dictation("mim"),
        ShortIntegerRef("n", 1, 1000),
        ShortIntegerRef("n2", 1, 9),
        ShortIntegerRef("n3", 1, 999),
    ]
    defaults = {"n": 1, "mim": "", "text": ""}
Esempio n. 6
0
class Markdown(MergeRule):
    pronunciation = "mark down"

    mapping = {
        "heading [<num>] [<dict>]":
        R(Store() + Function(lambda num, dict: Text(
            ("#" * num) + " " + str(dict).capitalize()).execute()) +
          Retrieve() + Key("enter")),
        "table row <n>":
        R(Function(lambda n: Text("|" * (n - 1)).execute()) + Key("home")),
        "table (break | split) <n>":
        R(
            Function(lambda n: Text("---|" * (n - 1) + "---").execute()) +
            Key("enter")),
        "insert <element>":
        R(Store() + Key("%(element)s") + Retrieve(action_if_text="c-right")),
        "insert header":
        R(Text("---\nauthor: \ntitle: \n---\n")),
    }
    extras = [
        Dictation("dict"),
        ShortIntegerRef("n", 1, 12),
        ShortIntegerRef("num", 1, 7),
        Choice(
            "element", {
                "list": "asterisk, space",
                "numbered list": "one, dot, space",
                "[block] quote": "rangle, space",
                "link": "lbracket, rbracket, lparen, rparen, left:3",
                "image":
                "exclamation, lbracket, rbracket, lparen, rparen, left:3",
                "reference": "lbracket, rbracket, left, at",
                "equation": "dollar, dollar, enter:2, dollar, dollar, up",
                "math": "dollar, dollar, left",
                "(italics | italic text)": "underscore:2, left",
                "bold [text]": "asterisk:4, left:2",
                "strike through [text]": "tilde:4, left:2",
                "horizontal rule": "asterisk, asterisk, asterisk, enter",
                "R code":
                "backtick:3, lbrace, r, rbrace, enter:2, backtick:3, up",
                "in line code": "backtick:2, left",
                "code [block]": "backtick:6, left:3, enter:2, up",
            }),
    ]
    defaults = {
        "num": 1,
        "dict": "",
    }
Esempio n. 7
0
class MSVCRule(MappingRule):
    mapping = {
        "cursor prior": R(Key("c-minus")),
        "cursor next": R(Key("cs-minus")),
        "toggle full screen": R(Key("sa-enter")),
        "resolve": R(Key("c-dot")),
        "jump to source": R(Key("f12")),
        "snippet": R(Key("tab")),
        "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("f8")),
        "build [last]": R(Key("ca-f7")),
        "debug [last]": R(Key("f5")),
        "comment out": R(Key("c-k/50, c-c")),
        "on comment out": R(Key("c-k/50, c-u")),
        "set bookmark": R(Key("c-k, c-k")),
        "next bookmark": R(Key("c-k, c-n")),
        "break point": R(Key("f9")),
        "format code": R(Key("cs-f")),
        "(do imports | import all)": R(Key("cs-o")),
        "comment line": R(Key("c-slash")),
        "go to line": R(Key("c-g")),
    }
    extras = [
        Dictation("text"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1}
Esempio n. 8
0
class HMCHistoryRule(MappingRule):
    mapping = {
        # specific to macro recorder
        "check <n>":
            R(Function(hmc_checkbox)),
        "check from <n> to <n2>":
            R(Function(hmc_recording_check_range)),
        "exclude <n>":
            R(Function(hmc_recording_exclude)),
        "[make] repeatable":
            R(Function(hmc_recording_repeatable))
    }
    extras = [
        ShortIntegerRef("n", 1, 25),
        ShortIntegerRef("n2", 1, 25),
    ]
Esempio n. 9
0
class GitHubDeskRule(MappingRule):
    mapping = {
        "new repository": R(Key("c-n")),
        "add local repository": R(Key("c-o")),
        "clone repository": R(Key("c-o")),
        "options": R(Key("c-comma")),
        "changes": R(Key("c-1")),
        "history": R(Key("c-2")),
        "(repositories | repository list)": R(Key("c-t")),
        "branches [list]": R(Key("c-b")),
        "zoom in [<n>]": R(Key("c-equals")) * Repeat(extra="n"),
        "zoom out [<n>]": R(Key("c-minus")) * Repeat(extra="n"),
        "reset zoom": R(Key("c-0")),
        "push [repository]": R(Key("c-p")),
        "pull [repository]": R(Key("cs-p")),
        "remove repository": R(Key("c-delete")),
        "view on github": R(Key("cs-g")),
        "(terminal | command prompt)": R(Key("c-backtick")),
        "explorer": R(Key("cs-f")),
        "edit": R(Key("cs-a")),
        "new branch": R(Key("cs-n")),
        "rename branch": R(Key("cs-r")),
        "delete branch": R(Key("cs-d")),
        "update from master": R(Key("cs-u")),
        "compare to branch": R(Key("cs-b")),
        "merge into current [branch]": R(Key("cs-m")),
        "compare on github": R(Key("cs-c")),
        "[create] pull request": R(Key("c-r")),
    }
    extras = [
        ShortIntegerRef("n", 1, 10),
    ]
    defaults = {"n": 1}
Esempio n. 10
0
class SSMSRule(MappingRule):
    mapping = {
        # There doesn't seem to be a hotkey for sequential tab navigation in SSMS, but something is better than nothing...
        "next tab [<n>]": R(Key("c-tab")) * Repeat(extra="n"),
        "prior tab [<n>]": R(Key("cs-tab")) * Repeat(extra="n"),
        "close tab [<n>]": R(Key("c-f4/20")) * Repeat(extra="n"),
        "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")),
        "[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": R(Key("f5")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1, "mim": ""}
Esempio n. 11
0
def get_extras():
    return [
        Choice(
            "nth", {
                "first": "1",
                "second": "2",
                "third": "3",
                "fourth": "4",
                "fifth": "5",
                "sixth": "6",
                "seventh": "7",
                "eighth": "8",
            }),
        ShortIntegerRef("n", 1, 100),
        ShortIntegerRef("m", 1, 10)
    ]
Esempio n. 12
0
class WindowManagementRule(MappingRule):
    mapping = {
        'maximize win':
        R(Function(utilities.maximize_window)),
        'minimize win':
        R(Function(utilities.minimize_window)),

        # Workspace management
        "show work [spaces]":
        R(Key("w-tab")),
        "(create | new) work [space]":
        R(Key("wc-d")),
        "close work [space]":
        R(Key("wc-f4")),
        "close all work [spaces]":
        R(Function(virtual_desktops.close_all_workspaces)),
        "next work [space] [<n>]":
        R(Key("wc-right")) * Repeat(extra="n"),
        "(previous | prior) work [space] [<n>]":
        R(Key("wc-left")) * Repeat(extra="n"),
        "go work [space] <n>":
        R(Function(virtual_desktops.go_to_desktop_number)),
        "send work [space] <n>":
        R(Function(virtual_desktops.move_current_window_to_desktop)),
        "move work [space] <n>":
        R(
            Function(virtual_desktops.move_current_window_to_desktop,
                     follow=True)),
    }

    extras = [
        ShortIntegerRef("n", 1, 20, default=1),
    ]
Esempio n. 13
0
class MouseAlternativesRule(MappingRule):
    mapping = {
        "legion [<monitor>] [<rough>]":
        R(
            Function(navigation.mouse_alternates, mode="legion") +
            Function(utilities.focus_mousegrid, gridtitle="legiongrid")),
        "rainbow [<monitor>]":
        R(
            Function(navigation.mouse_alternates, mode="rainbow") +
            Function(utilities.focus_mousegrid, gridtitle="rainbowgrid")),
        "douglas [<monitor>]":
        R(
            Function(navigation.mouse_alternates, mode="douglas") +
            Function(utilities.focus_mousegrid, gridtitle="douglasgrid")),
        "sudoku [<monitor>]":
        R(
            Function(navigation.mouse_alternates, mode="sudoku") +
            Function(utilities.focus_mousegrid, gridtitle="sudokugrid")),
    }
    extras = [
        ShortIntegerRef("monitor", 1, 10),
        Choice("rough", {
            "rough": True,
            "detailed": False
        })
    ]
    defaults = {"rough": True}
Esempio n. 14
0
class MSWordRule(MappingRule):
    mapping = {
        "insert image": R(Key("alt, n, p")),
    }
    extras = [
        Dictation("dict"),
        ShortIntegerRef("n", 1, 100),
    ]
    defaults = {"n": 1, "dict": "nothing"}
Esempio n. 15
0
class KDiff3Rule(MappingRule):
    mapping = {
        "refresh": R(Key("f5")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1, "mim": ""}
Esempio n. 16
0
class Experimental(MappingRule):

    mapping = {
        # experimental/incomplete commands
        "experiment": Function(experiment),
        "short talk number <n2>": Text("%(n2)d"),
        #     "dredge [<id> <text>]":         Function(dredge),
        "test dragonfly paste": Paste("some text"),
    }
    extras = [Dictation("text"), Dictation("text2"), ShortIntegerRef("n2", 1, 100)]
    defaults = {"text": "", "text2": ""}
Esempio n. 17
0
class FlashDevelopRule(MappingRule):
    mapping = {
        "prior tab [<n>]":
        R(Key("c-pgup")) * Repeat(extra="n"),
        "next tab [<n>]":
        R(Key("c-pgdown")) * Repeat(extra="n"),
        "open resource":
        R(Key("c-r")),
        "jump to source":
        R(Key("f4")),
        "jump away":
        R(Key("s-f4")),
        "step over [<n>]":
        R(Key("f10") * Repeat(extra="n")),
        "step into":
        R(Key("f11")),
        "step out [of]":
        R(Key("s-f11")),
        "resume":
        R(Key("a-d, c")),
        "terminate":
        R(Key("s-f5")),
        "find everywhere":
        R(Key("cs-f")),
        "refractor symbol":
        R(Key("a-r, r")),
        "symbol next [<n>]":
        R(Key("f3")) * Repeat(extra="n"),
        "symbol prior [<n>]":
        R(Key("s-f3")) * Repeat(extra="n"),
        "format code":
        R(Key("cs-2")),
        "comment line":
        R(Key("c-q")),
        "clean it":
        R(Key("s-f8")),
        "build it":
        R(Key("f8")),
        "(debug | run) last":
        R(Key("f5")),
        "split view horizontal":
        R(Key("cs-enter")),
        "auto complete":
        R(Key("cs-1")),
        "[go to] line <n>":
        R(Key("c-g") + Pause("50") + Text("%(n)d") + Key("enter")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1, "mim": ""}
Esempio n. 18
0
class SQLDeveloperRule(MappingRule):

    mapping = {
        "run this query": R(Key("f9")),
        "format code": R(Key("c-f7")),
        "comment line": R(Key("c-slash")),
    }
    extras = [
        Dictation("text"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1}
Esempio n. 19
0
class FoxitRule(MappingRule):
    mapping = {
        "next tab [<n>]": R(Key("c-tab")) * Repeat(extra="n"),
        "prior tab [<n>]": R(Key("cs-tab")) * Repeat(extra="n"),
        "close tab [<n>]": R(Key("c-f4/20")) * Repeat(extra="n"),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1, "mim": ""}
Esempio n. 20
0
class DouglasGridRule(MappingRule):
    mapping = {
        "<x> [by] <y> [<action>]":
            R(Function(send_input)),
        "<x1> [by] <y1> (grab | select) <x2> [by] <y2>":
            R(Function(send_input_select)),
        "<x1> [by] <y1> (grab | select) <x2>":
            R(Function(send_input_select_short)),
        "squat":
            R(Function(store_first_point)),
        "bench":
            R(Function(select_text)),
        SymbolSpecs.CANCEL:
            R(Function(kill)),
    }
    extras = [
        ShortIntegerRef("x", 0, 300),
        ShortIntegerRef("y", 0, 300),
        ShortIntegerRef("x1", 0, 300),
        ShortIntegerRef("y1", 0, 300),
        ShortIntegerRef("x2", 0, 300),
        ShortIntegerRef("y2", 0, 300),
        Choice("action", {
            "kick": 0,
            "psychic": 1,
            "move": 2,
        }),
        Choice("point", {
            "one": 1,
            "two": 2,
        }),
    ]
    defaults = {
        "action": -1,
    }
Esempio n. 21
0
class Numbers(MergeRule):
    pronunciation = "numbers"
    mapping = {
        "word number <wn>":
            R(Function(word_number, extra="wn")),
        "[<long>] numb <wnKK>":
            R(Text("%(long)s") + Function(numbers2, extra="wnKK") + Text("%(long)s"),
              rspec="Number"),
    }

    extras = [
        ShortIntegerRef("wn", 0, 10),
        ShortIntegerRef("wnKK", 0, 1000000),
        Choice(
            "long", {
                "long": " ",
            }),
    ]

    defaults = {
        "long": "",
    }
Esempio n. 22
0
class Punctuation(MergeRule):
    pronunciation = "punctuation"

    mapping = {
        "[<long>] <text_punc> [<npunc>]":
        R(Text("%(long)s" + "%(text_punc)s" + "%(long)s")) *
        Repeat(extra="npunc"),
        # For some reason, this one doesn't work through the other function
        "[<long>] backslash [<npunc>]":
        R(Text("%(long)s" + "\\" + "%(long)s")) * Repeat(extra="npunc"),
        "<double_text_punc> [<npunc>]":
        R(Text("%(double_text_punc)s") + Key("left")) * Repeat(extra="npunc"),
        "tabby [<npunc>]":
        R(Key("tab")) * Repeat(extra="npunc"),
        "(back | shin) tabby [<npunc>]":
        R(Key("s-tab")) * Repeat(extra="npunc"),
        "boom [<npunc>]":
        R(Text(", ")) * Repeat(extra="npunc"),
        "bam [<npunc>]":
        R(Text(". ")) * Repeat(extra="npunc"),
        "ace [<npunc100>]":
        R(Text(" ")) * Repeat(extra="npunc100"),
    }

    extras = [
        ShortIntegerRef("npunc", 0, 10),
        ShortIntegerRef("npunc100", 0, 100),
        Choice("long", {
            "long": " ",
        }),
        Choice("text_punc", text_punc_dict()),
        Choice("double_text_punc", double_text_punc_dict())
    ]
    defaults = {
        "npunc": 1,
        "npunc100": 1,
        "long": "",
    }
Esempio n. 23
0
def extras_for_whole_file():
    return [
        Dictation("text"),
        ShortIntegerRef("n10", 1, 10),
        Choice(
            "first_second_third", {
                "first": 0,
                "second": 1,
                "third": 2,
                "fourth": 3,
                "fifth": 4,
                "six": 5,
                "seventh": 6
            }),
    ]
Esempio n. 24
0
class FileDialogueRule(MappingRule):
    mapping = {
        "up [<n>]": R(Key("a-up")) * Repeat(extra="n"),
        "back [<n>]": R(Key("a-left")) * Repeat(extra="n"),
        "forward [<n>]": R(Key("a-right")) * Repeat(extra="n"),
        "search [<text>]": R(Key("c-l, tab") + Text("%(text)s")),
        "organize": R(Key("c-l, tab:2")),
        "(left | navigation) pane": R(Key("c-l, tab:3")),
        "(center|file|files|folder) (list | pane)": R(Key("c-l, tab:4")),
        "sort [headings]": R(Key("c-l, tab:5")),
        "[file] name": R(Key("a-n")),
        "file type": R(Key("c-l, tab:7")),
    }
    extras = [ShortIntegerRef("n", 1, 10), Dictation("text")]
    defaults = {
        "n": 1,
    }
Esempio n. 25
0
class MouseAlternativesRule(MappingRule):
    mapping = {
        "legion [<monitor>] [<rough>]":
        R(Function(Grid.mouse_alternates, mode="legion")),
        "rainbow [<monitor>]":
        R(Function(Grid.mouse_alternates, mode="rainbow")),
        "douglas [<monitor>]":
        R(Function(Grid.mouse_alternates, mode="douglas")),
        "sudoku [<monitor>]":
        R(Function(Grid.mouse_alternates, mode="sudoku")),
    }
    extras = [
        ShortIntegerRef("monitor", 1, 10),
        Choice("rough", {
            "rough": True,
            "detailed": False
        })
    ]
    defaults = {"rough": True}
Esempio n. 26
0
class EmacsRule(MappingRule):
    mapping = {
        "open file": R(Key("c-x, c-f")),
        "save file": R(Key("c-x, c-s")),
        "save as": R(Key("c-x, c-w")),
        "save all": R(Key("c-x, s")),
        "revert to file": R(Key("c-x, c-v")),
        "revert buffer": R(Key("a-x")),
        "close buffer": R(Key("c-x, c-c")),
        "undo": R(Key("c-underscore")),
        "begin selection": R(Key("c-space")),
        "cancel selection": R(Key("c-g")),
        "cut selection": R(Key("c-w")),
        "paste": R(Key("c-y")),
        "copy number <n>": R(Key("c-x, r, s, %(n)d")),
        "paste number <n>": R(Key("c-x, r, i, %(n)d")),
        # delete
        "forward delete": R(Key("c-delete")),
        "delete word": R(Key("a-delete")),
        "forward delete word": R(Key("a-d")),
        "word forward": R(Key("a-f")),
        "word backward": R(Key("a-b")),
        "line forward": R(Key("c-a")),
        "line backward": R(Key("c-e")),
        "paragraph forward": R(Key("a-lbrace")),
        "paragraph backward": R(Key("a-rbrace")),
        "document forward": R(Key("a-langle")),
        "document backward": R(Key("a-rangle")),
        "C function forward": R(Key("ac-a")),
        "C function backward": R(Key("ac-e")),
        "incremental search": R(Key("c-s")),
        "incremental reverse": R(Key("c-r")),
        "interactive search": R(Key("a-percent")),
        "go to line <n>": R(Key("a-x, %(n)d")),
        "prior bracket": R(Key("escape:down, c-b, escape:up")),
        "next bracket": R(Key("escape:down, c-f, escape:up")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1, "mim": ""}
Esempio n. 27
0
class IERule(MappingRule):
    mapping = {
        "address bar": R(Key("a-d")),
        "new folder": R(Key("cs-n")),
        "new file": R(Key("a-f, w, t")),
        "(show | file | folder) properties": R(Key("a-enter")),
        "get up": R(Key("a-up")),
        "get back": R(Key("a-left")),
        "get forward": R(Key("a-right")),
        "search [<text>]": R(Key("a-d, tab:1") + Text("%(text)s")),
        "(navigation | nav | left) pane": R(Key("a-d, tab:2")),
        "(center pane | (file | folder) (pane | list))": R(Key("a-d, tab:3")),
        # for the sort command below,
        # once you've selected the relevant heading for sorting using the arrow keys, press enter
        "sort [headings]": R(Key("a-d, tab:4")),
    }
    extras = [
        Dictation("text"),
        ShortIntegerRef("n", 1, 1000),
    ]
    defaults = {"n": 1}
Esempio n. 28
0
class fmanRule(MappingRule):
    mapping = {
        "copy": R(Key("f5")),
        "deselect": R(Key("c-d")),
        "edit": R(Key("f4")),
        "explorer": R(Key("f10")),
        # Set these yourself and add them to the Choice at the bottom
        # Requires the favourites plug-in
        "go <fav>":
        R(Key("c-0") + Pause("15") + Text("%(fav)s") + Key("enter")),
        "go see": R(Key("c-p") + Pause("15") + Text("c") + Key("enter")),
        "go to": R(Key("c-p")),
        "move": R(Key("f6")),
        "new file": R(Key("s-f4")),
        "new folder": R(Key("f7")),
        "open left": R(Key("c-left")),
        "open right": R(Key("c-right")),
        "properties": R(Key("a-enter")),
        "refresh": R(Key("c-r")),
        "rename": R(Key("s-f6")),
        "search": R(Key("cs-f")),
        "set favourite": R(Key("s-f")),
        "show favourites": R(Key("c-0")),
        "(show | hide) hidden": R(Key("c-dot")),
        "sort [by] name": R(Key("c-f1")),
        "sort [by] size": R(Key("c-f2")),
        "sort [by] (modified | date)": R(Key("c-f3")),
        "(stoosh | copy) path": R(Key("f11")),
        "terminal": R(Key("f9")),
        "command pallette": R(Key("cs-p")),
    }
    extras = [
        ShortIntegerRef("num", 1, 4),
        Choice("fav", {
            "example favourite": "ef",
        }),
    ]
    defaults = {
        "num": 1,
    }
Esempio n. 29
0
class LyxRule(MappingRule):
    mapping = {
        "new file": R(Key("c-n")),
        "open file": R(Key("c-o")),
        "save as": R(Key("cs-s")),
        "math mode": R(Key("c-m")),
        "display mode": R(Key("cs-m")),
        "view PDF": R(Key("c-r")),
        "update PDF": R(Key("cs-r")),
        "move line up [<n>]": R(Key("a-up")) * Repeat(extra="n"),
        "move line down [<n>]": R(Key("a-down")) * Repeat(extra="n"),
        "insert <environment>": R(Key("a-i, h, %(environment)s")),
    }
    extras = [
        ShortIntegerRef("n", 1, 10),
        Choice(
            "environment", {
                "(in line formula | in line)": "i",
                "(display formula | display)": "d",
                "(equation array environment | equation array)": "e",
                "(AMS align environment | AMS align)": "a",
                "AMS align at [environment]": "t",
                "AMS flalign [environment]": "f",
                "(AMS gathered environment | AMS gather)": "g",
                "(AMS multline [environment]| multiline)": "m",
                "array [environment]": "y",
                "(cases [environment] | piecewise)": "c",
                "(aligned [environment] | align)": "l",
                "aligned at [environment]": "v",
                "gathered [environment]": "h",
                "split [environment]": "s",
                "delimiters": "r",
                "matrix": "x",
                "macro": "o",
            }),
    ]
    defaults = {
        "n": 1,
    }
Esempio n. 30
0
class Again(MappingRule):

    mapping = {
        "again (<n> [(times|time)] | do)":
        R(Function(lambda n: Again._create_asynchronous(n)), show=False),  # pylint: disable=E0602
    }
    extras = [ShortIntegerRef("n", 1, 50)]
    defaults = {"n": 1}

    @staticmethod
    def _repeat(utterance):
        Playback([(utterance, 0.0)]).execute()
        return False

    @staticmethod
    def _create_asynchronous(n):
        last_utterance_index = 2
        if len(_history) == 0:
            return

        # ContextStack adds the word to history before executing it for WSR
        if get_current_engine().name in [
                "sapi5shared", "sapi5", "sapi5inproc"
        ]:
            if len(_history) == 1: return

        # Calculatees last utterance from recognition history and creates list of str for Dragonfly Playback
        utterance = list(
            map(str, _history[len(_history) - last_utterance_index]))

        if utterance[0] == "again": return
        forward = [L(S(["cancel"], lambda: Again._repeat(utterance)))]
        AsynchronousAction(forward,
                           rdescript="Repeat Last Action",
                           time_in_seconds=0.2,
                           repetitions=int(n),
                           blocking=False).execute()