mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Improve handling of affiliate flag.
This commit is contained in:
parent
40b073c60c
commit
ddb7afffa9
@ -76,7 +76,7 @@ class Matches(QAbstractItemModel):
|
|||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
def add_result(self, result, store_plugin):
|
def add_result(self, result, store_plugin):
|
||||||
result.plugin = store_plugin
|
result.affiliate = getattr(store_plugin.base_plugin, 'affiliate', False)
|
||||||
if result not in self.all_matches:
|
if result not in self.all_matches:
|
||||||
self.layoutAboutToBeChanged.emit()
|
self.layoutAboutToBeChanged.emit()
|
||||||
self.all_matches.append(result)
|
self.all_matches.append(result)
|
||||||
@ -177,7 +177,7 @@ class Matches(QAbstractItemModel):
|
|||||||
elif result.drm == SearchResult.DRM_UNKNOWN:
|
elif result.drm == SearchResult.DRM_UNKNOWN:
|
||||||
return QVariant(self.DRM_UNKNOWN_ICON)
|
return QVariant(self.DRM_UNKNOWN_ICON)
|
||||||
if col == 5:
|
if col == 5:
|
||||||
if getattr(result.plugin.base_plugin, 'affiliate', False):
|
if result.affiliate:
|
||||||
icon = QIcon()
|
icon = QIcon()
|
||||||
icon.addFile(I('donate.png'), QSize(16, 16))
|
icon.addFile(I('donate.png'), QSize(16, 16))
|
||||||
return QVariant(icon)
|
return QVariant(icon)
|
||||||
@ -218,7 +218,7 @@ class Matches(QAbstractItemModel):
|
|||||||
elif col == 4:
|
elif col == 4:
|
||||||
text = result.store_name
|
text = result.store_name
|
||||||
elif col == 5:
|
elif col == 5:
|
||||||
if getattr(result.plugin.base_plugin, 'affiliate', False):
|
if result.affiliate:
|
||||||
text = 'y'
|
text = 'y'
|
||||||
else:
|
else:
|
||||||
text = 'n'
|
text = 'n'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user