Exemplo n.º 1
0
def addAlias(dictation):
    alias_name = str(dictation)
    alias_value = utils.getSelectedText()
    if not alias_value or alias_value == "":
        raise StandardError(
            "No value for \"alias_value\".  Select some text to alias.")
    file_path = "C:\\NatLink\\NatLink\\MacroSystem\\_aliases.py"
    lines = []
    with open(file_path, 'r') as aliases:
        lines = aliases.readlines()
    with open(file_path, 'w') as aliases:
        started_mapping = False
        done_adding = False
        for line in lines:
            if done_adding:
                aliases.write(line)
                continue
            if not started_mapping:
                aliases.write(line)
                if line.find("mapping = {") != -1:
                    started_mapping = True
                    continue
            if started_mapping and not done_adding:
                if line.find("}") != -1:
                    aliases.write("        \"" + alias_name + "\": Text(\"" +
                                  alias_value + "\"),\n")
                    aliases.write(line)
                    done_adding = True
                else:
                    aliases.write(line)
    utils.toggleMicrophone()
Exemplo n.º 2
0
def reloadAll():
    print "Reloading everything in the Macrosystem directory..."
    user_directory_files = [
        f for f in os.listdir(MACROSYSTEM_DIRECTORY) if f.endswith('.py')
    ]
    for the_file in user_directory_files:
        utils.touch(MACROSYSTEM_DIRECTORY + "\\" + the_file)
    utils.toggleMicrophone()
Exemplo n.º 3
0
def languageReloader():
    print "Reloading languages..."
    # Why doesn't this work?
    # modified_modules = modified(MACROSYSTEM_DIRECTORY + "\\languages")
    # for mod in modified_modules:
    #     reimport(mod)
    reimport(specs)
    reimport(python_rule, java_rule)
    utils.touch(MACROSYSTEM_DIRECTORY + "\\_language_switcher.py")
    utils.toggleMicrophone()
Exemplo n.º 4
0
def languageReloader():
    print "Reloading languages..."
    # Why doesn't this work?
    # modified_modules = modified(MACROSYSTEM_DIRECTORY + "\\languages")
    # for mod in modified_modules:
    #     reimport(mod)
    reimport(specs)
    reimport(python_rule, java_rule, yaml_rule)
    utils.touch(MACROSYSTEM_DIRECTORY + "\\_language_switcher.py")
    utils.toggleMicrophone()
Exemplo n.º 5
0
def ccrReloader():
    print "Reloading CCR..."
    reimport(editing_commands, text_formatting, scan_line, window_control)
    try:  # putstringcommands is not included in the pushed source, because it contains personal data.
        if putstringcommands:
            reimport(putstringcommands)
    except NameError:
        pass

    utils.touch(MACROSYSTEM_DIRECTORY + "\\_global_continuous_recognition.py")
    utils.toggleMicrophone()
Exemplo n.º 6
0
def extras_rebuilder():
    print "Rebuilding extras..."
    for rebuild_me in rebuild_these:
        print(rebuild_me)
        reimport(rebuild_me)
    utils.toggleMicrophone()
Exemplo n.º 7
0
def reloadAll():
    print "Reloading everything in the Macrosystem directory..."
    user_directory_files = [f for f in os.listdir(MACROSYSTEM_DIRECTORY) if f.endswith('.py')]
    for file in user_directory_files:
        utils.touch(MACROSYSTEM_DIRECTORY + "\\" + file)
    utils.toggleMicrophone()
Exemplo n.º 8
0
def utilsReloader():
    print "Reloading utils..."
    reimport(utils)
    utils.toggleMicrophone()
Exemplo n.º 9
0
def characterReloader():
    print "Reloading character..."
    reimport(character)
    utils.toggleMicrophone()
Exemplo n.º 10
0
def utilsReloader():
    print "Reloading utils..."
    reimport(utils)
    utils.toggleMicrophone()
Exemplo n.º 11
0
def characterReloader():
    print "Reloading character..."
    reimport(character)
    utils.toggleMicrophone()