예제 #1
0
class sn_nested(NestedRule):
    mapping = {
        "[<before>] integral from <sequence1> to <sequence2>": [
            Function(lambda: texchar("int")) + Key("c-l"),
            Key("right, c-h"),
            Key("right")
        ],
        "[<before>] definite from <sequence1> to <sequence2>": [
            Key("c-6, right, c-l"),
            Key("right, c-h"),
            Key("right, c-left, left")
        ],
        "[<before>] differential <sequence1> by <sequence2>":
        [Key("c-f, d"), Key("down, d"),
         Key("right")],
        "[<before>] sum from <sequence1> to <sequence2>": [
            Key("f10, i, down:11, enter/25, a, enter, f10, i, down:11, enter/25, b, enter"
                ) + Function(lambda: texchar("sum")) + Key("down"),
            Key("up:2"),
            Key("right")
        ],
        "[<before>] limit from <sequence1> to <sequence2>": [
            Key("f10, i, down:11, enter/25, b, enter") +
            Function(lambda: texchar("lim")) + Key("down"),
            Function(lambda: texchar("rightarrow")),
            Key("right")
        ],
        "[<before>] argument that <minmax> <sequence1>": [
            Key("f10, i, down:11, enter/25, b, enter") +
            Text("arg%(minmax)s") + Key("down"),
            Key("right"), None
        ],
        "[<before>] <minmax> by <sequence1>": [
            Key("f10, i, down:11, enter/25, b, enter") + Text("%(minmax)s") +
            Key("down"),
            Key("right"), None
        ],
        "[<before>] <script1> <singleton1> [<after>]":
        [Key("%(script1)s"), Key("right"), None],
        "[<before>] <script1> <singleton1> <script2> <singleton2> [<after>]":
        [Key("%(script1)s"),
         Key("right, %(script2)s"),
         Key("right")],
    }
    extras = [
        Choice("minmax", {
            "(minimum | minimises)": "min",
            "(maximum | maximises)": "max",
        }),
        Choice("script1", {
            "sub": "c-l",
            "super": "c-h",
        }),
        Choice("script2", {
            "sub": "c-l",
            "super": "c-h",
        }),
    ]
예제 #2
0
class NormalActionRule(CompoundRule):
    spec = "<action> [<scope>]"
    extras = [Choice("action", _actions), Choice("scope", _scopes)]

    def _process_recognition(self, node, extras):
        action = extras["action"]
        scope = None
        if "scope" in extras:
            scope = extras["scope"]
        edit(action, scope)
예제 #3
0
class LaTeX(MergeRule):
    non = LaTeXNon

    pronunciation = BINDINGS["pronunciation"]

    mapping = {
        "insert comment":
        Text("% "),
        BINDINGS["class_prefix"] + " [<class>]":
        tex_funcs.back_curl("documentclass", "%(class)s"),
        BINDINGS["environment_prefix"] + " <environment>":
        Function(tex_funcs.begin_end),
        #
        BINDINGS["package_prefix"] + " [<packopts>]":
        Function(tex_funcs.packages),
        #
        BINDINGS["symbol_prefix"] + " <symbol>":
        Function(tex_funcs.symbol),
        BINDINGS["symbol_prefix"] + " <misc_symbol>":
        Function(
            lambda misc_symbol: execution.alternating_command(misc_symbol)),
        BINDINGS["greek_prefix"] + " [<big>] <greek_letter>":
        Function(tex_funcs.greek_letters),
        #
        BINDINGS["command_prefix"] + " <command>":
        tex_funcs.back_curl("%(command)s", ""),
        BINDINGS["command_prefix"] + " <commandnoarg>":
        Text("\\%(commandnoarg)s "),
        BINDINGS["command_prefix"] + " my (bib resource | bibliography)":
        tex_funcs.back_curl("addbibresource", BINDINGS["bibliography_path"]),
        BINDINGS["command_prefix"] + " quote":
        Function(tex_funcs.quote),
        #
        BINDINGS["template_prefix"] + " <template>":
        Function(execution.template),
    }

    extras = [
        Choice("big", {CORE["capitals_prefix"]: True}),
        Choice("packopts", BINDINGS["packages"]),
        Choice("class", BINDINGS["document_classes"]),
        Choice("greek_letter", BINDINGS["greek_letters"]),
        Choice("symbol", BINDINGS["symbols"]),
        Choice("misc_symbol", BINDINGS["misc_symbols"]),
        Choice("commandnoarg", BINDINGS["commandnoarg"]),
        Choice("command", BINDINGS["command"]),
        Choice("environment", BINDINGS["environments"]),
        Choice("template", BINDINGS["templates"]),
    ]
    defaults = {
        "big": False,
        "packopts": "",
        "class": "",
    }
예제 #4
0
class GlobalCommandRule(TortoiseRule):

    spec = config.tortoisesvn.global_command
    extras = [
        Choice("command", config.tortoisesvn.actions),
        Choice("predef", config.tortoisesvn.predef),
    ]

    def _process_recognition(self, node, extras):
        path_list = [extras["predef"]]
        command = extras["command"]
        self._execute_command(path_list, command)
예제 #5
0
class NormalModeToInsertModeCommands(MappingRule):
    mapping = {
        "insert":
        Key("i"),
        "(shift|big) insert":
        Key("I"),
        'change <no_count_motion>':
        Key('c,%(no_count_motion)s,'),
        '[<n>] change <optional_count_motion>':
        Text('%(n)d') + Key('c,%(optional_count_motion)s'),
        '<n> change <mandatory_count_motion>':
        Text('%(n)d') + Key('c,%(mandatory_count_motion)s'),
        '[<n>] chan <text_object_selection_object>':
        Text('%(n)d') + Key("c,a,%(text_object_selection_object)s"),
        '[<n>] chin <text_object_selection_object>':
        Text('%(n)d') + Key("c,i,%(text_object_selection_object)s"),
        '[<n>] chat <letter>':
        Text('%(n)d') + Key("c,t,%(letter)s"),
        '[<n>] chaff <letter>':
        Text('%(n)d') + Key("c,f,%(letter)s"),
        '[<n>] chew':
        Text('%(n)d') + Key('c,w'),
        '[<n>] change <find_motion>':
        Text('%(n)d') + Key('c,%(find_motion)s'),
        "(big|shift) change":
        Key("C"),
        "change (char|letter)":
        Key("s"),
        "(sub|change) line":
        Key("S"),
        "(after|append)":
        Key("a"),
        "(shift|big) (after|append)":
        Key("A"),
        "open":
        Key("o"),
        "(shift|big) open":
        Key("O"),
    }

    extras = [
        LetterRef('letter'),
        Choice('no_count_motion', no_count_motion_keys),
        Choice('optional_count_motion', optional_count_motion_keys),
        Choice('mandatory_count_motion', mandatory_count_motion_keys),
        Choice('text_object_selection', text_object_keys),
        Choice('text_object_selection_object', text_object_selection_objects),
        FindMotionRef('find_motion'),
        IntegerRef('n', 1, 101, default=1),
    ]
예제 #6
0
 class CustomKeysRule(MappingRule):
     mapping = {
         "windows": Key('win:down/3, win:up/3'),
         "caster reboot": Mimic("reboot caster"),
         "magic":Mouse("left:down/3, left:up/3"),
         "space bar":Key("space:down/3, space:up/3"),
         "foot pedal <footPedalMode>":Function(setFootPedalMode),
         "ecks box controller <onOff>":Function(setControllerMode),
         "look":Key("f15")
         # "foot pedal mouse":Function(lambda:writeIni("footMode","mouse"))
     }
     extras = [
         Choice("footPedalMode",foot_pedal_modes),
         Choice("onOff",{"on":"on","off":"off"})
     ]
예제 #7
0
class SudokuGridRule(MergeRule):
    '''
    Rules for sudoku grid. We can either move the mouse or drag it.
    The number n is one of the numbered squares.
    The grid portion is a number from 1-9 referencing an inner unnumbered square.
    '''
    pronunciation = "sudoku grid"

    mapping = {
        "curse <xn> by <yn> [grid <hexdigit>]": R(Function(move_mouse)),
        "drag <xn> by <yn> [grid <hexdigit>]": R(Function(drag_mouse)),
    }
    extras = [
        IntegerRef("yn", -1, 100),
        IntegerRef("xn", -1, 100),
        IntegerRef("sn", 0, 10),
        Choice(
            "hexdigit", {
                "zero": 0,
                "one": 1,
                "two": 2,
                "three": 3,
                "four": 4,
                "five": 5,
                "six": 6,
                "seven": 7,
                "eight": 8,
                "nine": 9,
                "arch": 10,
                "brov": 11,
                "char": 12,
                "delta": 13,
                "echo": 14,
                "foxy": 15,
            }),
        Choice("action", {
            "move": 0,
            "kick": 1,
            "kick (double | 2)": 2,
            "psychic": 3,
        }),
    ]
    defaults = {
        "xn": 0,
        "yn": 0,
        "hexdigit": None,
        "action": 0,
    }
예제 #8
0
class Mousing(MergeRule):
    mapping = {
        # "jump": Function(move_mouse),
        "[<button>] kick":
        Function(click_mouse),
        # "[<button>] click": Function(move_and_click_mouse),
        "[<button>] lick [<n500>]":
        Function(adjust_and_click_mouse, button="left", direction="left"),
        "[<button>] rick [<n500>]":
        Function(adjust_and_click_mouse, button="left", direction="right"),
        "[<button>] sick [<n500>]":
        Function(adjust_and_click_mouse, button="left", direction="up"),
        "[<button>] dick [<n500>]":
        Function(adjust_and_click_mouse, button="left", direction="down"),
    }

    extras = [
        IntegerRef("n500", 1, 500),
        Choice("button", {
            "left": "left",
            "right": "right",
            "middle": "middle",
            "dub": "double"
        }),
    ]

    defaults = {
        "n100": 1,
        "button": 'left',
    }
예제 #9
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 {weight=2}":
        R(Function(store_first_point)),
        "bench {weight=2}":
        R(Function(select_text)),
        SymbolSpecs.CANCEL + " {weight=2}":
        R(Function(Grid.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,
            "kick (double | 2)": 1,
            "psychic": 2,
            "move": 3,
        }),
    ]
    defaults = {
        "action": -1,
    }
예제 #10
0
def test_global_extras():
    Breathe.add_global_extras(Dictation("text"))
    assert len(Breathe.global_extras) == 1
    assert "text" in Breathe.global_extras
    Breathe.add_global_extras([Choice("abc", {"def": "ghi"})])
    # Check that this is overridden
    Breathe.add_global_extras(IntegerRef("n", 1, 2, 1))
예제 #11
0
class Get(MergeRule):

    mapping = {
        "get <git_command> [<name>]": Function(git),
    }

    extras = [
        Choice(
            "git_command", {
                "clone": "clone",
                "add": "add",
                "all": "all",
                "commit": 'commit',
                "pull": "pull",
                "push": "push",
                "checkout": "checkout",
                "And it": "init",
                "merge": "merge",
                "delete": "delete",
                "stash": "stash",
                "stash apply": "stash apply",
                "status": "status"
            }),
        Dictation("name")
    ]

    defaults = {}
예제 #12
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,
    }
예제 #13
0
class KeystrokeRule(MappingRule):
    exported = False
    mapping = grammarCfg.cmd.map
    extras = [
        IntegerRef("n", 1, 100),
        IntegerRef("m", 0, 100),
        Dictation("text"),
        Dictation("text2"),
        Choice("formatType", formatMap),
        Choice("abbreviation", abbreviationMap),
        Choice("reservedWord", reservedWord),
    ]
    defaults = {
        "n": 1,
        "m": 0,
    }
예제 #14
0
class EmacsIdentifiers(CompoundRule):
    spec = '<naming> <text>'
    extras = [
        Choice('naming', {
            # [
            #   lower(false)/upper(true) all first,
            #   cap first word, cap other words,
            #   separator
            # ]
            'constant': [ True, False, False, '_' ],
            'lisp': [ False, False, False, '-' ],
            'lower camel': [ False, False, True, '' ],
            'score': [ False, False, False, '_' ],
            'upper camel': [ False, True, True, '' ],
            'lower spaced': [ False, False, False, ' ' ]
        }),
        Dictation('text')
    ]

    def _process_recognition(self, node, extras):
        spec = extras['naming']
        text = extras['text'].format()
        text = text.upper() if spec[0] else text.lower()
        words = text.split(' ')
        if len(words) == 0: return
        if spec[1]: words[0]=words[0].capitalize()
        if spec[2]: words=[words[0]] + [w.capitalize() for w in words[1:]]
        Text(spec[3].join(words)).execute()            
예제 #15
0
class KeystrokeRule(MappingRule):
    exported = False
    mapping = grammarCfg.cmd.map
    extras = [
        IntegerRef("n", 1, 100),
        Dictation("text"),
        Dictation("text2"),
        Choice("char", specialCharMap),
        Choice("modifier1", modifierMap),
        Choice("modifier2", modifierMap),
        Choice("modifierSingle", singleModifierMap),
        Choice("pressKey", pressKeyMap),
    ]
    defaults = {
        "n": 1,
    }
예제 #16
0
def get_alphabet_choice(spec):
    return Choice(
        spec, {
            "arch": "a",
            "brov": "b",
            "char": "c",
            "delta": "d",
            "echo": "e",
            "foxy": "f",
            "goof": "g",
            "hotel": "h",
            "India": "i",
            "julia": "j",
            "kilo": "k",
            "Lima": "l",
            "Mike": "m",
            "Novakeen": "n",
            "oscar": "o",
            "prime": "p",
            "Quebec": "q",
            "Romeo": "r",
            "Sierra": "s",
            "tango": "t",
            "uniform": "u",
            "victor": "v",
            "whiskey": "w",
            "x-ray": "x",
            "yankee": "y",
            "Zulu": "z",
        })
예제 #17
0
def letter_choice(name):
    return (Choice(
        name, {
            "(anti | arch)": "a",
            "bat": "b",
            "cap": "c",
            "die": "d",
            "each": "e",
            "fail": "f",
            "(gone | gust)": "g",
            "(harp | harm)": "h",
            "sit": "i",
            "jury": "j",
            "crunch": "k",
            "look": "l",
            "(made | mad)": "m",
            "near": "n",
            "odd": "o",
            "pit": "p",
            "queer": "q",
            "red": "r",
            "sun": "s",
            "trap": "t",
            "urge": "u",
            "vest": "v",
            "whale": "w",
            "box": "x",
            "yes": "y",
            "zulu": "z",
        }))
예제 #18
0
def surroundChoice(name="surround"):
    return Choice(
        name, {
            "tag": "t",
            'ampersand': 'ampersand',
            '( post | apostrophe )': 'apostrophe',
            '( starling | asterisk )': 'asterisk',
            'backtick': 'backtick',
            '( bar | pipe )': 'bar',
            'dollar': 'dollar',
            'quote': 'dquote',
            'hashtag': 'hash',
            'modulo': 'percent',
            'single quote': 'squote',
            '(tilde | strike)': 'tilde',
            '(underscore | score)': 'underscore',
            'langle': 'langle',
            'lace': 'lbrace',
            'lack': 'lbracket',
            'laip': 'lparen',
            'rangle': 'rangle',
            '(race | brace | curly)': 'rbrace',
            '(rack | bracket)': 'rbracket',
            '(raip | paren)': 'rparen',
        })
예제 #19
0
파일: html.py 프로젝트: mrob95/MR-caster
class HTML(MergeRule):
    mapping = {
        "insert <element>": Function(insert),
    }
    extras = [
        Choice("element", BINDINGS["elements"]),
    ]
예제 #20
0
def get_alphabet_choice(spec):
    return Choice(
        spec, {
            "arch": "a",
            "brov": "b",
            "chair": "c",
            "dell": "d",
            "etch": "e",
            "fomp": "f",
            "goof": "g",
            "hark": "h",
            "ice": "i",
            "jinks": "j",
            "koop": "k",
            "lug": "l",
            "Mike": "m",
            "nerb": "n",
            "ork": "o",
            "pooch": "p",
            "quash": "q",
            "rosh": "r",
            "souk": "s",
            "teek": "t",
            "unks": "u",
            "verge": "v",
            "womp": "w",
            "trex": "x",
            "yang": "y",
            "zooch": "z",
        })
예제 #21
0
def findChoice(name="find"):
    return Choice(name, {
        "find": "f",
        "bind": "F",
        "(until | till)": "t",
        "bill": "T",
    })
예제 #22
0
    def test_natlink_compiler(self):
        from dragonfly.engines.backend_natlink.compiler import NatlinkCompiler
        extras = [
            Choice("food", {
                "(an | a juicy) apple": "good",
                "a [greasy] hamburger": "bad"
            })
        ]
        rule = CompoundRule('ExampleCustomRule', "I want to eat <food>",
                            extras)
        grammar = Grammar(name="mygrammar")
        grammar.add_rule(rule)

        c = NatlinkCompiler()
        (compiled_grammar, rule_names) = c.compile_grammar(grammar)

        assert rule_names == (None, "ExampleCustomRule")
        if PY2:
            assert compiled_grammar.encode(
                "hex"
            ) == "0000000000000000040000001c0000001c000000010000004578616d706c65437573746f6d52756c650000000500000000000000060000000000000002000000900000000c0000000100000049000000100000000200000077616e74000000000c00000003000000746f00000c00000004000000656174000c000000050000006100000010000000060000006772656173790000140000000700000068616d6275726765720000000c00000008000000616e000010000000090000006a75696379000000100000000a0000006170706c6500000003000000e0000000e00000000100000001000000010000000100000001000000030000000100000003000000020000000300000003000000030000000400000002000000010000000100000002000000010000000100000003000000050000000100000004000000030000000600000002000000040000000300000007000000020000000100000001000000010000000100000002000000030000000800000001000000010000000300000005000000030000000900000002000000010000000200000002000000030000000a000000020000000100000002000000020000000200000001000000"
        else:
            assert codecs.encode(
                compiled_grammar, "hex_codec"
            ) == b"0000000000000000040000001c0000001c000000010000004578616d706c65437573746f6d52756c650000000500000000000000060000000000000002000000900000000c0000000100000049000000100000000200000077616e74000000000c00000003000000746f00000c00000004000000656174000c00000005000000616e00000c000000060000006100000010000000070000006a7569637900000010000000080000006170706c6500000010000000090000006772656173790000140000000a00000068616d62757267657200000003000000e0000000e00000000100000001000000010000000100000001000000030000000100000003000000020000000300000003000000030000000400000002000000010000000100000002000000010000000100000001000000020000000300000005000000010000000100000003000000060000000300000007000000020000000100000002000000020000000300000008000000020000000100000001000000010000000300000006000000010000000400000003000000090000000200000004000000030000000a000000020000000100000002000000020000000200000001000000"
예제 #23
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 = [
        IntegerRefST("monitor", 1, 10),
        Choice("rough", {
            "rough": True,
            "detailed": False
        })
    ]
    defaults = {"rough": True}
예제 #24
0
class SudokuGridRule(MappingRule):
    pronunciation = "sudoku grid"

    mapping = {
        "<n> [grid <s>] [<action>]":
        R(Function(move_mouse)),
        "[<n0>] [grid <s0>] drag <n> [grid <s>] [<action>]":
        R(Function(drag_mouse)),
        "escape":
        R(Function(kill)),
        SymbolSpecs.CANCEL:
        R(Function(kill)),
    }
    extras = [
        IntegerRefST("n", -1, 1500),
        IntegerRefST("n0", -1, 1500),
        IntegerRefST("s", 0, 10),
        IntegerRefST("s0", 0, 10),
        Choice("action", {
            "move": 0,
            "kick": 1,
            "kick (double | 2)": 2,
            "psychic": 3,
        }),
    ]
    defaults = {
        "n": 0,
        "n0": 0,
        "s": 0,
        "s0": 0,
        "action": 0,
    }
예제 #25
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,
    }
예제 #26
0
class Bash(MergeRule):

    mapping = {
        "pseudo-": Text("sudo "),
        "change": Text("cd "),
        "list": Key("l,s,enter"),
        "sublime": Text("subl "),
        "home": Text("~/"),
        "pie": Text("py"),
        "copy": Key("cs-c"),
        "copy <t>": Function(copy),
        "paste": Key("cs-v"),
        "paste <t>": Function(paste),
        "make directory": Text("mkdir "),
        ".Thought": Text(".."),
        "parent": Text("../"),
        "remote <ssh_server>": Text('ssh %(ssh_server)s'),
        "dropbox": Text("cd ~/Dropbox/"),
        "reset": Key("c-c,c-c,up,enter")
    }

    extras = [
        Choice('ssh_server', {}),
        Dictation("t"),
    ]

    defaults = {
        "t": 'default',
    }
예제 #27
0
class SnapWindowRule(CompoundRule):
    spec = 'snap window to <region>'
    extras = [
        Choice(
            'region', {
                'top left': [0, 0, 0.5, 0.5],
                'top half': [0, 0, 1, 0.5],
                'top right': [0.5, 0, 0.5, 0.5],
                'right half': [0.5, 0, 0.5, 1],
                'bottom right': [0.5, 0.5, 0.5, 0.5],
                'bottom half': [0, 0.5, 1, 0.5],
                'bottom left': [0, 0.5, 0.5, 0.5],
                'left half': [0, 0, 0.5, 1],
                'whole monitor': [0, 0, 1, 1],
            })
    ]

    @staticmethod
    def snap_window(window, region_spec):
        monitor = window.get_containing_monitor().rectangle
        pos = Rectangle(monitor.x1 + monitor.dx * region_spec[0],
                        monitor.y1 + monitor.dy * region_spec[1],
                        monitor.dx * region_spec[2],
                        monitor.dy * region_spec[3])
        window.restore()
        window.set_position(pos)

    def _process_recognition(self, node, extras):
        self.snap_window(Window.get_foreground(), extras['region'])
예제 #28
0
class coreNon(MergeRule):
    mapping = {
        "configure " + CORE["pronunciation"]:
        Function(utilities.load_config, config_name="core.toml"),
        "<noCCR_repeatable_key> [<n>]":
        Key("%(noCCR_repeatable_key)s") * Repeat(extra="n"),
        "<noCCR_non_repeatable_key>":
        Key("%(noCCR_non_repeatable_key)s"),
    }
    extras = [
        IntegerRef("n", 1, 10),
        Choice("noCCR_repeatable_key", CORE["noCCR_repeatable_keys"]),
        Choice("noCCR_non_repeatable_key", CORE["noCCR_non_repeatable_keys"]),
    ]
    defaults = {
        "n": 1,
    }
예제 #29
0
class Keyboard(MergeRule):

    mapping = {
        "<single_key>": Function(single_press),
        "[<modify_letter>] <alphabet_key>": Function(alphabet_press),
        "<repeat_key> [<n500>]": Function(repeat_press),
        '<modifier_key> <any_key> [<n100>]': Function(any_press),
        "develop testing": Key('colon'),
        "super [<any_key>]": Function(super_press),
        "hold <modifier_full_name>": Key("%(modifier_full_name)s:down"),
        "release": Key("ctrl:up,alt:up,shift:up,win:up")
    }

    extras = [
        IntegerRef("n100", 1, 100),
        IntegerRef("n500", 1, 500),
        Choice("single_key", single_key),
        Choice("repeat_key", repeat_key),
        Choice("any_key", any_key),
        Choice("modifier_key", modifier_key),
        Choice("alphabet_key", alphabet_key),
        Choice("modify_letter", {"cap": "cap"}),
        Choice("modifier_full_name", modifier_full_name)
    ]

    defaults = {
        "n100": 1,
        "n500": 1,
    }
예제 #30
0
class ChatRule(MappingRule):
    mapping = {
        "at <user>": Text("@%(user)s "),
        "send": Key("enter"),
    }

    extras = [
        Choice("user", hipchat_config.usernames.map),
    ]