예제 #1
0
def load_config(config_path):
    global abbreviation_map
    abbreviation_map = parse_file(
        os.path.join(config_path, "abbreviations.json"))["abbreviations"]
    global special_words
    special_words = parse_file(os.path.join(config_path, "special_words.json"),
                               default_special_words)["special_words"]
예제 #2
0
def load_config(config_path):
    monitors_file = os.path.join(config_path, "monitors.json")
    for key, value in parse_file(
            monitors_file, default_monitors_file)["monitor_names"].iteritems():
        monitor_names[key] = monitors[value]

    for i, m in enumerate(monitors):
        monitor_names[str(i + 1)] = m
예제 #3
0
def load_file(command_file):
    command = parse_file(command_file)
    if "configurations" not in command:
        default_configuration = {"name": "default", "args": None, "params": []}
        command["configurations"] = [default_configuration]
    else:
        for configuration in command["configurations"]:
            if "args" not in configuration:
                configuration["args"] = None
            if "params" not in configuration:
                configuration["params"] = []
            else:
                for parameter in configuration["params"]:
                    if "required" not in parameter:
                        parameter["required"] = False
                    if "default" not in parameter:
                        parameter["default"] = None
    data.append(command)
예제 #4
0
def load_config(config_path):
    global icon_indices
    icons = parse_file(os.path.join(config_path, "icons.json"),
                       default_configuration)["icons"]
    for index, name in enumerate(icons):
        icon_indices[name] = index
예제 #5
0
def load_config(config_path):
    global programs
    programs_list = parse_file(os.path.join(config_path, "programs.json"),
                               default_configuration)["programs"]
    for program in programs_list:
        programs[program["name"]] = program["path"]