From 623dde46e633ea26338293823ab1b8ebcc78e740 Mon Sep 17 00:00:00 2001 From: Sambhav Kothari Date: Sun, 22 Jan 2017 19:20:35 +0530 Subject: [PATCH 6/9] Implement __eq__ method for CoverArtThumbnail and update _show() method --- picard/ui/coverartbox.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/picard/ui/coverartbox.py b/picard/ui/coverartbox.py index 2ec1719e..03bcdc57 100644 --- a/picard/ui/coverartbox.py +++ b/picard/ui/coverartbox.py @@ -80,6 +80,12 @@ class CoverArtThumbnail(ActiveLabel): self.clicked.connect(self.open_release_page) self.imageDropped.connect(self.fetch_remote_image) + def __eq__(self, other): + if self.data and other.data: + return self.data.data == other.data.data + else: + return False + def show(self): self.set_data(self.data, True) @@ -163,7 +169,9 @@ class CoverArtBox(QtGui.QGroupBox): self.setLayout(self.layout) def _show(self): - if self.cover_art.data == self.orig_cover_art.data: + # We want to show the 2 coverarts only if they are different + # and orig_cover_art is not None + if getattr(self.orig_cover_art, 'data', None) is None or self.cover_art == self.orig_cover_art: self.orig_cover_art.setHidden(True) self.cover_art_label.setText('') self.orig_cover_art_label.setText('') -- 2.11.0