Example #1
0
def reset(overwrite=False, ignore_initial=False):
    # Automatically load presets
    global _presets

    _presets = {}

    load_path = utils.get_write_path("presets")
    if ignore_initial or not os.path.exists(
            os.path.join(load_path, ".initial_complete")):
        # Do initial population of presets from system install / cwd
        if not os.path.exists(load_path):
            os.makedirs(load_path)

        # Write file to say we have done this
        open(os.path.join(load_path, ".initial_complete"), "w").close()

        # Copy actual files
        search_paths = utils.get_search_paths()
        if overwrite:
            # Reverse search paths because things will get overwritten
            search_paths = reversed(search_paths)

        for path in search_paths:
            full = os.path.join(path, "presets")
            if full != load_path and os.path.exists(full):
                for f in os.listdir(full):
                    # Do not overwrite existing files
                    if overwrite or not os.path.exists(
                            os.path.join(load_path, f)):
                        shutil.copy2(os.path.join(full, f), load_path)

    load_directory(load_path)
Example #2
0
def reset(overwrite=False, ignore_initial=False):
    # Automatically load presets
    global _presets
    
    _presets = {}
    
    load_path = utils.get_write_path("presets")
    if ignore_initial or not os.path.exists(os.path.join(load_path, ".initial_complete")):
        # Do initial population of presets from system install / cwd
        if not os.path.exists(load_path):
            os.makedirs(load_path)
            
        # Write file to say we have done this
        open(os.path.join(load_path, ".initial_complete"), "w").close()
        
        # Copy actual files
        for path in utils.get_search_paths():
            full = os.path.join(path, "presets")
            if full != load_path and os.path.exists(full):
                for f in os.listdir(full):
                    # Do not overwrite existing files
                    if overwrite or not os.path.exists(os.path.join(load_path, f)):
                        shutil.copy2(os.path.join(full, f), load_path)
    
    load_directory(load_path)
Example #3
0
def reset():
    # Automatically load presets - system, home, current path
    global _presets
    
    _presets = {}
    
    for path in reversed(utils.get_search_paths()):
        full = os.path.join(path, "presets")
        if os.path.exists(full):
            load_directory(full)
Example #4
0
def reset(overwrite=False, ignore_initial=False):
    # Automatically load presets
    global _presets

    _presets = {}

    load_path = utils.get_write_path("presets")
    if ignore_initial or not os.path.exists(os.path.join(load_path, ".initial_complete")):
        # Do initial population of presets from system install / cwd
        if not os.path.exists(load_path):
            os.makedirs(load_path)

        # Write file to say we have done this
        open(os.path.join(load_path, ".initial_complete"), "w").close()

        # Copy actual files
        search_paths = utils.get_search_paths()
        if overwrite:
            # Reverse search paths because things will get overwritten
            search_paths = reversed(search_paths)

        print [path for path in search_paths]
Example #5
0
        _log.warning(_("There was a problem accessing %(location)spresets.txt!") % {
            "location": location,
        })
    
    return updates

def check_and_install_updates(location = UPDATE_LOCATION):
    """
        Check for and install updated presets from a central server. This is
        equivalent to calling install_preset with each tuple returned from
        check_for_updates.
        
        @type location: str
        @param location: The directory where presets.txt and all preset files
                         can be found on the server
    """
    updates = check_for_updates(location)
    
    if updates:
        for loc, name in updates:
            install_preset(loc, name)
    else:
        _log.debug(_("All device presets are up to date!"))

# Automatically load presets - system, home, current path
for path in reversed(utils.get_search_paths()):
    full = os.path.join(path, "profiles")
    if os.path.exists(full):
        load_directory(full)

Example #6
0
                "location": location,
            })

    return updates


def check_and_install_updates(location=UPDATE_LOCATION):
    """
        Check for and install updated presets from a central server. This is
        equivalent to calling install_preset with each tuple returned from
        check_for_updates.
        
        @type location: str
        @param location: The directory where presets.txt and all preset files
                         can be found on the server
    """
    updates = check_for_updates(location)

    if updates:
        for loc, name in updates:
            install_preset(loc, name)
    else:
        _log.debug(_("All device presets are up to date!"))


# Automatically load presets - system, home, current path
for path in reversed(utils.get_search_paths()):
    full = os.path.join(path, "profiles")
    if os.path.exists(full):
        load_directory(full)