def install(self, sender): for item in self.list.selected: Extension.install_remote(repository=item['repository'], filename=item['filename']) self.list.refresh() self.update_buttons()
def __init__(self, posSize, **kwargs): kwargs.update({ 'editCallback': self.save }) configured = [e for e in Extension.all() if e.is_configured] super(SettingsList, self).__init__(posSize, configured, **kwargs)
def _get_cached(cls): logger.info("Fetching cached updates...") cache = Storage.get('update_cache') extensions = [Extension(name=name) for name, _ in cache.items()] for extension in extensions: if extension.is_installed and extension.is_configured: extension.remote.version = Version(cache[extension.name]) return extensions
def _fetch_updates(cls): logger.info("Fetching updates...") try: updates = [e for e in Extension.all() if e.should_update] except requests.ConnectionError: raise Update.ConnectionError cls._set_cached(updates) Storage.set('last_checked_at', time.time()) return updates
def _wrapItem(self, extension): name = extension[u'filename'].split("/")[-1] search = [] if name: search.append(name.lower()) if extension[u'author']: search.append(extension[u'author'].lower()) if extension[u'description']: search.append(extension[u'description'].lower()) item = { 'is_installed': Extension(name=name).is_installed, 'extension': extension, 'search': ' '.join(search) } return super(InstallationList, self)._wrapItem(item)
def import_extension(self, file): extension = Extension(path=file[0]) if extension.bundle.bundleExists(): self.name.set(extension.bundle.name) self.filename.set(extension.filename) self.repository.set(extension.repository)
def uninstallable(self): filenames = [item['filename'] for item in self.list.selected] names = [filename.split("/")[-1] for filename in filenames] extensions = [Extension(name=name) for name in names] return [ext for ext in extensions if ext.is_installed]