Beispiel #1
0
    def load(self, fresh=False):
        """Load dotfile values from disk if the file has changed since last m_time.
        If fresh is true, any existing values will be discarded."""
        user_values = None

        if path.exists(self.dotfile):
            m_time = os.stat(self.dotfile).st_mtime
            if m_time > self.m_time:
                user_values = load(self.dotfile)
                self.m_time = m_time

        if fresh:
            self.values.clear()

            if (self.use_defaults or user_values is None) and path.exists(self.defaultfile):
                self.values = load(self.defaultfile)

        if user_values is not None:
            self.values = merge(self.values, user_values, merge_new_keys=(not self.use_defaults))
Beispiel #2
0
def load_themes():
    global themes

    themes.clear()
    themelist = []

    for root, dirs, files in os.walk(path.join(installpath, 'themes')):
        for filename in files:
            f, ext = path.splitext(filename)
            if ext == '.css':
                themelist.append((f, path.join(root, filename)))

    for root, dirs, files in os.walk(path.join(userpath, 'themes')):
        for filename in files:
            f, ext = path.splitext(filename)
            if ext == '.css':
                themelist.append((f, path.join(root, filename)))

    for id, filepath in themelist:
        metadata, source = load(filepath, supplement=True)
        themes[id] = Theme(id, metadata, source)

    return True