[improvement][ui] sorting installed packages by their names

This commit is contained in:
Vinicius Moreira
2020-06-21 15:38:55 -03:00
parent 2542087494
commit e852224637
3 changed files with 9 additions and 2 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
env
venv
*.pyc
.idea
__pycache__
@@ -6,4 +7,4 @@ __pycache__
dist
*.egg-info
build
*.db
*.db

View File

@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- not performing a full table refresh after installing and uninstalling packages
- filters algorithm speed and sorting
- displaying wait cursor over some components
- sorting installed packages by their names
### Fixes
- AppImage

View File

@@ -1,4 +1,4 @@
import re
import operator
import re
import time
import traceback
@@ -200,6 +200,9 @@ class GenericSoftwareManager(SoftwareManager):
def can_work(self) -> bool:
return True
def _get_package_lower_name(self, pkg: SoftwarePackage):
return pkg.name.lower()
def read_installed(self, disk_loader: DiskCacheLoader = None, limit: int = -1, only_apps: bool = False, pkg_types: Set[Type[SoftwarePackage]] = None, internet_available: bool = None) -> SearchResult:
ti = time.time()
self._wait_to_be_ready()
@@ -254,6 +257,8 @@ class GenericSoftwareManager(SoftwareManager):
elif 'updates_ignored' not in p.categories:
p.categories.append('updates_ignored')
res.installed.sort(key=self._get_package_lower_name)
tf = time.time()
self.logger.info('Took {0:.2f} seconds'.format(tf - ti))
return res