Ejemplo n.º 1
0
def non_ccr_app_rule(rule, context=None, name=None, rdp=True, filter=True):
    if settings.SETTINGS["miscellaneous"]["rdp_mode"] and rdp:
        nexus().merger.add_global_rule(rule)
    else:
        if hasattr(rule, "get_context") and rule.get_context() is not None:
            context = rule.get_context()
        grammar_name = name if name else str(rule)
        grammar = Grammar(grammar_name, context=context)
        if filter: gfilter.run_on(rule)
        grammar.add_rule(rule)
        grammar.load()
Ejemplo n.º 2
0

class IERule(MergeRule):
    pronunciation = "explorer"

    mapping = {
        "get up [<n>]": R(Key("a-up")) * Repeat(extra="n"),
        "get back [<n>]": R(Key("a-left")) * Repeat(extra="n"),
        "get forward [<n>]": R(Key("a-right")) * Repeat(extra="n"),
        "new folder": R(Key("cs-n")),
        "address bar": R(Key("c-l")),
        "search": R(Key("c-l, tab")),
        "left pane": R(Key("c-l, tab:2")),
        "center pane": R(Key("c-l, tab:3")),
        "sort": R(Key("c-l, tab:4")),
    }
    extras = [IntegerRefST("n", 1, 10)]
    defaults = {
        "n": 1,
    }


#---------------------------------------------------------------------------

context = AppContext(executable="explorer")
grammar = Grammar("Windows Explorer", context=context)

rule = IERule(name="explorer")
gfilter.run_on(rule)
grammar.add_rule(rule)
grammar.load()