[fix][ui] not calling initial required tasks after enabling a new package type on settings

This commit is contained in:
Vinicius Moreira
2020-06-11 11:25:37 -03:00
parent c44914d747
commit cc5c89a350
4 changed files with 15 additions and 7 deletions

View File

@@ -17,9 +17,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Web
- handling unexpected connection errors
- handling web page fetch errors
- not able to search apps by their names after being enabled on settings
- UI
- displaying empty categories
- not scrolling the table to top after updating its content
- not calling initial required tasks after enabling a new package type on settings
- minor fixes
## [0.9.5] 2020-06-07

View File

@@ -139,7 +139,7 @@ class SnapManager(SoftwareManager):
return ProcessHandler(watcher).handle(SystemProcess(subproc=snap.downgrade_and_stream(pkg.name, root_password), wrong_error_phrase=None))
def upgrade(self, requirements: UpgradeRequirements, root_password: str, watcher: ProcessWatcher) -> SystemProcess:
raise Exception("'update' is not supported by {}".format(pkg.__class__.__name__))
raise Exception("'upgrade' is not supported by {}".format(SnapManager.__class__.__name__))
def uninstall(self, pkg: SnapApplication, root_password: str, watcher: ProcessWatcher) -> bool:
uninstalled = ProcessHandler(watcher).handle(SystemProcess(subproc=snap.uninstall_and_stream(pkg.name, root_password)))
@@ -229,12 +229,14 @@ class SnapManager(SoftwareManager):
return ProcessHandler(watcher).handle(SystemProcess(subproc=snap.refresh_and_stream(pkg.name, root_password)))
def _start_category_task(self, task_man: TaskManager):
task_man.register_task('snap_cats', self.i18n['task.download_categories'].format('Snap'), get_icon_path())
task_man.update_progress('snap_cats', 50, None)
if task_man:
task_man.register_task('snap_cats', self.i18n['task.download_categories'].format('Snap'), get_icon_path())
task_man.update_progress('snap_cats', 50, None)
def _finish_category_task(self, task_man: TaskManager):
task_man.update_progress('snap_cats', 100, None)
task_man.finish_task('snap_cats')
if task_man:
task_man.update_progress('snap_cats', 100, None)
task_man.finish_task('snap_cats')
def prepare(self, task_manager: TaskManager, root_password: str, internet_available: bool):
CategoriesDownloader(id_='snap', manager=self, http_client=self.http_client, logger=self.logger,

View File

@@ -251,6 +251,10 @@ class WebApplicationManager(SoftwareManager):
index = self._read_search_index()
if not index and self.suggestions_downloader and self.suggestions_downloader.is_alive():
self.suggestions_downloader.join()
index = self._read_search_index()
if index:
split_words = lower_words.split(' ')
singleword = ''.join(lower_words)

View File

@@ -356,10 +356,10 @@ class GenericSoftwareManager(SoftwareManager):
def prepare(self, task_manager: TaskManager, root_password: str, internet_available: bool):
if self.managers:
internet_on = internet.is_available()
taskman = task_manager if task_manager else TaskManager() # empty task manager to prevent null pointers
for man in self.managers:
if man not in self._already_prepared and self._can_work(man):
if task_manager:
man.prepare(task_manager, root_password, internet_on)
man.prepare(taskman, root_password, internet_on)
self._already_prepared.append(man)
def list_updates(self, internet_available: bool = None) -> List[PackageUpdate]: