From 66571550e9181a39debcbdad8ded2c80d89886d7 Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Sat, 28 May 2011 16:57:37 +0100 Subject: [PATCH] Add the heart to the search store chooser --- src/calibre/customize/builtins.py | 2 +- src/calibre/gui2/store/search/search.py | 28 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index f1afb62cbc..cd5f81067f 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -1417,7 +1417,7 @@ class StoreWeightlessBooksStore(StoreBase): class StoreWHSmithUKStore(StoreBase): name = 'WH Smith UK' author = 'Charles Haley' - description = u"With over 550 stores on the high street and 490 stores at airports, train stations, hospitals and motorway services, WHSmith is one of the UK's leading retail groups and a household name." + description = u"Shop for savings on Books, discounted Magazine subscriptions and great prices on Stationery, Toys & Games" actual_plugin = 'calibre.gui2.store.whsmith_uk_plugin:WHSmithUKStore' drm_free_only = False diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py index faeaf507c9..7ce6c93c68 100644 --- a/src/calibre/gui2/store/search/search.py +++ b/src/calibre/gui2/store/search/search.py @@ -9,8 +9,8 @@ __docformat__ = 'restructuredtext en' import re from random import shuffle -from PyQt4.Qt import (Qt, QDialog, QDialogButtonBox, QTimer, QCheckBox, - QVBoxLayout, QIcon, QWidget, QTabWidget) +from PyQt4.Qt import (Qt, QDialog, QDialogButtonBox, QTimer, QCheckBox, QLabel, + QVBoxLayout, QIcon, QWidget, QTabWidget, QGridLayout) from calibre.gui2 import JSONConfig, info_dialog from calibre.gui2.progress_indicator import ProgressIndicator @@ -80,7 +80,7 @@ class SearchDialog(QDialog, Ui_Dialog): self.progress_checker.start(100) self.restore_state() - + def setup_store_checks(self): # Add check boxes for each store so the user # can disable searching specific stores on a @@ -88,18 +88,26 @@ class SearchDialog(QDialog, Ui_Dialog): existing = {} for n in self.store_checks: existing[n] = self.store_checks[n].isChecked() - + self.store_checks = {} stores_check_widget = QWidget() - store_list_layout = QVBoxLayout() + store_list_layout = QGridLayout() stores_check_widget.setLayout(store_list_layout) - for x in sorted(self.gui.istores.keys(), key=lambda x: x.lower()): + + icon = QIcon(I('donate.png')) + i = 0 # just in case the list of stores is empty + for i, x in enumerate(sorted(self.gui.istores.keys(), key=lambda x: x.lower())): cbox = QCheckBox(x) cbox.setChecked(existing.get(x, False)) - store_list_layout.addWidget(cbox) + store_list_layout.addWidget(cbox, i, 0, 1, 1) + if self.gui.istores[x].base_plugin.affiliate: + iw = QLabel(self) + iw.setPixmap(icon.pixmap(16, 16)) + store_list_layout.addWidget(iw, i, 1, 1, 1) self.store_checks[x] = cbox - store_list_layout.addStretch() + i += 1 + store_list_layout.setRowStretch(i, 10) self.store_list.setWidget(stores_check_widget) def build_adv_search(self): @@ -250,14 +258,14 @@ class SearchDialog(QDialog, Ui_Dialog): button_box.accepted.connect(d.accept) button_box.rejected.connect(d.reject) d.setWindowTitle(_('Customize get books search')) - + tab_widget = QTabWidget(d) v.addWidget(tab_widget) v.addWidget(button_box) chooser_config_widget = StoreChooserWidget() search_config_widget = StoreConfigWidget(self.config) - + tab_widget.addTab(chooser_config_widget, _('Choose stores')) tab_widget.addTab(search_config_widget, _('Configure search'))