[fix][ui] not updating cached installed packages state after ignoring/reverting updates

This commit is contained in:
Vinícius Moreira
2020-05-28 17:09:57 -03:00
parent 9b483b9b6c
commit a2e41ce51f
9 changed files with 32 additions and 2 deletions

View File

@@ -114,3 +114,7 @@ class AppImage(SoftwarePackage):
def is_update_ignored(self) -> bool:
return self.updates_ignored
def __eq__(self, other):
if isinstance(other, AppImage):
return self.local_file_path == other.local_file_path

View File

@@ -145,3 +145,7 @@ class ArchPackage(SoftwarePackage):
def __repr__(self):
return '{} (name={}, command={}, icon_path={})'.format(self.__class__.__name__, self.name, self.command, self.icon_path)
def __eq__(self, other):
if isinstance(other, ArchPackage):
return self.name == other.name and self.repository == other.repository

View File

@@ -116,3 +116,7 @@ class FlatpakApplication(SoftwarePackage):
def get_update_ignore_key(self) -> str:
return '{}:{}:{}'.format(self.installation, self.id, self.branch)
def __eq__(self, other):
if isinstance(other, FlatpakApplication):
return self.id == other.id and self.installation == other.installation and self.branch == other.branch

View File

@@ -78,3 +78,7 @@ class SnapApplication(SoftwarePackage):
def supports_backup(self) -> bool:
return True
def __eq__(self, other):
if isinstance(other, SnapApplication):
return self.name == other.name

View File

@@ -148,3 +148,7 @@ class WebApplication(SoftwarePackage):
def supports_backup(self) -> bool:
return False
def __eq__(self, other):
if isinstance(other, WebApplication):
return self.name == other.name and self.url == other.url

View File

@@ -929,4 +929,4 @@ class IgnorePackageUpdates(AsyncAction):
self.notify_finished(res)
finally:
self.pkg = None
self.pkg = None

View File

@@ -28,3 +28,7 @@ class PackageView:
def __repr__(self):
return '{} ( {} )'.format(self.model.name, self.get_type_label())
def __eq__(self, other):
if isinstance(other, PackageView):
return self.model == other.model

View File

@@ -1277,6 +1277,12 @@ class ManageWindow(QWidget):
if res['success']:
self.apply_filters_async()
if self.pkgs_installed:
cached_installed = [idx for idx, p in enumerate(self.pkgs_installed) if p == res['pkg']]
for idx in cached_installed:
self.pkgs_installed[idx] = res['pkg']
dialog.show_message(title=self.i18n['success'].capitalize(),
body=self.i18n['action.{}.success'.format(res['action'])].format(bold(res['pkg'].model.name)),
type_=MessageType.INFO)