def loadThemes(self, namespace): loadedThemes = set() if 'Themes' in self.namespaces[namespace]: paths = glob(os.path.join(self.namespaces[namespace]['Themes'], '*.tmTheme')) for path in paths: theme = PMXTheme.loadTheme(path, namespace, self) if theme is not None: loadedThemes.add(theme) return loadedThemes
def reloadThemes(self, namespace): if 'Themes' in self.namespaces[namespace]: installedThemes = filter(lambda theme: theme.hasNamespace(namespace), self.getAllThemes()) themePaths = glob(os.path.join(self.namespaces[namespace]['Themes'], '*.tmTheme')) for theme in installedThemes: themePath = theme.path(namespace) if themePath in themePaths: if namespace == theme.currentNamespace and theme.sourceChanged(namespace): self.logger.debug("Theme %s changed, reload from %s." % (theme.name, themePath)) theme.reloadTheme(theme, themePath, namespace, self) theme.updateMtime(namespace) self.modifyTheme(theme) themePaths.remove(themePath) else: theme.removeSource(namespace) if not theme.hasSources(): self.logger.debug("Theme %s removed." % theme.name) self.removeManagedObject(theme) self.removeTheme(theme) else: theme.setDirty() for path in themePaths: self.logger.debug("New theme %s." % path) PMXTheme.loadTheme(path, namespace, self)