Ejemplo n.º 1
0
def quote():
    e, text = context.read_selected_without_altering_clipboard(False)
    if text:
        Text("``" + text + "\'\'").execute()
    else:
        Text("``\'\'").execute()
        Key("left:2").execute()
Ejemplo n.º 2
0
class PythonNon(MappingRule):
    mapping = {
        "try catch":
        R(Text("try:") + Key("enter:2/10, backspace") +
          Text("except Exception:") + Key("enter"),
          rdescript="Python: Try Catch"),
    }
Ejemplo n.º 3
0
class PrologNon(MappingRule):
    mapping = {
        "Rule":
        R(Text("() :-.") + Key("left/6"), rdescript="Prolog: rule"),
        SymbolSpecs.IF:
        R(Text("( ") + Key("enter") + Text(";") + Key("enter") + Text(")"),
          rdescript="Prolog: IF"),
    }
Ejemplo n.º 4
0
def misc(misc_lyx_commands):
    if type(misc_lyx_commands) in [str, int]:
        Text(misc_lyx_commands).execute()
    elif type(misc_lyx_commands) in [list, tuple]:
        for i in range(len(misc_lyx_commands)):
            if i % 2 == 0:
                Text(misc_lyx_commands[i]).execute()
            else:
                Key(misc_lyx_commands[i]).execute()
Ejemplo n.º 5
0
def insert(element):
    if type(element) in [str, int]:
        Text(element).execute()
    elif type(element) in [list, tuple]:
        for i in range(len(element)):
            if i % 2 == 0:
                Text(element[i]).execute()
            else:
                Key(element[i]).execute()
Ejemplo n.º 6
0
class GitterRule(MergeRule):
    pronunciation = "Gitter"

    mapping = {
        "bold":
        R(Text("****") + Key("left:2"), rdescript="Gitter: Bold"),
        "emphasize":
        R(Text("**") + Key("left"), rdescript="Gitter: Italicize"),
        # "header":           R(Text( "" ), rdescript="Gitter: Header"), # H1 ## H2 ### H3
        "insert item":
        R(Text("* "), rdescript="Gitter: Insert Item"),
        "block quote":
        R(Text("> "), rdescript="Gitter: Block Quote"),
        "mention":
        R(Text("@"), rdescript="Gitter: Mention"),
        "insert link":
        R(Text("[]()") + Key("left:3"), rdescript="Gitter: Insert Link"),
        "insert image":
        R(Text("![]()") + Key("left:3"), rdescript="Gitter: Insert Image"),
        "insert code":
        R(Text("``") + Key("left"), rdescript="Gitter: Insert Code"),
        "formatted code":
        R(Text("```") + Key("s-enter"), rdescript="Gitter: Formatted Code"),
    }
    extras = [
        Dictation("text"),
    ]
    Defaults = {}
Ejemplo n.º 7
0
class PythonNon(MappingRule):
    mapping = {
        "with":
        R(Text("with "), rdescript="Python: With"),
        "open file":
        R(Text("open('filename','r') as f:"), rdescript="Python: Open File"),
        "read lines":
        R(Text("content = f.readlines()"), rdescript="Python: Read Lines"),
        "try catch":
        R(Text("try:") + Key("enter:2/10, backspace") +
          Text("except Exception:") + Key("enter"),
          rdescript="Python: Try Catch"),
    }
Ejemplo n.º 8
0
def letters(big, dict1, dict2, letter):
    '''used with alphabet.txt'''
    d1 = str(dict1)
    if d1 != "":
        Text(d1).execute()
    if big:
        Key("shift:down").execute()
    letter.execute()
    if big:
        Key("shift:up").execute()
    d2 = str(dict2)
    if d2 != "":
        Text(d2).execute()
Ejemplo n.º 9
0
class fmanRule(MergeRule):
    pronunciation = "F man"

    mapping = {
        "select all": R(Key("c-a")),
        "copy": R(Key("f5")),
        "deselect": R(Key("c-d")),
        "edit": R(Key("f4")),
        "end": R(Key("end")),
        "explorer": R(Key("f10")),
        "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 external": R(Key("c-p") + Pause("15") + Text("e") + 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 | add) 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 path": R(Key("f11")),
        "terminal": R(Key("f9")),
        "command pallette": R(Key("cs-p")),
    }

    extras = [
        IntegerRefST("num", 1, 4),
        Choice(
            "fav", {
                "advent": "adv",
                "(docks | documents)": "docs",
                "(downs | download)": "downs",
                "git caster": "gcast",
                "mike": "mike",
                "user caster": "ucast",
                "uni [work]": "uni",
            }),
    ]
    defaults = {
        "num": 1,
    }
Ejemplo n.º 10
0
def ACP(command, label=None):
    """Utilize the Palette UI to execute commands."""
    if not label:
        label = "Atom: Unlabeled Palette Command: " + command
    return R(Key("cs-p") + Pause(str(atom_palette_wait)) + Text(command) +
             Key("enter"),
             rdescript=label)
Ejemplo n.º 11
0
    def __init__(self, num_choice_500s, num_specs):

        mapping = {}
        extras = []
        defaults = {}

        w500 = get_500_words()
        spec_base = ""
        text_base = ""

        for k in range(0, num_choice_500s):
            extra_name = "giant_" + str(k)
            spec_base += " <" + extra_name + ">"
            text_base += " %(" + extra_name + ")s"
            extras.append(get_giant_choice(extra_name))

        for i in range(0, num_specs):
            word = w500[i]
            mapping[word + spec_base] = R(Text(word + text_base), show=False)

        MergeRule.__init__(self,
                           name="complexity test",
                           mapping=mapping,
                           extras=extras,
                           defaults=defaults)
Ejemplo n.º 12
0
class EclipseCCR(MergeRule):
    pronunciation = "eclipse jump"

    mwith = [Navigation().get_pronunciation()]

    mapping = {
            #Line Ops
            "configure":                                R(Paste(ec_con.analysis_chars)+Key("left:2/5, c-f/20, backslash, rbracket, enter") + \
                                                          Function(ec_con.analyze_for_configure), rdescript="Eclipse: Configure"),
            "jump in [<n>]":                            R(Key("c-f, a-o")+Paste(r"[\(\[\{\<]")+Function(ec_con.regex_on)+ \
                                                          Key("enter:%(n)d/5, escape, right") , rdescript="Eclipse: Jump In"),
            "jump out [<n>]":                           R(Key("c-f, a-o")+Paste(r"[\)\] \}\>]")+Function(ec_con.regex_on)+ \
                                                          Key("enter:%(n)d/5, escape, right") , rdescript="Eclipse: Jump Out"),
            "jump back [<n>]":                          R(Key("c-f/5, a-b")+Paste(r"[\)\]\}\>]")+Function(ec_con.regex_on)+ \
                                                          Key("enter:%(n)d/5, escape, left") , rdescript="Eclipse: Jump Back"),
            "[go to] line <n>":                         R(Key("c-l") + Pause("50") + Text("%(n)d") + Key("enter")+ Pause("50"),
                                                          rdescript="Eclipse: Go To Line"),
            "shackle <n> [<back>]":                     R(Key("c-l")+Key("right, cs-left")+ \
                                                          Function(ec_con.lines_relative), rdescript="Eclipse: Select Relative Lines"),

        }
    extras = [
        Dictation("text"),
        IntegerRefST("n", 1, 1000),
        Boolean("back"),
    ]
    defaults = {"n": 1, "back": False}
Ejemplo n.º 13
0
def next_line(semi):
    semi = str(semi)
    Key("escape").execute()
    time.sleep(0.25)
    Key("end").execute()
    time.sleep(0.25)
    Text(semi).execute()
    Key("enter").execute()
Ejemplo n.º 14
0
def findNthToken(text, n, direction):
    Key("c-f").execute()
    Text("%(text)s").execute({"text": text})
    if direction == "reverse":
        print("yeah? %(n)d")
        Key("s-enter:%(n)d").execute()
    else:
        Key("enter:%(n)d").execute()
        print("no? %(n)d")
    Key('escape').execute()
Ejemplo n.º 15
0
def insert(element):
    if type(element) is str:
        n_markers = 0
        to_enter = element
    else:
        n_markers = element[1]
        to_enter = element[0]
    Text(to_enter).execute()
    for _ in range(n_markers):
        Key("s-f4").execute()
Ejemplo n.º 16
0
class fmanRule(MergeRule):
    pronunciation = "F man"

    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 = [
        IntegerRefST("num", 1, 4),
        Choice("fav", {
            "example favourite": "ef",
        }),
    ]
    defaults = {
        "num": 1,
    }
Ejemplo n.º 17
0
class RStudioRule(MergeRule):
    pronunciation = "are studio"

    mapping = {
    "new file":
        R(Key("cs-n"), rdescript="RStudio: New File"),
    "open file":
        R(Key("c-o"), rdescript="RStudio: Open File"),
    "open recent project":
        R(Key("a-f, j"), rdescript="RStudio: Open Recent Project"),
  	"open project":
        R(Key("a-f, n, enter"), rdescript="RStudio: Open Project"),
    "save all":
        R(Key("ac-s"), rdescript="RStudio: Save All"),
    "select all":
        R(Key("c-a"), rdescript="RStudio: Select All"),
    "find":
        R(Key("c-f"), rdescript="RStudio: Find"),

    "[go to] line <n>":
        R(Key("as-g") + Pause("10") + Text("%(n)s") + Key("enter"),
          rdescript="RStudio: Go to Line #"),
    "focus console":
        R(Key("c-2"), rdescript="RStudio: Focus Console"),
    "focus main":
        R(Key("c-1"), rdescript="RStudio: Focus Main"),

    "next tab":
        R(Key("c-f12"), rdescript="RStudio: Next Tab"),
    "first tab":
        R(Key("cs-f11"), rdescript="RStudio: First Tab"),
    "previous tab":
        R(Key("c-f11"), rdescript="RStudio: Previous Tab"),
    "last tab":
        R(Key("cs-f12"), rdescript="RStudio: Last Tab"),
    "close tab":
        R(Key("c-w"), rdescript="RStudio: Close Tab"),


    "run line":
        R(Key("c-enter"), rdescript="RStudio: Run Line"),
    "run document":
        R(Key("ac-r"), rdescript="RStudio: Run Document"),
    "comment (line | selected)":
        R(Key("cs-c"), rdescript="RStudio: Comment Line"),

    "next plot":
        R(Key("ac-f12"), rdescript="RStudio: Next Plot"),
    "previous plot":
        R(Key("ac-f11"), rdescript="RStudio: Previous Plot"),
    }
    extras = [
        IntegerRefST("n", 1, 10000),
    ]
    defaults = {}
Ejemplo n.º 18
0
class JavaNon(MappingRule):
    mapping = {
        "try catch":
        R(Text("try{}catch(Exception e){}"), rdescript="Java: Try Catch"),
        "deco override":
        R(Text("@Override"), rdescript="Java: Override Decorator"),
        "iterate and remove":
        R(Paste(
            "for (Iterator<TOKEN> iterator = TOKEN.iterator(); iterator.hasNext();) {\n\tString string = iterator.next();\nif (CONDITION) {\niterator.remove();\n}\n}"
        ),
          rdescript="Java: Iterate And Remove"),
        "string builder":
        R(Paste(
            "StringBuilder builder = new StringBuilder(); builder.append(orgStr); builder.deleteCharAt(orgStr.length()-1);"
        ),
          rdescript="Java: String Builder"),
    }

    ncextras = []
    ncdefaults = {}
Ejemplo n.º 19
0
class lyx_mathematics(MergeRule):
    pronunciation = "licks maths"

    mapping = {
        BINDINGS["symbol1_prefix"] + " <symbol1>":
        Text("\\%(symbol1)s "),
        BINDINGS["symbol2_prefix"] + " <symbol2>":
        Text("\\%(symbol2)s "),
        BINDINGS["text_prefix"] + " <text_modes>":
        Text("\\%(text_modes)s "),
        BINDINGS["greek_prefix"] + " [<big>] <greek_letter>":
        Function(greek),
        BINDINGS["number_prefix"] + " <numbers>":
        Text("%(numbers)s"),
        "<misc_lyx_keys>":
        Key("%(misc_lyx_keys)s"),
        "<misc_lyx_commands>":
        Function(misc),
        "matrix <rows> by <cols>":
        Function(matrix),
        "<numbers> <denominator>":
        Key("a-m, f, %(n1)s, down, %(denominator)s, right"),
    }

    extras = [
        IntegerRefST("rows", 1, 10),
        IntegerRefST("cols", 1, 10),
        IntegerRefST("numbers", 0, 500),
        Choice("big", {BINDINGS["capitals_prefix"]: True}),
        Choice("greek_letter", BINDINGS["greek_letters"]),
        Choice("symbol1", BINDINGS["tex_symbols1"]),
        Choice("symbol2", BINDINGS["tex_symbols2"]),
        Choice("text_modes", BINDINGS["text_modes"]),
        Choice("misc_lyx_keys", BINDINGS["misc_lyx_keys"]),
        Choice("misc_lyx_commands", BINDINGS["misc_lyx_commands"]),
        Choice("denominator", BINDINGS["denominators"]),
    ]

    defaults = {
        BINDINGS["capitals_prefix"]: False,
    }
Ejemplo n.º 20
0
def begin_end(environment):
    if type(environment) in [str, unicode]:
        back_curl("begin", environment).execute()
        Key("enter:2").execute()
        back_curl("end", environment).execute()
        Key("up").execute()
    elif type(environment) in [tuple, list]:
        back_curl("begin", environment[0]).execute()
        Text(environment[1]).execute()
        Key("enter:2").execute()
        back_curl("end", environment[0]).execute()
        Key("up").execute()
Ejemplo n.º 21
0
class Prolog(MergeRule):
    pronunciation = "prolog"

    non = PrologNon

    mapping = {
        "implies": R(Text(":-"), rdescript="Prolog: Select"),
        "comment": R(Text("%"), rdescript="Prolog: Line Comment"),
        "Open Block comment": R(Text("/* "), rdescript="Prolog: Line Comment"),
        "Close Block comment": R(Text("*\ "), rdescript="Prolog: Line Comment"),
        "Anonymous": R(Text("_"), rdescript="Prolog: Anonymous"),
        "Not": R(Text("\+"), rdescript="Prolog: Not"),
        "cut": R(Text("!"), rdescript="Prolog: cut "),
        "Or": R(Text(";"), rdescript="Prolog: Or"),
        "Fail": R(Text("Fail"), rdescript="Prolog: Fail")
    }

    extras = []
    defaults = {}
Ejemplo n.º 22
0
class RStudioRule(MergeRule):
    pronunciation = "are studio"

    mapping = {
        "new file":
        R(Key("cs-n"), rdescript="RStudio: New File"),
        "open file":
        R(Key("c-o"), rdescript="RStudio: Open File"),
        "save all":
        R(Key("ac-s"), rdescript="RStudio: Save All"),
        "select all":
        R(Key("c-a"), rdescript="RStudio: Select All"),
        "find":
        R(Key("c-f"), rdescript="RStudio: Find"),
        "[go to] line <n>":
        R(Key("as-g") + Pause("10") + Text("%(n)s") + Key("enter"),
          rdescript="RStudio: Go to Line #"),
        "focus console":
        R(Key("c-2"), rdescript="RStudio: Focus Console"),
        "focus main":
        R(Key("c-1"), rdescript="RStudio: Focus Main"),
        "next pane":
        R(Key("c-f12"), rdescript="RStudio: Next pane"),
        "first pane":
        R(Key("cs-f11"), rdescript="RStudio: First pane"),
        "previous pane":
        R(Key("c-f11"), rdescript="RStudio: Previous pane"),
        "last pane":
        R(Key("cs-f12"), rdescript="RStudio: Last pane"),
        "close pane":
        R(Key("c-w"), rdescript="RStudio: Close pane"),
        "run (line | that)":
        R(Key("c-enter"), rdescript="RStudio: Run Line"),
        "run document":
        R(Key("ac-r"), rdescript="RStudio: Run Document"),
        "comment (line | selected)":
        R(Key("cs-c"), rdescript="RStudio: Comment Line"),
        "knit (document | file)":
        R(Key("cs-k")),
        "next plot":
        R(Key("ac-f12"), rdescript="RStudio: Next Plot"),
        "previous plot":
        R(Key("ac-f11"), rdescript="RStudio: Previous Plot"),
        "help":
        R(Key("c-c, c-2, question, c-v, enter, c-1")),
    }
    extras = [
        IntegerRefST("n", 1, 10000),
    ]
    defaults = {}
Ejemplo n.º 23
0
def word_number(wn):
    numbers_to_words = {
        0: "zero",
        1: "one",
        2: "two",
        3: "three",
        4: "four",
        5: "five",
        6: "six",
        7: "seven",
        8: "eight",
        9: "nine"
    }
    Text(numbers_to_words[int(wn)]).execute()
Ejemplo n.º 24
0
class FlashDevelopCCR(MergeRule):
    pronunciation = "flash develop test"
    mwith = [Navigation().get_pronunciation()]

    mapping = {
        "[go to] line <n>":
        R(Key("c-g") + Pause("50") + Text("%(n)d") + Key("enter"),
          rdescript="FlashDevelop: Go To Line"),
    }
    extras = [
        Dictation("text"),
        IntegerRefST("n", 1, 1000),
    ]
    defaults = {"n": 1}
Ejemplo n.º 25
0
class ChromeRule(MergeRule):
    pronunciation = "google chrome"

    mapping = { # most keybinds are taken from https://support.google.com/chrome/answer/157179?hl=en
        "[new] incognito window":       R(Key("cs-n"), rdescript="Browser: New Incognito Window"),
        "new tab [<n>]":                R(Key("c-t"), rdescript="Browser: New Tab") * Repeat(extra="n"),
        "reopen tab [<n>]":             R(Key("cs-t"), rdescript="Browser: Reopen Tab") * Repeat(extra="n"),
        "close all tabs":               R(Key("cs-w"), rdescript="Browser: Close All Tabs"),

        "go back [<n>]":                R(Key("a-left/20"), rdescript="Browser: Navigate History Backward") * Repeat(extra="n"),
        "go forward [<n>]":             R(Key("a-right/20"), rdescript="Browser: Navigate History Forward") * Repeat(extra="n"),
        "zoom in [<n>]":                R(Key("c-plus/20"), rdescript="Browser: Zoom In") * Repeat(extra="n"),
        "zoom out [<n>]":               R(Key("c-minus/20"), rdescript="Browser: Zoom") * Repeat(extra="n"),
        "zoom reset":                   R(Key("c-0"), rdescript="Browser: Reset Zoom"),
        "super refresh":                R(Key("c-f5"), rdescript="Browser: Super Refresh"),
        "switch focus [<n>]":           R(Key("f6/20"), rdescript="Browser: Switch Focus") * Repeat(extra="n"),
        "[find] next match [<n>]":      R(Key("c-g/20"), rdescript="Browser: Next Match") * Repeat(extra="n"),
        "[find] prior match [<n>]":     R(Key("cs-g/20"), rdescript="Browser: Prior Match") * Repeat(extra="n"),
        "[toggle] caret browsing":      R(Key("f7"), rdescript="Browser: Caret Browsing"), # now available through an add on, was a standard feature

        "home page":                    R(Key("a-home"), rdescript="Browser: Home Page"),
        "show history":                 R(Key("c-h"), rdescript="Browser: Show History"),
        "address bar":                  R(Key("c-l"), rdescript="Browser: Address Bar"),
        "show downloads":               R(Key("c-j"), rdescript="Browser: Show Downloads"),
        "[add] bookmark":               R(Key("c-d"), rdescript="Browser: Add Bookmark"),
        "bookmark all tabs":            R(Key("cs-d"), rdescript="Browser: Bookmark All Tabs"),
        "[toggle] bookmark bar":        R(Key("cs-b"), rdescript="Browser: Toggle Bookmark Bar"),
        "show bookmarks":               R(Key("cs-o"), rdescript="Browser: Show Bookmarks"),
        "switch user":                  R(Key("cs-m"), rdescript="Browser: Switch User"),
        "chrome task manager":          R(Key("s-escape"), rdescript="Browser: Chrome Task Manager"),
        "[toggle] full-screen":         R(Key("f11"), rdescript="Browser: Toggle Fullscreen Mode"),
        "focus notification":           R(Key("a-n"), rdescript="Browser: Focus Notification"),
        "allow notification":           R(Key("as-a"), rdescript="Browser: Allow Notification"),
        "deny notification":            R(Key("as-a"), rdescript="Browser: Deny Notification"),

        "developer tools":              R(Key("f12"), rdescript="Browser: Developer Tools"),
        "view [page] source":           R(Key("c-u"), rdescript="Browser: View Page Source"),
        "resume":                       R(Key("f8"), rdescript="Browser: Resume"),
        "step over":                    R(Key("f10"), rdescript="Browser: Step Over"),
        "step into":                    R(Key("f11"), rdescript="Browser: Step Into"),
        "step out":                     R(Key("s-f11"), rdescript="Browser: Step Out"),

        "IRC identify":                 R(Text("/msg NickServ identify PASSWORD"), rdescript="IRC Chat Channel Identify"),
        }
    extras = [
        Dictation("dict"),
        IntegerRefST("n", 1, 10),
    ]
    defaults = {"n": 1, "dict": "nothing"}
Ejemplo n.º 26
0
Archivo: dev.py Proyecto: mrob95/caster
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"),
        IntegerRefST("n2", 1, 100)
    ]
    defaults = {"text": "", "text2": ""}
Ejemplo n.º 27
0
    def lines_relative(self, back, n):
        if back:  #backward
            try:
                num = CONTEXT.read_nmax_tries(10)
                txt = str(int(num) - int(n) + 1)  # +1 to include current line
                Text(txt).execute()
            except ValueError:
                utilities.simple_log()
                return
            Key("enter").execute()
        else:  #forward
            Key("escape, end, home, home").execute(
            )  # end-home-home to include all of current line

        # forward or backward
        Key("s-down:" + str(int(n)) + "/5, s-left").execute()
Ejemplo n.º 28
0
def matrix(blank, rows, cols):
    if blank:
        text = "matrix{"
    else:
        text = "left [ matrix{"
    for i in range(0, rows):
        text += "<?>"
        for _ in range(0, cols - 1):
            text += " # <?>"
        if i != rows - 1:
            text += " ## "
    if blank:
        text += "} <?>"
    else:
        text += "} right ] <?>"
    Text(text).execute()
    for _ in range((rows * cols) + 1):
        Key("s-f4").execute()
Ejemplo n.º 29
0
class CMDRule(MergeRule):
    pronunciation = "command prompt"

    mapping = {
        "C drive": R(Text(r"cd C:/") + Key("enter"), rdescript="CMD: Go To C:"),
        "CD up": R(Text("cd ..") + Key("enter"), rdescript="CMD: Up Directory"),
        "CD": R(Text("cd "), rdescript="CMD: Navigate Directory"),
        "list": R(Text("dir") + Key("enter"), rdescript="CMD: List Files"),
        "make directory": R(Text("mkdir "), rdescript="CMD: Make directory"),
        "exit": R(Text("exit") + Key("enter"), rdescript="CMD: Exit"),
    }
    extras = []
    defaults = {}
Ejemplo n.º 30
0
 def refresh(self, *args):
     aliases = utilities.load_toml_file(
         settings.SETTINGS["paths"]["ALIAS_PATH"])
     if not ChainAlias.toml_path in aliases:
         aliases[ChainAlias.toml_path] = {}
     if len(args) > 0 and args[0] != "":
         aliases[ChainAlias.toml_path][args[0]] = args[1]
         utilities.save_toml_file(aliases,
                                  settings.SETTINGS["paths"]["ALIAS_PATH"])
     mapping = {}
     for spec in aliases[ChainAlias.toml_path]:
         mapping[spec] = R(Text(str(aliases[ChainAlias.toml_path][spec])),
                           rdescript="Chain Alias: " + spec)
     mapping["chain alias [<s>]"] = R(Function(lambda s: self.alias(s)),
                                      rdescript="Create Chainable Alias")
     mapping["delete chain aliases"] = R(
         Function(lambda: delete_all(self, ChainAlias.toml_path)),
         rdescript="Delete Aliases")
     self.reset(mapping)