コード例 #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"),
        IntegerRefST("n", 1, 1000),
        IntegerRefST("n2", 1, 10),
    ]
    defaults = {"n": 1}
コード例 #2
0
def perform_mouse_action(action):
    if action == 1:
        Mouse("left").execute()
    if action == 2:
        Mouse("left:2").execute()
    elif action == 3:
        Mouse("right").execute()
コード例 #3
0
def drag_from_to(x1, y1, x2, y2):
    Mouse("[{}, {}]".format(x1, y1)).execute()
    time.sleep(0.1)
    Mouse("left:down").execute()
    Mouse("[{}, {}]".format(x2, y2)).execute()
    time.sleep(0.1)
    Mouse("left:up").execute()
コード例 #4
0
def drag_mouse(xn, yn, hexdigit):
    Mouse("left:down/10").execute()
    time.sleep(0.3)
    # Hold down click, move to drag destination, and release click
    x, y = get_mouse_pos(xn, yn, hexdigit)
    Mouse("[{}, {}]".format(x, y)).execute()
    time.sleep(0.3)
    Mouse("left:up/30").execute()
コード例 #5
0
def send_input(x, y, action):
    s = control.nexus().comm.get_com("grids")
    s.move_mouse(int(x), int(y))
    int_a = int(action)
    if (int_a == 0) | (int_a == 1) | (int_a == -1):
        s.kill()
        grids.wait_for_death(settings.DOUGLAS_TITLE)
    if int_a == 0:
        Mouse("left").execute()
    elif int_a == 1:
        Mouse("right").execute()
コード例 #6
0
def send_input(x, y, action):
    s = control.nexus().comm.get_com("grids")
    s.move_mouse(int(x), int(y))
    int_a = int(action)
    if (int_a == 0) | (int_a == 1) | (int_a == -1):
        s.kill()
        navigation.wait_for_grid_exit()
    if int_a == 0:
        Mouse("left").execute()
    elif int_a == 1:
        Mouse("right").execute()
コード例 #7
0
def send_input(pre, color, n, action):
    s = control.nexus().comm.get_com("grids")
    s.move_mouse(int(pre), int(color), int(n))
    int_a = int(action)
    if (int_a == 0) | (int_a == 1) | (int_a == -1):
        s.kill()
        navigation.wait_for_grid_exit()
        time.sleep(0.1)
    if int_a == 0:
        Mouse("left").execute()
    elif int_a == 1:
        Mouse("right").execute()
コード例 #8
0
ファイル: gridrainbow.py プロジェクト: pimp22/Caster
def send_input(pre, color, n, action):
    s = control.nexus().comm.get_com("grids")
    s.move_mouse(int(pre), int(color), int(n))
    int_a = int(action)
    if (int_a == 0) | (int_a == 1) | (int_a == -1):
        s.kill()
        grids.wait_for_death(settings.DOUGLAS_TITLE)
        time.sleep(0.1)
    if int_a == 0:
        Mouse("left").execute()
    elif int_a == 1:
        Mouse("right").execute()
コード例 #9
0
ファイル: gridsudoku.py プロジェクト: leshnabalara/LarynxCode
def drag_mouse(n0, s0, n, s, action):
    sudoku = control.nexus().comm.get_com("grids")
    x, y = sudoku.get_mouse_pos(int(n), int(s))
    # If dragging from a different location, move there first
    if int(n0) > 0:
        sudoku.move_mouse(int(n0), int(s0))
    sudoku.kill()
    navigation.wait_for_grid_exit()
    time.sleep(0.1)
    # Hold down click, move to drag destination, and release click
    Mouse("left:down/10").execute()
    Mouse("[{}, {}]".format(x, y)).execute()
    time.sleep(0.1)
    Mouse("left:up/30").execute()
    perform_mouse_action(int(action))
コード例 #10
0
def curse(direction, direction2, nnavi500, dokick):
    x, y = 0, 0
    d = str(direction)
    d2 = str(direction2)
    if d == "up" or d2 == "up":
        y = -nnavi500
    if d == "down" or d2 == "down":
        y = nnavi500
    if d == "left" or d2 == "left":
        x = -nnavi500
    if d == "right" or d2 == "right":
        x = nnavi500

    Mouse("<" + str(x) + ", " + str(y) + ">").execute()
    if int(dokick) != 0:
        if int(dokick) == 1:
            left_click()
        elif int(dokick) == 2:
            right_click()
コード例 #11
0
ファイル: navigation.py プロジェクト: ithmeer/Caster
def curse(direction, direction2, nnavi500, dokick):
    x, y = 0, 0
    d = str(direction)
    d2 = str(direction2)
    if d == "up" or d2 == "up":
        y = -nnavi500
    if d == "down" or d2 == "down":
        y = nnavi500
    if d == "left" or d2 == "left":
        x = -nnavi500
    if d == "right" or d2 == "right":
        x = nnavi500

    Mouse("<" + str(x) + ", " + str(y) + ">").execute()
    if int(dokick) != 0:
        if int(dokick) == 1:
            left_click(control.nexus())  # pylint: disable=too-many-function-args
        elif int(dokick) == 2:
            right_click(control.nexus())  # pylint: disable=too-many-function-args
コード例 #12
0
def mouse_click(button):
    kill_grids_and_wait()
    Mouse(button).execute()
コード例 #13
0
def wheel_scroll(direction, nnavi500):
    wheel = "wheelup" if direction == "up" else "wheeldown"
    for i in range(1, abs(nnavi500) + 1):
        Mouse("{}:1/10".format(wheel)).execute()
コード例 #14
0
ファイル: navigation.py プロジェクト: synkarius/Caster
def mouse_click(button):
    if Grid.GRID_PROCESS is not None:
        Grid.kill()
    Mouse(button).execute()
コード例 #15
0
def move_mouse(xn, yn, hexdigit):
    x, y = get_mouse_pos(xn, yn, hexdigit)
    Mouse("[{}, {}]".format(x, y)).execute()
コード例 #16
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
    }
コード例 #17
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": ""}
コード例 #18
0
class BrowserSharedCommands(object):

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

    chromeAndFirefoxMapping = {
        browser_shared.OPEN_NEW_WINDOW:
            R(Key("c-n")),
        browser_shared.OPEN_NEW_INCOGNITO_WINDOW:
            R(Key("cs-n")),
        browser_shared.NEW_TAB_N_TIMES:
            R(Key("c-t") * Repeat(extra="n")),
        browser_shared.REOPEN_TAB_N_TIMES:
            R(Key("cs-t")) * Repeat(extra="n"),
        browser_shared.CLOSE_TAB_N_TIMES:
            R(Key("c-w")) * Repeat(extra='n'),
        browser_shared.CLOSE_WINDOW:
            R(Key("cs-w")),
        browser_shared.NEXT_TAB_N_TIMES:
            R(Key("c-tab")) * Repeat(extra="n"),
        browser_shared.OPEN_NEW_TAB_BASED_ON_CURSOR:
            R(Mouse("middle") + Pause("20") + Key("c-tab")),
        browser_shared.GO_BACK_N_TIMES:
            R(Key("a-left/20")) * Repeat(extra="n"),
        browser_shared.GO_FORWARD_N_TIMES:
            R(Key("a-right/20")) * Repeat(extra="n"),
        browser_shared.ZOOM_IN_N_TIMES:
            R(Key("c-plus/20")) * Repeat(extra="n"),
        browser_shared.ZOOM_OUT_N_TIMES:
            R(Key("c-minus/20")) * Repeat(extra="n"),
        browser_shared.ZOOM_RESET_DEFAULT:
            R(Key("c-0")),
        browser_shared.FORCE_HARD_REFRESH:
            R(Key("c-f5")),
        browser_shared.FIND_NEXT_MATCH:
            R(Key("c-g/20")) * Repeat(extra="n"),
        browser_shared.FIND_PREVIOUS_MATCH:
            R(Key("cs-g/20")) * Repeat(extra="n"),
        # requires an extension in some browsers such as chrome
        browser_shared.TOGGLE_CARET_BROWSING:
            R(Key("f7")),
        browser_shared.GO_TO_HOMEPAGE:
            R(Key("a-home")),
        browser_shared.SHOW_HISTORY:
            R(Key("c-h")),
        browser_shared.SELECT_ADDRESS_BAR:
            R(Key("c-l")),
        browser_shared.SHOW_DOWNLOADS:
            R(Key("c-j")),
        browser_shared.ADD_BOOKMARK:
            R(Key("c-d")),
        browser_shared.BOOKMARK_ALL_TABS:
            R(Key("cs-d")),
        browser_shared.SHOW_BOOKMARKS:
            R(Key("cs-o")),
        browser_shared.TOGGLE_FULL_SCREEN:
            R(Key("f11")),
        browser_shared.SHOW_PAGE_SOURCE:
            R(Key("c-u")),
        browser_shared.DEBUG_RESUME:
            R(Key("f8")),
        browser_shared.DEBUG_STEP_OVER:
            R(Key("f10")),
        browser_shared.DEBUG_STEP_INTO:
            R(Key("f11")),
        browser_shared.DEBUG_STEP_OUT:
            R(Key("s-f11")),
        browser_shared.DUPLICATE_TAB:
            R(Key("a-d,a-c,c-t/15,c-v/15, enter")),
        browser_shared.DUPLICATE_WINDOW:
            R(Key("a-d,a-c,c-n/15,c-v/15, enter")),
        browser_shared.SHOW_MENU:
            R(Key("a-f")),
        browser_shared.SHOW_SETTINGS:
            R(Key("a-f/5, s")),
        browser_shared.SHOW_TASK_MANAGER:
            R(Key("s-escape")),
        browser_shared.CLEAR_BROWSING_DATA:
            R(Key("cs-del")),
        browser_shared.SHOW_DEVELOPER_TOOLS:
            R(Key("cs-i")),
        browser_shared.CHECKOUT_PR:
            R(Function(github_automation.github_checkoutupdate_pull_request, new=True)),
        browser_shared.UPDATE_PR:
            R(Function(github_automation.github_checkoutupdate_pull_request, new=False)),
        "IRC identify":
            R(Text("/msg NickServ identify PASSWORD")),
    }
コード例 #19
0
class VSCodeNonCcrRule(MappingRule):
    mapping = {
        # Moving around a file
        "[(go to | jump | jump to)] line <n>":
            R(Key("c-g") + Text("%(n)d") + Key("enter")),
        "<action> [line] <ln1> [by <ln2>]":
            R(Function(navigation.action_lines)),

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

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

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

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

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

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

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

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

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

        # Integrated Terminal

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

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

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

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

        # requires bookmark extension
        "mark (prev | prior | previous)":
            R(Key("ca-j")),
        "mark next":
            R(Key("ca-l")),
    }
    extras = [
        Dictation("text"),
        Dictation("mim"),
        IntegerRefST("ln1", 1, 1000),
        IntegerRefST("ln2", 1, 1000),
        IntegerRefST("n", 1, 1000),
        Choice("action", navigation.actions),
        Choice(
            "nth", {
                "first": "1",
                "second": "2",
                "third": "3",
                "fourth": "4",
                "fifth": "5",
                "sixth": "6",
            }),
    ]
    defaults = {"n": 1, "ln2": "",  "mim": "", "text": ""}
コード例 #20
0
ファイル: grids.py プロジェクト: synkarius/Caster
 def move_mouse(mx, my):
     Mouse("[{}, {}]".format(mx, my)).execute()
コード例 #21
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": "",
    }
コード例 #22
0
ファイル: navigation.py プロジェクト: swipswaps/Caster
def mouse_click(nexus, button):
    kill_grids_and_wait(nexus)
    Mouse(button).execute()
コード例 #23
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"}
コード例 #24
0
ファイル: grids.py プロジェクト: synkarius/Caster
 def click(self):
     Mouse("left:1").execute()
コード例 #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_support.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_support.button_dictionary_1.items()
        if value in ["home", "end"]
    }
    extras = [
        ShortIntegerRef("nnavi10", 1, 11),
        ShortIntegerRef("nnavi3", 1, 4),
        ShortIntegerRef("nnavi50", 1, 50),
        ShortIntegerRef("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_support.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 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
    }