[flatpak] sorting packages before updating

This commit is contained in:
Vinícius Moreira
2020-02-06 19:40:14 -03:00
parent 44ad20f613
commit ecd936c6fd
9 changed files with 171 additions and 21 deletions

View File

@@ -438,9 +438,13 @@ class GenericSoftwareManager(SoftwareManager):
if by_manager:
for man, pkgs in by_manager.items():
ti = time.time()
sorted_list.extend(man.sort_update_order(pkgs))
tf = time.time()
self.logger.info(man.__class__.__name__ + " took {0:.2f} seconds".format(tf - ti))
if len(pkgs) > 1:
ti = time.time()
sorted_list.extend(man.sort_update_order(pkgs))
tf = time.time()
self.logger.info(man.__class__.__name__ + " took {0:.2f} seconds".format(tf - ti))
else:
self.logger.info("Only one package to sort for {}. Ignoring sorting.".format(man.__class__.__name__))
sorted_list.extend(pkgs)
return sorted_list

View File

@@ -108,7 +108,7 @@ class UpdateSelectedApps(AsyncAction):
sorted_pkgs = self.manager.sort_update_order([view.model for view in self.apps_to_update])
for pkg in sorted_pkgs:
self.change_substatus('')
name = pkg.name if not RE_VERSION_IN_NAME.findall(pkg.name) else pkg.name.split('version')[0].strip()
self.change_status('{} {} {}...'.format(self.i18n['manage_window.status.upgrading'], name, pkg.version))