[fix][ui] calling required tasks when '--settings' is specified as a param

This commit is contained in:
Vinicius Moreira
2020-06-11 17:15:20 -03:00
parent ef70ce0864
commit f0c44ab019
4 changed files with 11 additions and 4 deletions

View File

@@ -502,7 +502,7 @@ class ArchManager(SoftwareManager):
self.disk_cache_updater.join()
self.logger.info("Disk cache ready")
def read_installed(self, disk_loader: DiskCacheLoader, limit: int = -1, only_apps: bool = False, pkg_types: Set[Type[SoftwarePackage]] = None, internet_available: bool = None, names: Iterable[str] = None) -> SearchResult:
def read_installed(self, disk_loader: DiskCacheLoader, limit: int = -1, only_apps: bool = False, pkg_types: Set[Type[SoftwarePackage]] = None, internet_available: bool = None, names: Iterable[str] = None, wait_disk_cache: bool = True) -> SearchResult:
self.aur_client.clean_caches()
arch_config = read_config()
@@ -532,7 +532,8 @@ class ArchManager(SoftwareManager):
pkgs = []
if repo_pkgs or aur_pkgs:
self._wait_for_disk_cache()
if wait_disk_cache:
self._wait_for_disk_cache()
map_threads = []

View File

@@ -124,7 +124,8 @@ class ArchDiskCacheUpdater(Thread):
self.logger.info('Pre-caching installed Arch packages data to disk')
installed = self.controller.read_installed(disk_loader=None, internet_available=self.internet_available,
only_apps=False, pkg_types=None, limit=-1, names=not_cached_names).installed
only_apps=False, pkg_types=None, limit=-1, names=not_cached_names,
wait_disk_cache=False).installed
self.task_man.update_progress(self.task_id, 0, self.i18n['arch.task.disk_cache.reading'])

View File

@@ -52,7 +52,7 @@ def new_manage_panel(app_args: Namespace, app_config: dict, logger: logging.Logg
app = new_qt_application(app_config, quit_on_last_closed=True)
if app_args.settings: # only settings window
manager.prepare(None, None, None) # only checks the available managers
manager.cache_available_managers()
return app, SettingsWindow(manager=manager, i18n=i18n, screen_size=app.primaryScreen().size(), window=None)
else:
manage_window = ManageWindow(i18n=i18n,

View File

@@ -366,6 +366,11 @@ class GenericSoftwareManager(SoftwareManager):
man.prepare(taskman, root_password, internet_on)
self._already_prepared.append(man)
def cache_available_managers(self):
if self.managers:
for man in self.managers:
self._can_work(man)
def list_updates(self, internet_available: bool = None) -> List[PackageUpdate]:
self._wait_to_be_ready()