From b04eed00121f98fee1316cc3bff761e4f993c438 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Fri, 27 May 2011 13:00:31 +0100
Subject: [PATCH 01/44] New store: EBookShoppeUKStore. small correction to
FoylesUKStore. fix to threading problem in search causing range errors.
Disable waterstones.
---
src/calibre/customize/builtins.py | 13 ++-
.../gui2/store/ebookshoppe_uk_plugin.py | 97 +++++++++++++++++++
src/calibre/gui2/store/foyles_uk_plugin.py | 9 +-
src/calibre/gui2/store/search/models.py | 2 +
4 files changed, 118 insertions(+), 3 deletions(-)
create mode 100644 src/calibre/gui2/store/ebookshoppe_uk_plugin.py
diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py
index 4a970b4661..150ad269bb 100644
--- a/src/calibre/customize/builtins.py
+++ b/src/calibre/customize/builtins.py
@@ -1393,6 +1393,16 @@ class StoreWoblinkStore(StoreBase):
headquarters = 'PL'
formats = ['EPUB']
+class StoreEBookShoppeUKStore(StoreBase):
+ name = 'ebookShoppe UK'
+ author = u'Charles Haley'
+ description = u'We made this website in an attempt to offer the widest range of UK eBooks possible across and as many formats as we could manage.'
+ actual_plugin = 'calibre.gui2.store.ebookshoppe_uk_plugin:EBookShoppeUKStore'
+
+ drm_free_only = False
+ headquarters = 'UK'
+ formats = ['EPUB', 'PDF']
+
plugins += [
StoreArchiveOrgStore,
StoreAmazonKindleStore,
@@ -1404,6 +1414,7 @@ plugins += [
StoreBeWriteStore,
StoreDieselEbooksStore,
StoreEbookscomStore,
+ StoreEBookShoppeUKStore,
StoreEPubBuyDEStore,
StoreEHarlequinStore,
StoreFeedbooksStore,
@@ -1421,7 +1432,7 @@ plugins += [
StorePragmaticBookshelfStore,
StoreSmashwordsStore,
StoreVirtualoStore,
- StoreWaterstonesUKStore,
+ # StoreWaterstonesUKStore,
StoreWeightlessBooksStore,
StoreWizardsTowerBooksStore,
StoreWoblinkStore
diff --git a/src/calibre/gui2/store/ebookshoppe_uk_plugin.py b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
new file mode 100644
index 0000000000..de5304da86
--- /dev/null
+++ b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
@@ -0,0 +1,97 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import (unicode_literals, division, absolute_import, print_function)
+
+__license__ = 'GPL 3'
+__copyright__ = '2011, John Schember '
+__docformat__ = 'restructuredtext en'
+
+import urllib2
+from contextlib import closing
+
+from lxml import html
+
+from PyQt4.Qt import QUrl
+
+from calibre import browser, url_slash_cleaner
+from calibre.gui2 import open_url
+from calibre.gui2.store import StorePlugin
+from calibre.gui2.store.basic_config import BasicStoreConfig
+from calibre.gui2.store.search_result import SearchResult
+from calibre.gui2.store.web_store_dialog import WebStoreDialog
+
+class EBookShoppeUKStore(BasicStoreConfig, StorePlugin):
+
+ def open(self, parent=None, detail_item=None, external=False):
+ url_details = 'http://www.awin1.com/cread.php?awinmid=1414&awinaffid=120917&clickref=&p={0}'
+ url = 'http://www.awin1.com/awclick.php?mid=2666&id=120917'
+
+ if external or self.config.get('open_external', False):
+ if detail_item:
+ url = url_details.format(detail_item)
+ open_url(QUrl(url))
+ else:
+ detail_url = None
+ if detail_item:
+ detail_url = url_details.format(detail_item)
+ d = WebStoreDialog(self.gui, url, parent, detail_url)
+ d.setWindowTitle(self.name)
+ d.set_tags(self.config.get('tags', ''))
+ d.exec_()
+
+ # reduce max_results because the filter will match everything. See the
+ # setting of 'author' below for more details
+
+ def search(self, query, max_results=5, timeout=60):
+ url = 'http://www.ebookshoppe.com/search.php?search_query=' + urllib2.quote(query)
+ br = browser()
+
+ counter = max_results
+ with closing(br.open(url, timeout=timeout)) as f:
+ doc = html.fromstring(f.read())
+ for data in doc.xpath('//ul[@class="ProductList"]/li'):
+ if counter <= 0:
+ break
+
+ id = ''.join(data.xpath('./div[@class="ProductDetails"]/'
+ 'strong/a/@href')).strip()
+ if not id:
+ continue
+ cover_url = ''.join(data.xpath('./div[@class="ProductImage"]/a/img/@src'))
+ title = ''.join(data.xpath('./div[@class="ProductDetails"]/strong/a/text()'))
+ price = ''.join(data.xpath('./div[@class="ProductPriceRating"]/em/text()'))
+ counter -= 1
+
+ s = SearchResult()
+ s.cover_url = cover_url
+ s.title = title.strip()
+ # Set the author to the query terms to ensure that author
+ # queries match something when pruning searches. Of course, this
+ # means that all books will match. Sigh...
+ s.author = query
+ s.price = price
+ s.drm = SearchResult.DRM_UNLOCKED
+ s.detail_item = id
+ s.formats = ''
+
+ # Call this here instead of later. Reason: painting then
+ # removing matches looks very strange. There are also issues
+ # with threading. Yes, this makes things take longer, but we
+ # will do the work anyway.
+ self.my_get_details(s, timeout)
+
+ yield s
+
+ def my_get_details(self, search_result, timeout):
+ br = browser()
+ with closing(br.open(search_result.detail_item, timeout=timeout)) as nf:
+ idata = html.fromstring(nf.read())
+ author = ''.join(idata.xpath('//div[@id="ProductOtherDetails"]/dl/dd[1]/text()'))
+ if author:
+ search_result.author = author
+ formats = idata.xpath('//dl[@class="ProductAddToCart"]/dd/'
+ 'ul[@class="ProductOptionList"]/li/label/text()')
+ if formats:
+ search_result.formats = ', '.join(formats)
+ search_result.drm = SearchResult.DRM_UNKNOWN
+ return True
\ No newline at end of file
diff --git a/src/calibre/gui2/store/foyles_uk_plugin.py b/src/calibre/gui2/store/foyles_uk_plugin.py
index 1a997cd671..fd670d2d85 100644
--- a/src/calibre/gui2/store/foyles_uk_plugin.py
+++ b/src/calibre/gui2/store/foyles_uk_plugin.py
@@ -23,12 +23,13 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
class FoylesUKStore(BasicStoreConfig, StorePlugin):
def open(self, parent=None, detail_item=None, external=False):
- url = 'http://www.awin1.com/cread.php?awinmid=1414&awinaffid=120917&clickref=&p='
+ url = 'http://www.awin1.com/awclick.php?mid=1414&id=120917'
+ detail_url = 'http://www.awin1.com/cread.php?awinmid=1414&awinaffid=120917&clickref=&p='
url_redirect = 'http://www.foyles.co.uk'
if external or self.config.get('open_external', False):
if detail_item:
- url = url + url_redirect + detail_item
+ url = detail_url + url_redirect + detail_item
open_url(QUrl(url_slash_cleaner(url)))
else:
detail_url = None
@@ -54,6 +55,10 @@ class FoylesUKStore(BasicStoreConfig, StorePlugin):
if not id:
continue
+ # filter out the audio books
+ if not data.xpath('boolean(.//div[@class="Relative"]/ul/li[contains(text(), "ePub")])'):
+ continue
+
cover_url = ''.join(data.xpath('.//a[@class="Jacket"]/img/@src'))
if cover_url:
cover_url = 'http://www.foyles.co.uk' + cover_url
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index d7941480cc..64724be6aa 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -150,6 +150,8 @@ class Matches(QAbstractItemModel):
def data(self, index, role):
row, col = index.row(), index.column()
+ if row >= len(self.matches):
+ return NONE
result = self.matches[row]
if role == Qt.DisplayRole:
if col == 1:
From ca6e74f762c73e8d69a1f0d931172388108059c7 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Fri, 27 May 2011 20:07:48 -0400
Subject: [PATCH 02/44] Store: Fix threading issue. Fix Manybooks cover
download.
---
src/calibre/gui2/store/manybooks_plugin.py | 3 ++-
src/calibre/gui2/store/search/models.py | 11 +++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/calibre/gui2/store/manybooks_plugin.py b/src/calibre/gui2/store/manybooks_plugin.py
index 1ae9d47d01..e990accc86 100644
--- a/src/calibre/gui2/store/manybooks_plugin.py
+++ b/src/calibre/gui2/store/manybooks_plugin.py
@@ -78,7 +78,8 @@ class ManyBooksStore(BasicStoreConfig, StorePlugin):
cover_name = mo.group()
cover_name = cover_name.replace('etext', '')
cover_id = id.split('.')[0]
- cover_url = 'http://manybooks_images.s3.amazonaws.com/original_covers/' + id[0] + '/' + cover_name + '/' + cover_id + '-thumb.jpg'
+ cover_url = 'http://www.manybooks.net/images/' + id[0] + '/' + cover_name + '/' + cover_id + '-thumb.jpg'
+ print(cover_url)
counter -= 1
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index d7941480cc..3d1a5c2724 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -12,7 +12,7 @@ from operator import attrgetter
from PyQt4.Qt import (Qt, QAbstractItemModel, QVariant, QPixmap, QModelIndex, QSize,
pyqtSignal)
-from calibre.gui2 import NONE
+from calibre.gui2 import NONE, FunctionDispatcher
from calibre.gui2.store.search_result import SearchResult
from calibre.gui2.store.search.download_thread import DetailsThreadPool, \
CoverThreadPool
@@ -56,6 +56,9 @@ class Matches(QAbstractItemModel):
self.search_filter = SearchFilter()
self.cover_pool = CoverThreadPool(cover_thread_count)
self.details_pool = DetailsThreadPool(detail_thread_count)
+
+ self.filter_results_dispatcher = FunctionDispatcher(self.filter_results)
+ self.got_result_details_dispatcher = FunctionDispatcher(self.got_result_details)
self.sort_col = 2
self.sort_order = Qt.AscendingOrder
@@ -82,10 +85,10 @@ class Matches(QAbstractItemModel):
self.search_filter.add_search_result(result)
if result.cover_url:
result.cover_queued = True
- self.cover_pool.add_task(result, self.filter_results)
+ self.cover_pool.add_task(result, self.filter_results_dispatcher)
else:
result.cover_queued = False
- self.details_pool.add_task(result, store_plugin, self.got_result_details)
+ self.details_pool.add_task(result, store_plugin, self.got_result_details_dispatcher)
self.filter_results()
self.layoutChanged.emit()
@@ -112,7 +115,7 @@ class Matches(QAbstractItemModel):
def got_result_details(self, result):
if not result.cover_queued and result.cover_url:
result.cover_queued = True
- self.cover_pool.add_task(result, self.filter_results)
+ self.cover_pool.add_task(result, self.filter_results_dispatcher)
if result in self.matches:
row = self.matches.index(result)
self.dataChanged.emit(self.index(row, 0), self.index(row, self.columnCount() - 1))
From 5e3dd658dff6a640a7ef6756bea8d1ead9b2d557 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Fri, 27 May 2011 20:10:15 -0400
Subject: [PATCH 03/44] Store: Fully remove Waterstones as its maintainer has
dropped it.
---
src/calibre/customize/builtins.py | 11 ---
.../gui2/store/waterstones_uk_plugin.py | 84 -------------------
2 files changed, 95 deletions(-)
delete mode 100644 src/calibre/gui2/store/waterstones_uk_plugin.py
diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py
index 70ef1612ee..fb35fa14e9 100644
--- a/src/calibre/customize/builtins.py
+++ b/src/calibre/customize/builtins.py
@@ -1355,16 +1355,6 @@ class StoreVirtualoStore(StoreBase):
headquarters = 'PL'
formats = ['EPUB', 'PDF']
-class StoreWaterstonesUKStore(StoreBase):
- name = 'Waterstones UK'
- author = 'Charles Haley'
- description = u'Waterstone\'s mission is to be the leading Bookseller on the High Street and online providing customers the widest choice, great value and expert advice from a team passionate about Bookselling.'
- actual_plugin = 'calibre.gui2.store.waterstones_uk_plugin:WaterstonesUKStore'
-
- drm_free_only = False
- headquarters = 'UK'
- formats = ['EPUB', 'PDF']
-
class StoreWeightlessBooksStore(StoreBase):
name = 'Weightless Books'
description = u'An independent DRM-free ebooksite devoted to ebooks of all sorts.'
@@ -1421,7 +1411,6 @@ plugins += [
StorePragmaticBookshelfStore,
StoreSmashwordsStore,
StoreVirtualoStore,
- #StoreWaterstonesUKStore,
StoreWeightlessBooksStore,
StoreWizardsTowerBooksStore,
StoreWoblinkStore
diff --git a/src/calibre/gui2/store/waterstones_uk_plugin.py b/src/calibre/gui2/store/waterstones_uk_plugin.py
deleted file mode 100644
index a5065128ba..0000000000
--- a/src/calibre/gui2/store/waterstones_uk_plugin.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from __future__ import (unicode_literals, division, absolute_import, print_function)
-
-__license__ = 'GPL 3'
-__copyright__ = '2011, John Schember '
-__docformat__ = 'restructuredtext en'
-
-import urllib2
-from contextlib import closing
-
-from lxml import html
-
-from PyQt4.Qt import QUrl
-
-from calibre import browser
-from calibre.gui2 import open_url
-from calibre.gui2.store import StorePlugin
-from calibre.gui2.store.basic_config import BasicStoreConfig
-from calibre.gui2.store.search_result import SearchResult
-from calibre.gui2.store.web_store_dialog import WebStoreDialog
-
-class WaterstonesUKStore(BasicStoreConfig, StorePlugin):
-
- def open(self, parent=None, detail_item=None, external=False):
- url = 'http://clkuk.tradedoubler.com/click?p=51196&a=1951604&g=19333484'
- url_details = 'http://clkuk.tradedoubler.com/click?p(51196)a(1951604)g(16460516)url({0})'
-
- if external or self.config.get('open_external', False):
- if detail_item:
- url = url_details.format(detail_item)
- open_url(QUrl(url))
- else:
- detail_url = None
- if detail_item:
- detail_url = url_details.format(detail_item)
- d = WebStoreDialog(self.gui, url, parent, detail_url)
- d.setWindowTitle(self.name)
- d.set_tags(self.config.get('tags', ''))
- d.exec_()
-
- def search(self, query, max_results=10, timeout=60):
- url = 'http://www.waterstones.com/waterstonesweb/advancedSearch.do?buttonClicked=1&format=3757&bookkeywords=' + urllib2.quote(query)
-
- br = browser()
-
- counter = max_results
- with closing(br.open(url, timeout=timeout)) as f:
- doc = html.fromstring(f.read())
- for data in doc.xpath('//div[contains(@class, "results-pane")]'):
- if counter <= 0:
- break
-
- id = ''.join(data.xpath('./div/div/h2/a/@href')).strip()
- if not id:
- continue
- cover_url = ''.join(data.xpath('.//div[@class="image"]/a/img/@src'))
- title = ''.join(data.xpath('./div/div/h2/a/text()'))
- author = ', '.join(data.xpath('.//p[@class="byAuthor"]/a/text()'))
- price = ''.join(data.xpath('.//p[@class="price"]/span[@class="priceStandard"]/text()'))
- drm = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "DRM")])')
- pdf = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "PDF")])')
- epub = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "EPUB")])')
-
- counter -= 1
-
- s = SearchResult()
- s.cover_url = cover_url
- s.title = title.strip()
- s.author = author.strip()
- s.price = price
- if drm:
- s.drm = SearchResult.DRM_LOCKED
- else:
- s.drm = SearchResult.DRM_UNKNOWN
- s.detail_item = id
- formats = []
- if epub:
- formats.append('ePub')
- if pdf:
- formats.append('PDF')
- s.formats = ', '.join(formats)
-
- yield s
From 0192aa2da06889f4756af54dca4905d287344bc3 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Fri, 27 May 2011 20:13:19 -0400
Subject: [PATCH 04/44] Store: chooser widget, add history.
---
.../gui2/store/config/chooser/chooser_widget.py | 2 ++
.../gui2/store/config/chooser/chooser_widget.ui | 14 +++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.py b/src/calibre/gui2/store/config/chooser/chooser_widget.py
index 93630d69a7..2f8c72d3d0 100644
--- a/src/calibre/gui2/store/config/chooser/chooser_widget.py
+++ b/src/calibre/gui2/store/config/chooser/chooser_widget.py
@@ -17,6 +17,8 @@ class StoreChooserWidget(QWidget, Ui_Form):
QWidget.__init__(self)
self.setupUi(self)
+ self.query.initialize('store_config_chooser_query')
+
self.adv_search_builder.setIcon(QIcon(I('search.png')))
self.search.clicked.connect(self.do_search)
diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.ui b/src/calibre/gui2/store/config/chooser/chooser_widget.ui
index 69117406b1..e833dbf4b9 100644
--- a/src/calibre/gui2/store/config/chooser/chooser_widget.ui
+++ b/src/calibre/gui2/store/config/chooser/chooser_widget.ui
@@ -31,7 +31,14 @@
-
-
+
+
+
+ 0
+ 0
+
+
+
-
@@ -81,6 +88,11 @@
QTreeView
+
+ HistoryLineEdit
+ QLineEdit
+
+
From 30743e1b9d4872e014f8a7b5d2528784eb5fb3f6 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 08:38:30 -0400
Subject: [PATCH 05/44] Store: Give MobileRead it's own advanced search dialog.
Fix MobileRead dialog class name.
---
.../store/mobileread/adv_search_builder.py | 119 ++++++
.../store/mobileread/adv_search_builder.ui | 350 ++++++++++++++++++
.../store/mobileread/mobileread_plugin.py | 4 +-
.../gui2/store/mobileread/store_dialog.py | 6 +-
4 files changed, 473 insertions(+), 6 deletions(-)
create mode 100644 src/calibre/gui2/store/mobileread/adv_search_builder.py
create mode 100644 src/calibre/gui2/store/mobileread/adv_search_builder.ui
diff --git a/src/calibre/gui2/store/mobileread/adv_search_builder.py b/src/calibre/gui2/store/mobileread/adv_search_builder.py
new file mode 100644
index 0000000000..8c41f1924b
--- /dev/null
+++ b/src/calibre/gui2/store/mobileread/adv_search_builder.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import (unicode_literals, division, absolute_import, print_function)
+
+__license__ = 'GPL 3'
+__copyright__ = '2011, John Schember '
+__docformat__ = 'restructuredtext en'
+
+import re
+
+from PyQt4.Qt import (QDialog, QDialogButtonBox)
+
+from calibre.gui2.store.mobileread.adv_search_builder_ui import Ui_Dialog
+from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH
+
+class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
+
+ def __init__(self, parent):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.buttonBox.accepted.connect(self.advanced_search_button_pushed)
+ self.tab_2_button_box.accepted.connect(self.accept)
+ self.tab_2_button_box.rejected.connect(self.reject)
+ self.clear_button.clicked.connect(self.clear_button_pushed)
+ self.adv_search_used = False
+ self.mc = ''
+
+ self.tabWidget.setCurrentIndex(0)
+ self.tabWidget.currentChanged[int].connect(self.tab_changed)
+ self.tab_changed(0)
+
+ def tab_changed(self, idx):
+ if idx == 1:
+ self.tab_2_button_box.button(QDialogButtonBox.Ok).setDefault(True)
+ else:
+ self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True)
+
+ def advanced_search_button_pushed(self):
+ self.adv_search_used = True
+ self.accept()
+
+ def clear_button_pushed(self):
+ self.title_box.setText('')
+ self.author_box.setText('')
+ self.format_box.setText('')
+
+ def tokens(self, raw):
+ phrases = re.findall(r'\s*".*?"\s*', raw)
+ for f in phrases:
+ raw = raw.replace(f, ' ')
+ phrases = [t.strip('" ') for t in phrases]
+ return ['"' + self.mc + t + '"' for t in phrases + [r.strip() for r in raw.split()]]
+
+ def search_string(self):
+ if self.adv_search_used:
+ return self.adv_search_string()
+ else:
+ return self.box_search_string()
+
+ def adv_search_string(self):
+ mk = self.matchkind.currentIndex()
+ if mk == CONTAINS_MATCH:
+ self.mc = ''
+ elif mk == EQUALS_MATCH:
+ self.mc = '='
+ else:
+ self.mc = '~'
+ all, any, phrase, none = map(lambda x: unicode(x.text()),
+ (self.all, self.any, self.phrase, self.none))
+ all, any, none = map(self.tokens, (all, any, none))
+ phrase = phrase.strip()
+ all = ' and '.join(all)
+ any = ' or '.join(any)
+ none = ' and not '.join(none)
+ ans = ''
+ if phrase:
+ ans += '"%s"'%phrase
+ if all:
+ ans += (' and ' if ans else '') + all
+ if none:
+ ans += (' and not ' if ans else 'not ') + none
+ if any:
+ ans += (' or ' if ans else '') + any
+ return ans
+
+ def token(self):
+ txt = unicode(self.text.text()).strip()
+ if txt:
+ if self.negate.isChecked():
+ txt = '!'+txt
+ tok = self.FIELDS[unicode(self.field.currentText())]+txt
+ if re.search(r'\s', tok):
+ tok = '"%s"'%tok
+ return tok
+
+ def box_search_string(self):
+ mk = self.matchkind.currentIndex()
+ if mk == CONTAINS_MATCH:
+ self.mc = ''
+ elif mk == EQUALS_MATCH:
+ self.mc = '='
+ else:
+ self.mc = '~'
+
+ ans = []
+ self.box_last_values = {}
+ title = unicode(self.title_box.text()).strip()
+ if title:
+ ans.append('title:"' + self.mc + title + '"')
+ author = unicode(self.author_box.text()).strip()
+ if author:
+ ans.append('author:"' + self.mc + author + '"')
+ format = unicode(self.format_box.text()).strip()
+ if format:
+ ans.append('format:"' + self.mc + format + '"')
+ if ans:
+ return ' and '.join(ans)
+ return ''
diff --git a/src/calibre/gui2/store/mobileread/adv_search_builder.ui b/src/calibre/gui2/store/mobileread/adv_search_builder.ui
new file mode 100644
index 0000000000..7742ccbd97
--- /dev/null
+++ b/src/calibre/gui2/store/mobileread/adv_search_builder.ui
@@ -0,0 +1,350 @@
+
+
+ Dialog
+
+
+
+ 0
+ 0
+ 752
+ 472
+
+
+
+ Advanced Search
+
+
+
+ :/images/search.png:/images/search.png
+
+
+
-
+
+
+ &What kind of match to use:
+
+
+ matchkind
+
+
+
+ -
+
+
-
+
+ Contains: the word or phrase matches anywhere in the metadata field
+
+
+ -
+
+ Equals: the word or phrase must match the entire metadata field
+
+
+ -
+
+ Regular expression: the expression must match anywhere in the metadata field
+
+
+
+
+ -
+
+
+ 0
+
+
+
+ A&dvanced Search
+
+
+
-
+
+
+ Find entries that have...
+
+
+
-
+
+
-
+
+
+ &All these words:
+
+
+ all
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ This exact &phrase:
+
+
+ all
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ &One or more of these words:
+
+
+ all
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+ But dont show entries that have...
+
+
+
-
+
+
-
+
+
+ Any of these &unwanted words:
+
+
+ all
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+ 16777215
+ 30
+
+
+
+ See the <a href="http://calibre-ebook.com/user_manual/gui.html#the-search-interface">User Manual</a> for more help
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+ Titl&e/Author/Price ...
+
+
+ -
+
+
+ &Title:
+
+
+ title_box
+
+
+
+ -
+
+
+ Enter the title.
+
+
+
+ -
+
+
+ &Author:
+
+
+ author_box
+
+
+
+ -
+
+
-
+
+
+ &Clear
+
+
+
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ Search only in specific fields:
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ &Format:
+
+
+ format_box
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ EnLineEdit
+ QLineEdit
+
+
+
+
+ all
+ phrase
+ any
+ none
+ buttonBox
+ title_box
+ author_box
+ format_box
+ clear_button
+ tab_2_button_box
+ tabWidget
+ matchkind
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ Dialog
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ Dialog
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/calibre/gui2/store/mobileread/mobileread_plugin.py b/src/calibre/gui2/store/mobileread/mobileread_plugin.py
index 271e34a619..4e11d62bbd 100644
--- a/src/calibre/gui2/store/mobileread/mobileread_plugin.py
+++ b/src/calibre/gui2/store/mobileread/mobileread_plugin.py
@@ -18,7 +18,7 @@ from calibre.gui2.store.web_store_dialog import WebStoreDialog
from calibre.gui2.store.mobileread.models import SearchFilter
from calibre.gui2.store.mobileread.cache_progress_dialog import CacheProgressDialog
from calibre.gui2.store.mobileread.cache_update_thread import CacheUpdateThread
-from calibre.gui2.store.mobileread.store_dialog import MobeReadStoreDialog
+from calibre.gui2.store.mobileread.store_dialog import MobileReadStoreDialog
class MobileReadStore(BasicStoreConfig, StorePlugin):
@@ -38,7 +38,7 @@ class MobileReadStore(BasicStoreConfig, StorePlugin):
d.exec_()
else:
self.update_cache(parent, 30)
- d = MobeReadStoreDialog(self, parent)
+ d = MobileReadStoreDialog(self, parent)
d.setWindowTitle(self.name)
d.exec_()
diff --git a/src/calibre/gui2/store/mobileread/store_dialog.py b/src/calibre/gui2/store/mobileread/store_dialog.py
index 7a7b27837d..8908c9bb68 100644
--- a/src/calibre/gui2/store/mobileread/store_dialog.py
+++ b/src/calibre/gui2/store/mobileread/store_dialog.py
@@ -9,11 +9,11 @@ __docformat__ = 'restructuredtext en'
from PyQt4.Qt import (Qt, QDialog, QIcon)
-from calibre.gui2.store.search.adv_search_builder import AdvSearchBuilderDialog
+from calibre.gui2.store.mobileread.adv_search_builder import AdvSearchBuilderDialog
from calibre.gui2.store.mobileread.models import BooksModel
from calibre.gui2.store.mobileread.store_dialog_ui import Ui_Dialog
-class MobeReadStoreDialog(QDialog, Ui_Dialog):
+class MobileReadStoreDialog(QDialog, Ui_Dialog):
def __init__(self, plugin, *args):
QDialog.__init__(self, *args)
@@ -49,8 +49,6 @@ class MobeReadStoreDialog(QDialog, Ui_Dialog):
def build_adv_search(self):
adv = AdvSearchBuilderDialog(self)
- adv.price_label.hide()
- adv.price_box.hide()
if adv.exec_() == QDialog.Accepted:
self.search_query.setText(adv.search_string())
From 40b073c60cd7bea1063677f89c2feed310206d6a Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sat, 28 May 2011 13:54:57 +0100
Subject: [PATCH 06/44] Add heart to search screen
---
src/calibre/customize/builtins.py | 8 +++++++-
src/calibre/gui2/store/search/models.py | 18 ++++++++++++++++--
src/calibre/gui2/store/search_result.py | 5 +++--
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py
index ad587baf39..ba88d766dc 100644
--- a/src/calibre/customize/builtins.py
+++ b/src/calibre/customize/builtins.py
@@ -1111,6 +1111,7 @@ class StoreAmazonKindleStore(StoreBase):
drm_free_only = False
headquarters = 'US'
formats = ['KINDLE']
+ affiliate = True
class StoreAmazonDEKindleStore(StoreBase):
name = 'Amazon DE Kindle'
@@ -1121,6 +1122,7 @@ class StoreAmazonDEKindleStore(StoreBase):
drm_free_only = False
headquarters = 'DE'
formats = ['KINDLE']
+ affiliate = True
class StoreAmazonUKKindleStore(StoreBase):
name = 'Amazon UK Kindle'
@@ -1131,6 +1133,7 @@ class StoreAmazonUKKindleStore(StoreBase):
drm_free_only = False
headquarters = 'UK'
formats = ['KINDLE']
+ affiliate = True
class StoreArchiveOrgStore(StoreBase):
name = 'Archive.org'
@@ -1168,6 +1171,7 @@ class StoreBeamEBooksDEStore(StoreBase):
drm_free_only = True
headquarters = 'DE'
formats = ['EPUB', 'MOBI', 'PDF']
+ affiliate = True
class StoreBeWriteStore(StoreBase):
name = 'BeWrite Books'
@@ -1233,6 +1237,7 @@ class StoreFoylesUKStore(StoreBase):
drm_free_only = False
headquarters = 'UK'
formats = ['EPUB', 'PDF']
+ affiliate = True
class StoreGandalfStore(StoreBase):
name = 'Gandalf'
@@ -1402,6 +1407,7 @@ class StoreEBookShoppeUKStore(StoreBase):
drm_free_only = False
headquarters = 'UK'
formats = ['EPUB', 'PDF']
+ affiliate = True
plugins += [
StoreArchiveOrgStore,
@@ -1432,7 +1438,7 @@ plugins += [
StorePragmaticBookshelfStore,
StoreSmashwordsStore,
StoreVirtualoStore,
- #StoreWaterstonesUKStore,
+ StoreWaterstonesUKStore,
StoreWeightlessBooksStore,
StoreWizardsTowerBooksStore,
StoreWoblinkStore
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index 64724be6aa..797195e202 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -10,7 +10,7 @@ import re
from operator import attrgetter
from PyQt4.Qt import (Qt, QAbstractItemModel, QVariant, QPixmap, QModelIndex, QSize,
- pyqtSignal)
+ pyqtSignal, QIcon)
from calibre.gui2 import NONE
from calibre.gui2.store.search_result import SearchResult
@@ -33,7 +33,7 @@ class Matches(QAbstractItemModel):
total_changed = pyqtSignal(int)
- HEADERS = [_('Cover'), _('Title'), _('Price'), _('DRM'), _('Store')]
+ HEADERS = [_('Cover'), _('Title'), _('Price'), _('DRM'), _('Store'), _('')]
HTML_COLS = (1, 4)
def __init__(self, cover_thread_count=2, detail_thread_count=4):
@@ -76,6 +76,7 @@ class Matches(QAbstractItemModel):
self.reset()
def add_result(self, result, store_plugin):
+ result.plugin = store_plugin
if result not in self.all_matches:
self.layoutAboutToBeChanged.emit()
self.all_matches.append(result)
@@ -175,6 +176,12 @@ class Matches(QAbstractItemModel):
return QVariant(self.DRM_UNLOCKED_ICON)
elif result.drm == SearchResult.DRM_UNKNOWN:
return QVariant(self.DRM_UNKNOWN_ICON)
+ if col == 5:
+ if getattr(result.plugin.base_plugin, 'affiliate', False):
+ icon = QIcon()
+ icon.addFile(I('donate.png'), QSize(16, 16))
+ return QVariant(icon)
+ return NONE
elif role == Qt.ToolTipRole:
if col == 1:
return QVariant('%s
' % result.title)
@@ -189,6 +196,8 @@ class Matches(QAbstractItemModel):
return QVariant('' + _('The DRM status of this book could not be determined. There is a very high likelihood that this book is actually DRM restricted.') + '
')
elif col == 4:
return QVariant('%s
' % result.formats)
+ elif col == 5:
+ return QVariant(_('Buying from this store supports a calibre developer'))
elif role == Qt.SizeHintRole:
return QSize(64, 64)
return NONE
@@ -208,6 +217,11 @@ class Matches(QAbstractItemModel):
text = 'c'
elif col == 4:
text = result.store_name
+ elif col == 5:
+ if getattr(result.plugin.base_plugin, 'affiliate', False):
+ text = 'y'
+ else:
+ text = 'n'
return text
def sort(self, col, order, reset=True):
diff --git a/src/calibre/gui2/store/search_result.py b/src/calibre/gui2/store/search_result.py
index 7bf361157e..a3c6a5601e 100644
--- a/src/calibre/gui2/store/search_result.py
+++ b/src/calibre/gui2/store/search_result.py
@@ -7,11 +7,11 @@ __copyright__ = '2011, John Schember '
__docformat__ = 'restructuredtext en'
class SearchResult(object):
-
+
DRM_LOCKED = 1
DRM_UNLOCKED = 2
DRM_UNKNOWN = 3
-
+
def __init__(self):
self.store_name = ''
self.cover_url = ''
@@ -22,6 +22,7 @@ class SearchResult(object):
self.detail_item = ''
self.drm = None
self.formats = ''
+ self.plugin = None
def __eq__(self, other):
return self.title == other.title and self.author == other.author and self.store_name == other.store_name
From ddb7afffa9d846b2798e6c7a644d8dc052ebb7eb Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sat, 28 May 2011 13:59:16 +0100
Subject: [PATCH 07/44] Improve handling of affiliate flag.
---
src/calibre/gui2/store/search/models.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index 797195e202..44a993ef12 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -76,7 +76,7 @@ class Matches(QAbstractItemModel):
self.reset()
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:
self.layoutAboutToBeChanged.emit()
self.all_matches.append(result)
@@ -177,7 +177,7 @@ class Matches(QAbstractItemModel):
elif result.drm == SearchResult.DRM_UNKNOWN:
return QVariant(self.DRM_UNKNOWN_ICON)
if col == 5:
- if getattr(result.plugin.base_plugin, 'affiliate', False):
+ if result.affiliate:
icon = QIcon()
icon.addFile(I('donate.png'), QSize(16, 16))
return QVariant(icon)
@@ -218,7 +218,7 @@ class Matches(QAbstractItemModel):
elif col == 4:
text = result.store_name
elif col == 5:
- if getattr(result.plugin.base_plugin, 'affiliate', False):
+ if result.affiliate:
text = 'y'
else:
text = 'n'
From 07716ef80130943906d2e2bac4ba3d241d9bde8b Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sat, 28 May 2011 14:56:53 +0100
Subject: [PATCH 08/44] Move setting affiliate in the results structure. Add
the heart to the list of stores. Initialize 'affiliate' in the thread.
---
src/calibre/customize/__init__.py | 4 +++-
src/calibre/gui2/actions/store.py | 9 +++++++--
src/calibre/gui2/store/search/download_thread.py | 7 ++++---
src/calibre/gui2/store/search/models.py | 6 ++++--
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py
index 3d265aed1c..d087eb5351 100644
--- a/src/calibre/customize/__init__.py
+++ b/src/calibre/customize/__init__.py
@@ -615,7 +615,7 @@ class StoreBase(Plugin): # {{{
version = (1, 0, 1)
actual_plugin = None
-
+
# Does the store only distribute ebooks without DRM.
drm_free_only = False
# This is the 2 letter country code for the corporate
@@ -623,6 +623,8 @@ class StoreBase(Plugin): # {{{
headquarters = ''
# All formats the store distributes ebooks in.
formats = []
+ # Is this store on an affiliate program?
+ affiliate = False
def load_actual_plugin(self, gui):
'''
diff --git a/src/calibre/gui2/actions/store.py b/src/calibre/gui2/actions/store.py
index 6d9720548e..7f9b538bcf 100644
--- a/src/calibre/gui2/actions/store.py
+++ b/src/calibre/gui2/actions/store.py
@@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
from functools import partial
-from PyQt4.Qt import QMenu
+from PyQt4.Qt import QMenu, QIcon, QSize
from calibre.gui2 import error_dialog
from calibre.gui2.actions import InterfaceAction
@@ -32,8 +32,13 @@ class StoreAction(InterfaceAction):
self.store_menu.addAction(_('Search for this book'), self.search_author_title)
self.store_menu.addSeparator()
self.store_list_menu = self.store_menu.addMenu(_('Stores'))
+ icon = QIcon()
+ icon.addFile(I('donate.png'), QSize(16, 16))
for n, p in sorted(self.gui.istores.items(), key=lambda x: x[0].lower()):
- self.store_list_menu.addAction(n, partial(self.open_store, p))
+ if p.base_plugin.affiliate:
+ self.store_list_menu.addAction(icon, n, partial(self.open_store, p))
+ else:
+ self.store_list_menu.addAction(n, partial(self.open_store, p))
self.store_menu.addSeparator()
self.store_menu.addAction(_('Choose stores'), self.choose)
self.qaction.setMenu(self.store_menu)
diff --git a/src/calibre/gui2/store/search/download_thread.py b/src/calibre/gui2/store/search/download_thread.py
index 1fc74a5748..67b4224981 100644
--- a/src/calibre/gui2/store/search/download_thread.py
+++ b/src/calibre/gui2/store/search/download_thread.py
@@ -38,7 +38,7 @@ class GenericDownloadThreadPool(object):
This must be implemented in a sub class and this function
must be called at the end of the add_task function in
the sub class.
-
+
The implementation of this function (in this base class)
starts any threads necessary to fill the pool if it is
not already full.
@@ -91,7 +91,7 @@ class SearchThreadPool(GenericDownloadThreadPool):
sp = SearchThreadPool(3)
sp.add_task(...)
'''
-
+
def __init__(self, thread_count):
GenericDownloadThreadPool.__init__(self, SearchThread, thread_count)
@@ -120,6 +120,7 @@ class SearchThread(Thread):
if not self._run:
return
res.store_name = store_name
+ res.affiliate = store_plugin.base_plugin.affiliate
self.results.put((res, store_plugin))
self.tasks.task_done()
except:
@@ -167,7 +168,7 @@ class CoverThread(Thread):
class DetailsThreadPool(GenericDownloadThreadPool):
-
+
def __init__(self, thread_count):
GenericDownloadThreadPool.__init__(self, DetailsThread, thread_count)
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index 44a993ef12..f5c24798f6 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -76,7 +76,6 @@ class Matches(QAbstractItemModel):
self.reset()
def add_result(self, result, store_plugin):
- result.affiliate = getattr(store_plugin.base_plugin, 'affiliate', False)
if result not in self.all_matches:
self.layoutAboutToBeChanged.emit()
self.all_matches.append(result)
@@ -178,6 +177,8 @@ class Matches(QAbstractItemModel):
return QVariant(self.DRM_UNKNOWN_ICON)
if col == 5:
if result.affiliate:
+ # For some reason the size(16, 16) is forgotten if the icon
+ # is a class attribute. Don't know why...
icon = QIcon()
icon.addFile(I('donate.png'), QSize(16, 16))
return QVariant(icon)
@@ -197,7 +198,8 @@ class Matches(QAbstractItemModel):
elif col == 4:
return QVariant('%s
' % result.formats)
elif col == 5:
- return QVariant(_('Buying from this store supports a calibre developer'))
+ if result.affiliate:
+ return QVariant(_('Buying from this store supports a calibre developer'))
elif role == Qt.SizeHintRole:
return QSize(64, 64)
return NONE
From 3bb508bb1fedbf61dccf54ebe974d3480b1c9d6a Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 10:20:47 -0400
Subject: [PATCH 09/44] Store: Add Waterstones back.
---
.../gui2/store/waterstones_uk_plugin.py | 84 +++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 src/calibre/gui2/store/waterstones_uk_plugin.py
diff --git a/src/calibre/gui2/store/waterstones_uk_plugin.py b/src/calibre/gui2/store/waterstones_uk_plugin.py
new file mode 100644
index 0000000000..a5065128ba
--- /dev/null
+++ b/src/calibre/gui2/store/waterstones_uk_plugin.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import (unicode_literals, division, absolute_import, print_function)
+
+__license__ = 'GPL 3'
+__copyright__ = '2011, John Schember '
+__docformat__ = 'restructuredtext en'
+
+import urllib2
+from contextlib import closing
+
+from lxml import html
+
+from PyQt4.Qt import QUrl
+
+from calibre import browser
+from calibre.gui2 import open_url
+from calibre.gui2.store import StorePlugin
+from calibre.gui2.store.basic_config import BasicStoreConfig
+from calibre.gui2.store.search_result import SearchResult
+from calibre.gui2.store.web_store_dialog import WebStoreDialog
+
+class WaterstonesUKStore(BasicStoreConfig, StorePlugin):
+
+ def open(self, parent=None, detail_item=None, external=False):
+ url = 'http://clkuk.tradedoubler.com/click?p=51196&a=1951604&g=19333484'
+ url_details = 'http://clkuk.tradedoubler.com/click?p(51196)a(1951604)g(16460516)url({0})'
+
+ if external or self.config.get('open_external', False):
+ if detail_item:
+ url = url_details.format(detail_item)
+ open_url(QUrl(url))
+ else:
+ detail_url = None
+ if detail_item:
+ detail_url = url_details.format(detail_item)
+ d = WebStoreDialog(self.gui, url, parent, detail_url)
+ d.setWindowTitle(self.name)
+ d.set_tags(self.config.get('tags', ''))
+ d.exec_()
+
+ def search(self, query, max_results=10, timeout=60):
+ url = 'http://www.waterstones.com/waterstonesweb/advancedSearch.do?buttonClicked=1&format=3757&bookkeywords=' + urllib2.quote(query)
+
+ br = browser()
+
+ counter = max_results
+ with closing(br.open(url, timeout=timeout)) as f:
+ doc = html.fromstring(f.read())
+ for data in doc.xpath('//div[contains(@class, "results-pane")]'):
+ if counter <= 0:
+ break
+
+ id = ''.join(data.xpath('./div/div/h2/a/@href')).strip()
+ if not id:
+ continue
+ cover_url = ''.join(data.xpath('.//div[@class="image"]/a/img/@src'))
+ title = ''.join(data.xpath('./div/div/h2/a/text()'))
+ author = ', '.join(data.xpath('.//p[@class="byAuthor"]/a/text()'))
+ price = ''.join(data.xpath('.//p[@class="price"]/span[@class="priceStandard"]/text()'))
+ drm = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "DRM")])')
+ pdf = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "PDF")])')
+ epub = data.xpath('boolean(.//td[@headers="productFormat" and contains(., "EPUB")])')
+
+ counter -= 1
+
+ s = SearchResult()
+ s.cover_url = cover_url
+ s.title = title.strip()
+ s.author = author.strip()
+ s.price = price
+ if drm:
+ s.drm = SearchResult.DRM_LOCKED
+ else:
+ s.drm = SearchResult.DRM_UNKNOWN
+ s.detail_item = id
+ formats = []
+ if epub:
+ formats.append('ePub')
+ if pdf:
+ formats.append('PDF')
+ s.formats = ', '.join(formats)
+
+ yield s
From 93128ab03fe15e2667dfe805dd7c0080a738731d Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 10:23:10 -0400
Subject: [PATCH 10/44] Store: Change ebookshop to use get_details.
---
src/calibre/gui2/store/ebookshoppe_uk_plugin.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/calibre/gui2/store/ebookshoppe_uk_plugin.py b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
index 4ba2a1b5fd..b45b0e99d5 100644
--- a/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
+++ b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
@@ -73,7 +73,7 @@ class EBookShoppeUKStore(BasicStoreConfig, StorePlugin):
yield s
- def my_get_details(self, search_result, timeout):
+ def get_details(self, search_result, timeout):
br = browser()
with closing(br.open(search_result.detail_item, timeout=timeout)) as nf:
idata = html.fromstring(nf.read())
From 9b245bdcf508964136244cf2ae0a3d9bfb25fb9a Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 10:41:51 -0400
Subject: [PATCH 11/44] Store: ...
---
src/calibre/customize/builtins.py | 2 +-
src/calibre/gui2/store/ebookshoppe_uk_plugin.py | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py
index 0b83d0f45b..c57c19fd0b 100644
--- a/src/calibre/customize/builtins.py
+++ b/src/calibre/customize/builtins.py
@@ -1420,7 +1420,7 @@ plugins += [
StoreBeWriteStore,
StoreDieselEbooksStore,
StoreEbookscomStore,
- #StoreEBookShoppeUKStore,
+ StoreEBookShoppeUKStore,
StoreEPubBuyDEStore,
StoreEHarlequinStore,
StoreFeedbooksStore,
diff --git a/src/calibre/gui2/store/ebookshoppe_uk_plugin.py b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
index b45b0e99d5..afe4d6ccc5 100644
--- a/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
+++ b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
@@ -62,18 +62,17 @@ class EBookShoppeUKStore(BasicStoreConfig, StorePlugin):
s = SearchResult()
s.cover_url = cover_url
s.title = title.strip()
- # Set the author to the query terms to ensure that author
- # queries match something when pruning searches. Of course, this
- # means that all books will match. Sigh...
- s.author = query
s.price = price
s.drm = SearchResult.DRM_UNLOCKED
s.detail_item = id
- s.formats = ''
+
+ self.my_get_details(s, timeout)
+ if not s.author:
+ continue
yield s
- def get_details(self, search_result, timeout):
+ def my_get_details(self, search_result, timeout):
br = browser()
with closing(br.open(search_result.detail_item, timeout=timeout)) as nf:
idata = html.fromstring(nf.read())
From b244246fceffdc5781add6a58ee17c4e3d30ed56 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sat, 28 May 2011 16:21:45 +0100
Subject: [PATCH 12/44] Add WH Smith. Improve ebookshoppe_uk
---
src/calibre/customize/builtins.py | 60 +++++++++++---
.../gui2/store/ebookshoppe_uk_plugin.py | 8 +-
src/calibre/gui2/store/whsmith_uk_plugin.py | 83 +++++++++++++++++++
3 files changed, 134 insertions(+), 17 deletions(-)
create mode 100644 src/calibre/gui2/store/whsmith_uk_plugin.py
diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py
index 0b83d0f45b..f1afb62cbc 100644
--- a/src/calibre/customize/builtins.py
+++ b/src/calibre/customize/builtins.py
@@ -1143,6 +1143,7 @@ class StoreArchiveOrgStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['DAISY', 'DJVU', 'EPUB', 'MOBI', 'PDF', 'TXT']
+ affiliate = False
class StoreBaenWebScriptionStore(StoreBase):
name = 'Baen WebScription'
@@ -1152,6 +1153,7 @@ class StoreBaenWebScriptionStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'LIT', 'LRF', 'MOBI', 'RB', 'RTF', 'ZIP']
+ affiliate = False
class StoreBNStore(StoreBase):
name = 'Barnes and Noble'
@@ -1161,6 +1163,7 @@ class StoreBNStore(StoreBase):
drm_free_only = False
headquarters = 'US'
formats = ['NOOK']
+ affiliate = True
class StoreBeamEBooksDEStore(StoreBase):
name = 'Beam EBooks DE'
@@ -1181,6 +1184,7 @@ class StoreBeWriteStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'MOBI', 'PDF']
+ affiliate = False
class StoreDieselEbooksStore(StoreBase):
name = 'Diesel eBooks'
@@ -1190,6 +1194,7 @@ class StoreDieselEbooksStore(StoreBase):
drm_free_only = False
headquarters = 'US'
formats = ['EPUB', 'PDF']
+ affiliate = True
class StoreEbookscomStore(StoreBase):
name = 'eBooks.com'
@@ -1199,6 +1204,18 @@ class StoreEbookscomStore(StoreBase):
drm_free_only = False
headquarters = 'US'
formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
+ affiliate = True
+
+class StoreEPubBuyDEStore(StoreBase):
+ name = 'EPUBBuy DE'
+ author = 'Charles Haley'
+ description = u'Bei EPUBBuy.com finden Sie ausschliesslich eBooks im weitverbreiteten EPUB-Format und ohne DRM. So haben Sie die freie Wahl, wo Sie Ihr eBook lesen: Tablet, eBook-Reader, Smartphone oder einfach auf Ihrem PC. So macht eBook-Lesen Spaß!'
+ actual_plugin = 'calibre.gui2.store.epubbuy_de_plugin:EPubBuyDEStore'
+
+ drm_free_only = True
+ headquarters = 'DE'
+ formats = ['EPUB']
+ affiliate = True
class StoreEBookShoppeUKStore(StoreBase):
name = 'ebookShoppe UK'
@@ -1211,16 +1228,6 @@ class StoreEBookShoppeUKStore(StoreBase):
formats = ['EPUB', 'PDF']
affiliate = True
-class StoreEPubBuyDEStore(StoreBase):
- name = 'EPUBBuy DE'
- author = 'Charles Haley'
- description = u'Bei EPUBBuy.com finden Sie ausschliesslich eBooks im weitverbreiteten EPUB-Format und ohne DRM. So haben Sie die freie Wahl, wo Sie Ihr eBook lesen: Tablet, eBook-Reader, Smartphone oder einfach auf Ihrem PC. So macht eBook-Lesen Spaß!'
- actual_plugin = 'calibre.gui2.store.epubbuy_de_plugin:EPubBuyDEStore'
-
- drm_free_only = True
- headquarters = 'DE'
- formats = ['EPUB']
-
class StoreEHarlequinStore(StoreBase):
name = 'eHarlequin'
description = u'A global leader in series romance and one of the world\'s leading publishers of books for women. Offers women a broad range of reading from romance to bestseller fiction, from young adult novels to erotic literature, from nonfiction to fantasy, from African-American novels to inspirational romance, and more.'
@@ -1229,6 +1236,7 @@ class StoreEHarlequinStore(StoreBase):
drm_free_only = False
headquarters = 'CA'
formats = ['EPUB', 'PDF']
+ affiliate = True
class StoreFeedbooksStore(StoreBase):
name = 'Feedbooks'
@@ -1238,6 +1246,7 @@ class StoreFeedbooksStore(StoreBase):
drm_free_only = False
headquarters = 'FR'
formats = ['EPUB', 'MOBI', 'PDF']
+ affiliate = False
class StoreFoylesUKStore(StoreBase):
name = 'Foyles UK'
@@ -1259,6 +1268,7 @@ class StoreGandalfStore(StoreBase):
drm_free_only = False
headquarters = 'PL'
formats = ['EPUB', 'PDF']
+ affiliate = False
class StoreGoogleBooksStore(StoreBase):
name = 'Google Books'
@@ -1268,6 +1278,7 @@ class StoreGoogleBooksStore(StoreBase):
drm_free_only = False
headquarters = 'US'
formats = ['EPUB', 'PDF', 'TXT']
+ affiliate = False
class StoreGutenbergStore(StoreBase):
name = 'Project Gutenberg'
@@ -1277,6 +1288,7 @@ class StoreGutenbergStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'HTML', 'MOBI', 'PDB', 'TXT']
+ affiliate = False
class StoreKoboStore(StoreBase):
name = 'Kobo'
@@ -1286,6 +1298,7 @@ class StoreKoboStore(StoreBase):
drm_free_only = False
headquarters = 'CA'
formats = ['EPUB']
+ affiliate = True
class StoreLegimiStore(StoreBase):
name = 'Legimi'
@@ -1296,6 +1309,7 @@ class StoreLegimiStore(StoreBase):
drm_free_only = False
headquarters = 'PL'
formats = ['EPUB']
+ affiliate = False
class StoreManyBooksStore(StoreBase):
name = 'ManyBooks'
@@ -1305,6 +1319,7 @@ class StoreManyBooksStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'FB2', 'JAR', 'LIT', 'LRF', 'MOBI', 'PDB', 'PDF', 'RB', 'RTF', 'TCR', 'TXT', 'ZIP']
+ affiliate = False
class StoreMobileReadStore(StoreBase):
name = 'MobileRead'
@@ -1314,6 +1329,7 @@ class StoreMobileReadStore(StoreBase):
drm_free_only = True
headquarters = 'CH'
formats = ['EPUB', 'IMP', 'LRF', 'LIT', 'MOBI', 'PDF']
+ affiliate = False
class StoreNextoStore(StoreBase):
name = 'Nexto'
@@ -1324,6 +1340,7 @@ class StoreNextoStore(StoreBase):
drm_free_only = False
headquarters = 'PL'
formats = ['EPUB', 'PDF']
+ affiliate = True
class StoreOpenLibraryStore(StoreBase):
name = 'Open Library'
@@ -1333,6 +1350,7 @@ class StoreOpenLibraryStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['DAISY', 'DJVU', 'EPUB', 'MOBI', 'PDF', 'TXT']
+ affiliate = False
class StoreOReillyStore(StoreBase):
name = 'OReilly'
@@ -1342,6 +1360,7 @@ class StoreOReillyStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['APK', 'DAISY', 'EPUB', 'MOBI', 'PDF']
+ affiliate = False
class StorePragmaticBookshelfStore(StoreBase):
name = 'Pragmatic Bookshelf'
@@ -1351,6 +1370,7 @@ class StorePragmaticBookshelfStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'MOBI', 'PDF']
+ affiliate = False
class StoreSmashwordsStore(StoreBase):
name = 'Smashwords'
@@ -1360,6 +1380,7 @@ class StoreSmashwordsStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'HTML', 'LRF', 'MOBI', 'PDB', 'RTF', 'TXT']
+ affiliate = True
class StoreVirtualoStore(StoreBase):
name = 'Virtualo'
@@ -1370,6 +1391,7 @@ class StoreVirtualoStore(StoreBase):
drm_free_only = False
headquarters = 'PL'
formats = ['EPUB', 'PDF']
+ affiliate = False
class StoreWaterstonesUKStore(StoreBase):
name = 'Waterstones UK'
@@ -1380,6 +1402,7 @@ class StoreWaterstonesUKStore(StoreBase):
drm_free_only = False
headquarters = 'UK'
formats = ['EPUB', 'PDF']
+ affiliate = False
class StoreWeightlessBooksStore(StoreBase):
name = 'Weightless Books'
@@ -1389,6 +1412,18 @@ class StoreWeightlessBooksStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'HTML', 'LIT', 'MOBI', 'PDF']
+ affiliate = False
+
+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."
+ actual_plugin = 'calibre.gui2.store.whsmith_uk_plugin:WHSmithUKStore'
+
+ drm_free_only = False
+ headquarters = 'UK'
+ formats = ['EPUB', 'PDF']
+ affiliate = False
class StoreWizardsTowerBooksStore(StoreBase):
name = 'Wizards Tower Books'
@@ -1398,6 +1433,7 @@ class StoreWizardsTowerBooksStore(StoreBase):
drm_free_only = True
headquarters = 'UK'
formats = ['EPUB', 'MOBI']
+ affiliate = False
class StoreWoblinkStore(StoreBase):
name = 'Woblink'
@@ -1408,6 +1444,7 @@ class StoreWoblinkStore(StoreBase):
drm_free_only = False
headquarters = 'PL'
formats = ['EPUB']
+ affiliate = False
plugins += [
StoreArchiveOrgStore,
@@ -1420,7 +1457,7 @@ plugins += [
StoreBeWriteStore,
StoreDieselEbooksStore,
StoreEbookscomStore,
- #StoreEBookShoppeUKStore,
+ StoreEBookShoppeUKStore,
StoreEPubBuyDEStore,
StoreEHarlequinStore,
StoreFeedbooksStore,
@@ -1440,6 +1477,7 @@ plugins += [
StoreVirtualoStore,
StoreWaterstonesUKStore,
StoreWeightlessBooksStore,
+ StoreWHSmithUKStore,
StoreWizardsTowerBooksStore,
StoreWoblinkStore
]
diff --git a/src/calibre/gui2/store/ebookshoppe_uk_plugin.py b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
index b45b0e99d5..21bef85db9 100644
--- a/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
+++ b/src/calibre/gui2/store/ebookshoppe_uk_plugin.py
@@ -62,18 +62,14 @@ class EBookShoppeUKStore(BasicStoreConfig, StorePlugin):
s = SearchResult()
s.cover_url = cover_url
s.title = title.strip()
- # Set the author to the query terms to ensure that author
- # queries match something when pruning searches. Of course, this
- # means that all books will match. Sigh...
- s.author = query
s.price = price
s.drm = SearchResult.DRM_UNLOCKED
s.detail_item = id
- s.formats = ''
+ self.get_author_and_formats(s, timeout)
yield s
- def get_details(self, search_result, timeout):
+ def get_author_and_formats(self, search_result, timeout):
br = browser()
with closing(br.open(search_result.detail_item, timeout=timeout)) as nf:
idata = html.fromstring(nf.read())
diff --git a/src/calibre/gui2/store/whsmith_uk_plugin.py b/src/calibre/gui2/store/whsmith_uk_plugin.py
new file mode 100644
index 0000000000..66d81258f7
--- /dev/null
+++ b/src/calibre/gui2/store/whsmith_uk_plugin.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import (unicode_literals, division, absolute_import, print_function)
+
+__license__ = 'GPL 3'
+__copyright__ = '2011, John Schember '
+__docformat__ = 'restructuredtext en'
+
+import urllib2
+from contextlib import closing
+
+from lxml import html
+
+from PyQt4.Qt import QUrl
+
+from calibre import browser
+from calibre.gui2 import open_url
+from calibre.gui2.store import StorePlugin
+from calibre.gui2.store.basic_config import BasicStoreConfig
+from calibre.gui2.store.search_result import SearchResult
+from calibre.gui2.store.web_store_dialog import WebStoreDialog
+
+class WHSmithUKStore(BasicStoreConfig, StorePlugin):
+
+ def open(self, parent=None, detail_item=None, external=False):
+ url = 'http://www.whsmith.co.uk/'
+ url_details = ''
+
+ if external or self.config.get('open_external', False):
+ if detail_item:
+ url = url_details + detail_item
+ open_url(QUrl(url))
+ else:
+ detail_url = None
+ if detail_item:
+ detail_url = url_details + detail_item
+ d = WebStoreDialog(self.gui, url, parent, detail_url)
+ d.setWindowTitle(self.name)
+ d.set_tags(self.config.get('tags', ''))
+ d.exec_()
+
+ def search(self, query, max_results=10, timeout=60):
+ url = ('http://www.whsmith.co.uk/CatalogAndSearch/SearchWithinCategory.aspx'
+ '?cat=\Books\eb_eBooks&gq=' + urllib2.quote(query))
+
+ br = browser()
+
+ counter = max_results
+ with closing(br.open(url, timeout=timeout)) as f:
+ doc = html.fromstring(f.read())
+ for data in doc.xpath('//div[@class="product-search"]/'
+ 'div[contains(@id, "whsSearchResultItem")]'):
+ if counter <= 0:
+ break
+
+ id = ''.join(data.xpath('.//a[contains(@id, "labelProductTitle")]/@href'))
+ if not id:
+ continue
+ cover_url = ''.join(data.xpath('.//a[contains(@id, "hlinkProductImage")]/img/@src'))
+ title = ''.join(data.xpath('.//a[contains(@id, "labelProductTitle")]/text()'))
+ author = ', '.join(data.xpath('.//div[@class="author"]/h3/span/text()'))
+ price = ''.join(data.xpath('.//span[contains(@id, "labelProductPrice")]/text()'))
+ pdf = data.xpath('boolean(.//span[contains(@id, "labelFormatText") and '
+ 'contains(., "PDF")])')
+ epub = data.xpath('boolean(.//span[contains(@id, "labelFormatText") and '
+ 'contains(., "ePub")])')
+ counter -= 1
+
+ s = SearchResult()
+ s.cover_url = cover_url
+ s.title = title.strip()
+ s.author = author.strip()
+ s.price = price
+ s.drm = SearchResult.DRM_LOCKED
+ s.detail_item = id
+ formats = []
+ if epub:
+ formats.append('ePub')
+ if pdf:
+ formats.append('PDF')
+ s.formats = ', '.join(formats)
+
+ yield s
From 66571550e9181a39debcbdad8ded2c80d89886d7 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sat, 28 May 2011 16:57:37 +0100
Subject: [PATCH 13/44] 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'))
From 3a93e4561ce20dd76bfb1f6af3593b9989818f2b Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sat, 28 May 2011 18:59:30 +0100
Subject: [PATCH 14/44] Fix amazon UK grid. Add tooltip to heart on menu.
---
src/calibre/gui2/store/amazon_uk_plugin.py | 84 ++++++++++++++++++++++
src/calibre/gui2/store/search/search.py | 1 +
2 files changed, 85 insertions(+)
diff --git a/src/calibre/gui2/store/amazon_uk_plugin.py b/src/calibre/gui2/store/amazon_uk_plugin.py
index 9544add17c..1448e1548a 100644
--- a/src/calibre/gui2/store/amazon_uk_plugin.py
+++ b/src/calibre/gui2/store/amazon_uk_plugin.py
@@ -6,11 +6,17 @@ __license__ = 'GPL 3'
__copyright__ = '2011, John Schember '
__docformat__ = 'restructuredtext en'
+import urllib
+from contextlib import closing
+
+from lxml import html
from PyQt4.Qt import QUrl
+from calibre import browser
from calibre.gui2 import open_url
from calibre.gui2.store.amazon_plugin import AmazonKindleStore
+from calibre.gui2.store.search_result import SearchResult
class AmazonUKKindleStore(AmazonKindleStore):
'''
@@ -28,3 +34,81 @@ class AmazonUKKindleStore(AmazonKindleStore):
aff_id['asin'] = detail_item
store_link = 'http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&location=http://www.amazon.co.uk/dp/%(asin)s&tag=%(tag)s&linkCode=ur2&camp=1634&creative=6738' % aff_id
open_url(QUrl(store_link))
+
+ def search(self, query, max_results=10, timeout=60):
+ url = self.search_url + urllib.quote_plus(query)
+ br = browser()
+
+ counter = max_results
+ with closing(br.open(url, timeout=timeout)) as f:
+ doc = html.fromstring(f.read())
+
+ # Amazon has two results pages.
+ is_shot = doc.xpath('boolean(//div[@id="shotgunMainResults"])')
+ # Horizontal grid of books.
+ if is_shot:
+ data_xpath = '//div[contains(@class, "result")]'
+ cover_xpath = './/div[@class="productTitle"]//img/@src'
+ # Vertical list of books.
+ else:
+ data_xpath = '//div[contains(@class, "product")]'
+ cover_xpath = './div[@class="productImage"]/a/img/@src'
+
+ for data in doc.xpath(data_xpath):
+ if counter <= 0:
+ break
+
+ # We must have an asin otherwise we can't easily reference the
+ # book later.
+ asin = ''.join(data.xpath('./@name'))
+ if not asin:
+ continue
+ cover_url = ''.join(data.xpath(cover_xpath))
+
+ title = ''.join(data.xpath('.//div[@class="productTitle"]/a/text()'))
+ price = ''.join(data.xpath('.//div[@class="newPrice"]/span/text()'))
+
+ counter -= 1
+
+ s = SearchResult()
+ s.cover_url = cover_url.strip()
+ s.title = title.strip()
+ s.price = price.strip()
+ s.detail_item = asin.strip()
+ s.formats = 'Kindle'
+
+ if is_shot:
+ # Amazon UK does not include the author on the grid layout
+ s.author = ''
+ self.get_details(s, timeout)
+ else:
+ author = ''.join(data.xpath('.//div[@class="productTitle"]/span[@class="ptBrand"]/text()'))
+ s.author = author.split(' by ')[-1].strip()
+
+ yield s
+
+ def get_details(self, search_result, timeout):
+ # We might already have been called.
+ if search_result.drm:
+ return
+
+ url = self.details_url
+
+ br = browser()
+ with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf:
+ idata = html.fromstring(nf.read())
+ if not search_result.author:
+ search_result.author = ''.join(idata.xpath('//div[@class="buying" and contains(., "Author")]/a/text()'))
+ if idata.xpath('boolean(//div[@class="content"]//li/b[contains(text(), "' +
+ self.drm_search_text + '")])'):
+ if idata.xpath('boolean(//div[@class="content"]//li[contains(., "' +
+ self.drm_free_text + '") and contains(b, "' +
+ self.drm_search_text + '")])'):
+ search_result.drm = SearchResult.DRM_UNLOCKED
+ else:
+ search_result.drm = SearchResult.DRM_UNKNOWN
+ else:
+ search_result.drm = SearchResult.DRM_LOCKED
+ return True
+
+
diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py
index 7ce6c93c68..9e60223a3d 100644
--- a/src/calibre/gui2/store/search/search.py
+++ b/src/calibre/gui2/store/search/search.py
@@ -103,6 +103,7 @@ class SearchDialog(QDialog, Ui_Dialog):
store_list_layout.addWidget(cbox, i, 0, 1, 1)
if self.gui.istores[x].base_plugin.affiliate:
iw = QLabel(self)
+ iw.setToolTip(_('Buying from this store supports a calibre developer'))
iw.setPixmap(icon.pixmap(16, 16))
store_list_layout.addWidget(iw, i, 1, 1, 1)
self.store_checks[x] = cbox
From 542d65bdc000f54e5d4c5a53430640a707d8ae40 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 15:42:31 -0400
Subject: [PATCH 15/44] Store: Remove redundant setting of variables.
---
src/calibre/customize/builtins.py | 38 -------------------------------
1 file changed, 38 deletions(-)
diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py
index cd5f81067f..5cde30f72e 100644
--- a/src/calibre/customize/builtins.py
+++ b/src/calibre/customize/builtins.py
@@ -1108,7 +1108,6 @@ class StoreAmazonKindleStore(StoreBase):
description = u'Kindle books from Amazon.'
actual_plugin = 'calibre.gui2.store.amazon_plugin:AmazonKindleStore'
- drm_free_only = False
headquarters = 'US'
formats = ['KINDLE']
affiliate = True
@@ -1119,7 +1118,6 @@ class StoreAmazonDEKindleStore(StoreBase):
description = u'Kindle Bücher von Amazon.'
actual_plugin = 'calibre.gui2.store.amazon_de_plugin:AmazonDEKindleStore'
- drm_free_only = False
headquarters = 'DE'
formats = ['KINDLE']
affiliate = True
@@ -1130,7 +1128,6 @@ class StoreAmazonUKKindleStore(StoreBase):
description = u'Kindle books from Amazon\'s UK web site. Also, includes French language ebooks.'
actual_plugin = 'calibre.gui2.store.amazon_uk_plugin:AmazonUKKindleStore'
- drm_free_only = False
headquarters = 'UK'
formats = ['KINDLE']
affiliate = True
@@ -1143,7 +1140,6 @@ class StoreArchiveOrgStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['DAISY', 'DJVU', 'EPUB', 'MOBI', 'PDF', 'TXT']
- affiliate = False
class StoreBaenWebScriptionStore(StoreBase):
name = 'Baen WebScription'
@@ -1153,14 +1149,12 @@ class StoreBaenWebScriptionStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'LIT', 'LRF', 'MOBI', 'RB', 'RTF', 'ZIP']
- affiliate = False
class StoreBNStore(StoreBase):
name = 'Barnes and Noble'
description = u'The world\'s largest book seller. As the ultimate destination for book lovers, Barnes & Noble.com offers an incredible array of content.'
actual_plugin = 'calibre.gui2.store.bn_plugin:BNStore'
- drm_free_only = False
headquarters = 'US'
formats = ['NOOK']
affiliate = True
@@ -1184,14 +1178,12 @@ class StoreBeWriteStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'MOBI', 'PDF']
- affiliate = False
class StoreDieselEbooksStore(StoreBase):
name = 'Diesel eBooks'
description = u'Instant access to over 2.4 million titles from hundreds of publishers including Harlequin, HarperCollins, John Wiley & Sons, McGraw-Hill, Simon & Schuster and Random House.'
actual_plugin = 'calibre.gui2.store.diesel_ebooks_plugin:DieselEbooksStore'
- drm_free_only = False
headquarters = 'US'
formats = ['EPUB', 'PDF']
affiliate = True
@@ -1201,7 +1193,6 @@ class StoreEbookscomStore(StoreBase):
description = u'Sells books in multiple electronic formats in all categories. Technical infrastructure is cutting edge, robust and scalable, with servers in the US and Europe.'
actual_plugin = 'calibre.gui2.store.ebooks_com_plugin:EbookscomStore'
- drm_free_only = False
headquarters = 'US'
formats = ['EPUB', 'LIT', 'MOBI', 'PDF']
affiliate = True
@@ -1223,7 +1214,6 @@ class StoreEBookShoppeUKStore(StoreBase):
description = u'We made this website in an attempt to offer the widest range of UK eBooks possible across and as many formats as we could manage.'
actual_plugin = 'calibre.gui2.store.ebookshoppe_uk_plugin:EBookShoppeUKStore'
- drm_free_only = False
headquarters = 'UK'
formats = ['EPUB', 'PDF']
affiliate = True
@@ -1233,7 +1223,6 @@ class StoreEHarlequinStore(StoreBase):
description = u'A global leader in series romance and one of the world\'s leading publishers of books for women. Offers women a broad range of reading from romance to bestseller fiction, from young adult novels to erotic literature, from nonfiction to fantasy, from African-American novels to inspirational romance, and more.'
actual_plugin = 'calibre.gui2.store.eharlequin_plugin:EHarlequinStore'
- drm_free_only = False
headquarters = 'CA'
formats = ['EPUB', 'PDF']
affiliate = True
@@ -1243,10 +1232,8 @@ class StoreFeedbooksStore(StoreBase):
description = u'Feedbooks is a cloud publishing and distribution service, connected to a large ecosystem of reading systems and social networks. Provides a variety of genres from independent and classic books.'
actual_plugin = 'calibre.gui2.store.feedbooks_plugin:FeedbooksStore'
- drm_free_only = False
headquarters = 'FR'
formats = ['EPUB', 'MOBI', 'PDF']
- affiliate = False
class StoreFoylesUKStore(StoreBase):
name = 'Foyles UK'
@@ -1254,7 +1241,6 @@ class StoreFoylesUKStore(StoreBase):
description = u'Foyles of London\'s ebook store. Provides extensive range covering all subjects.'
actual_plugin = 'calibre.gui2.store.foyles_uk_plugin:FoylesUKStore'
- drm_free_only = False
headquarters = 'UK'
formats = ['EPUB', 'PDF']
affiliate = True
@@ -1265,20 +1251,16 @@ class StoreGandalfStore(StoreBase):
description = u'Księgarnia internetowa Gandalf.'
actual_plugin = 'calibre.gui2.store.gandalf_plugin:GandalfStore'
- drm_free_only = False
headquarters = 'PL'
formats = ['EPUB', 'PDF']
- affiliate = False
class StoreGoogleBooksStore(StoreBase):
name = 'Google Books'
description = u'Google Books'
actual_plugin = 'calibre.gui2.store.google_books_plugin:GoogleBooksStore'
- drm_free_only = False
headquarters = 'US'
formats = ['EPUB', 'PDF', 'TXT']
- affiliate = False
class StoreGutenbergStore(StoreBase):
name = 'Project Gutenberg'
@@ -1288,14 +1270,12 @@ class StoreGutenbergStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'HTML', 'MOBI', 'PDB', 'TXT']
- affiliate = False
class StoreKoboStore(StoreBase):
name = 'Kobo'
description = u'With over 2.3 million eBooks to browse we have engaged readers in over 200 countries in Kobo eReading. Our eBook listings include New York Times Bestsellers, award winners, classics and more!'
actual_plugin = 'calibre.gui2.store.kobo_plugin:KoboStore'
- drm_free_only = False
headquarters = 'CA'
formats = ['EPUB']
affiliate = True
@@ -1306,10 +1286,8 @@ class StoreLegimiStore(StoreBase):
description = u'Tanie oraz darmowe ebooki, egazety i blogi w formacie EPUB, wprost na Twój e-czytnik, iPhone, iPad, Android i komputer'
actual_plugin = 'calibre.gui2.store.legimi_plugin:LegimiStore'
- drm_free_only = False
headquarters = 'PL'
formats = ['EPUB']
- affiliate = False
class StoreManyBooksStore(StoreBase):
name = 'ManyBooks'
@@ -1319,7 +1297,6 @@ class StoreManyBooksStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'FB2', 'JAR', 'LIT', 'LRF', 'MOBI', 'PDB', 'PDF', 'RB', 'RTF', 'TCR', 'TXT', 'ZIP']
- affiliate = False
class StoreMobileReadStore(StoreBase):
name = 'MobileRead'
@@ -1329,7 +1306,6 @@ class StoreMobileReadStore(StoreBase):
drm_free_only = True
headquarters = 'CH'
formats = ['EPUB', 'IMP', 'LRF', 'LIT', 'MOBI', 'PDF']
- affiliate = False
class StoreNextoStore(StoreBase):
name = 'Nexto'
@@ -1337,7 +1313,6 @@ class StoreNextoStore(StoreBase):
description = u'Największy w Polsce sklep internetowy z audiobookami mp3, ebookami pdf oraz prasą do pobrania on-line.'
actual_plugin = 'calibre.gui2.store.nexto_plugin:NextoStore'
- drm_free_only = False
headquarters = 'PL'
formats = ['EPUB', 'PDF']
affiliate = True
@@ -1350,7 +1325,6 @@ class StoreOpenLibraryStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['DAISY', 'DJVU', 'EPUB', 'MOBI', 'PDF', 'TXT']
- affiliate = False
class StoreOReillyStore(StoreBase):
name = 'OReilly'
@@ -1360,7 +1334,6 @@ class StoreOReillyStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['APK', 'DAISY', 'EPUB', 'MOBI', 'PDF']
- affiliate = False
class StorePragmaticBookshelfStore(StoreBase):
name = 'Pragmatic Bookshelf'
@@ -1370,7 +1343,6 @@ class StorePragmaticBookshelfStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'MOBI', 'PDF']
- affiliate = False
class StoreSmashwordsStore(StoreBase):
name = 'Smashwords'
@@ -1388,10 +1360,8 @@ class StoreVirtualoStore(StoreBase):
description = u'Księgarnia internetowa, która oferuje bezpieczny i szeroki dostęp do książek w formie cyfrowej.'
actual_plugin = 'calibre.gui2.store.virtualo_plugin:VirtualoStore'
- drm_free_only = False
headquarters = 'PL'
formats = ['EPUB', 'PDF']
- affiliate = False
class StoreWaterstonesUKStore(StoreBase):
name = 'Waterstones UK'
@@ -1399,10 +1369,8 @@ class StoreWaterstonesUKStore(StoreBase):
description = u'Waterstone\'s mission is to be the leading Bookseller on the High Street and online providing customers the widest choice, great value and expert advice from a team passionate about Bookselling.'
actual_plugin = 'calibre.gui2.store.waterstones_uk_plugin:WaterstonesUKStore'
- drm_free_only = False
headquarters = 'UK'
formats = ['EPUB', 'PDF']
- affiliate = False
class StoreWeightlessBooksStore(StoreBase):
name = 'Weightless Books'
@@ -1412,7 +1380,6 @@ class StoreWeightlessBooksStore(StoreBase):
drm_free_only = True
headquarters = 'US'
formats = ['EPUB', 'HTML', 'LIT', 'MOBI', 'PDF']
- affiliate = False
class StoreWHSmithUKStore(StoreBase):
name = 'WH Smith UK'
@@ -1420,10 +1387,8 @@ class StoreWHSmithUKStore(StoreBase):
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
headquarters = 'UK'
formats = ['EPUB', 'PDF']
- affiliate = False
class StoreWizardsTowerBooksStore(StoreBase):
name = 'Wizards Tower Books'
@@ -1433,7 +1398,6 @@ class StoreWizardsTowerBooksStore(StoreBase):
drm_free_only = True
headquarters = 'UK'
formats = ['EPUB', 'MOBI']
- affiliate = False
class StoreWoblinkStore(StoreBase):
name = 'Woblink'
@@ -1441,10 +1405,8 @@ class StoreWoblinkStore(StoreBase):
description = u'Czytanie zdarza się wszędzie!'
actual_plugin = 'calibre.gui2.store.woblink_plugin:WoblinkStore'
- drm_free_only = False
headquarters = 'PL'
formats = ['EPUB']
- affiliate = False
plugins += [
StoreArchiveOrgStore,
From 66315cead2b6f2ff0e0c60d890387b05867fb933 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 16:14:57 -0400
Subject: [PATCH 16/44] Store: Make use of donate.png consistant with other
images.
---
.../store/config/chooser/chooser_widget.ui | 45 +++++++++++++++++++
src/calibre/gui2/store/search/models.py | 8 ++--
2 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.ui b/src/calibre/gui2/store/config/chooser/chooser_widget.ui
index e833dbf4b9..4c2f136b62 100644
--- a/src/calibre/gui2/store/config/chooser/chooser_widget.ui
+++ b/src/calibre/gui2/store/config/chooser/chooser_widget.ui
@@ -80,6 +80,51 @@
+ -
+
+
-
+
+
+ Select:
+
+
+
+ -
+
+
+ All
+
+
+
+ -
+
+
+ None
+
+
+
+ -
+
+
+ Invert
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index 25d30e3385..9b2966d0eb 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -45,6 +45,8 @@ class Matches(QAbstractItemModel):
Qt.SmoothTransformation)
self.DRM_UNKNOWN_ICON = QPixmap(I('dialog_question.png')).scaledToHeight(64,
Qt.SmoothTransformation)
+ self.DONATE_ICON = QPixmap(I('donate.png')).scaledToHeight(16,
+ Qt.SmoothTransformation)
# All matches. Used to determine the order to display
# self.matches because the SearchFilter returns
@@ -180,11 +182,7 @@ class Matches(QAbstractItemModel):
return QVariant(self.DRM_UNKNOWN_ICON)
if col == 5:
if result.affiliate:
- # For some reason the size(16, 16) is forgotten if the icon
- # is a class attribute. Don't know why...
- icon = QIcon()
- icon.addFile(I('donate.png'), QSize(16, 16))
- return QVariant(icon)
+ return QVariant(self.DONATE_ICON)
return NONE
elif role == Qt.ToolTipRole:
if col == 1:
From a46954edf9675139ff26b5724e8c031be2eeed94 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 16:55:57 -0400
Subject: [PATCH 17/44] Store: Advance search for affiliate. Clean up tool
tips. Add quick enable buttons in chooser. Add affiliate status in chooser.
---
.../config/chooser/adv_search_builder.py | 8 ++-
.../config/chooser/adv_search_builder.ui | 30 ++++++++++-
.../store/config/chooser/chooser_widget.py | 3 ++
.../store/config/chooser/chooser_widget.ui | 8 +--
.../gui2/store/config/chooser/models.py | 52 ++++++++++++++-----
.../gui2/store/search/adv_search_builder.py | 6 ++-
.../gui2/store/search/adv_search_builder.ui | 30 ++++++++++-
.../gui2/store/search/download_thread.py | 1 +
src/calibre/gui2/store/search/models.py | 2 +-
src/calibre/gui2/store/search/search.py | 2 +-
src/calibre/gui2/store/search_result.py | 1 +
11 files changed, 118 insertions(+), 25 deletions(-)
diff --git a/src/calibre/gui2/store/config/chooser/adv_search_builder.py b/src/calibre/gui2/store/config/chooser/adv_search_builder.py
index 7b519abcd1..d22554b111 100644
--- a/src/calibre/gui2/store/config/chooser/adv_search_builder.py
+++ b/src/calibre/gui2/store/config/chooser/adv_search_builder.py
@@ -45,8 +45,9 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
self.description_box.setText('')
self.headquarters_box.setText('')
self.format_box.setText('')
- self.enabled_combo.setIndex(0)
- self.drm_combo.setIndex(0)
+ self.enabled_combo.setCurrentIndex(0)
+ self.drm_combo.setCurrentIndex(0)
+ self.affiliate_combo.setCurrentIndex(0)
def tokens(self, raw):
phrases = re.findall(r'\s*".*?"\s*', raw)
@@ -126,6 +127,9 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
drm = unicode(self.drm_combo.currentText()).strip()
if drm:
ans.append('drm:' + drm)
+ affiliate = unicode(self.affiliate_combo.currentText()).strip()
+ if affiliate:
+ ans.append('affiliate:' + affiliate)
if ans:
return ' and '.join(ans)
return ''
diff --git a/src/calibre/gui2/store/config/chooser/adv_search_builder.ui b/src/calibre/gui2/store/config/chooser/adv_search_builder.ui
index 7d57321c72..3ace8ef04e 100644
--- a/src/calibre/gui2/store/config/chooser/adv_search_builder.ui
+++ b/src/calibre/gui2/store/config/chooser/adv_search_builder.ui
@@ -226,7 +226,7 @@
- -
+
-
-
@@ -244,7 +244,7 @@
- -
+
-
Qt::Vertical
@@ -335,6 +335,32 @@
+ -
+
+
+ Affiliate:
+
+
+
+ -
+
+
-
+
+
+
+
+ -
+
+ true
+
+
+ -
+
+ false
+
+
+
+
diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.py b/src/calibre/gui2/store/config/chooser/chooser_widget.py
index 2f8c72d3d0..cc1db488f1 100644
--- a/src/calibre/gui2/store/config/chooser/chooser_widget.py
+++ b/src/calibre/gui2/store/config/chooser/chooser_widget.py
@@ -23,6 +23,9 @@ class StoreChooserWidget(QWidget, Ui_Form):
self.search.clicked.connect(self.do_search)
self.adv_search_builder.clicked.connect(self.build_adv_search)
+ self.enable_all.clicked.connect(self.results_view.model().enable_all)
+ self.enable_none.clicked.connect(self.results_view.model().enable_none)
+ self.enable_invert.clicked.connect(self.results_view.model().enable_invert)
self.results_view.activated.connect(self.toggle_plugin)
def do_search(self):
diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.ui b/src/calibre/gui2/store/config/chooser/chooser_widget.ui
index 4c2f136b62..7513cdd752 100644
--- a/src/calibre/gui2/store/config/chooser/chooser_widget.ui
+++ b/src/calibre/gui2/store/config/chooser/chooser_widget.ui
@@ -85,26 +85,26 @@
-
- Select:
+ Enable
-
-
+
All
-
-
+
None
-
-
+
Invert
diff --git a/src/calibre/gui2/store/config/chooser/models.py b/src/calibre/gui2/store/config/chooser/models.py
index 6c95d74ffc..dbda367fae 100644
--- a/src/calibre/gui2/store/config/chooser/models.py
+++ b/src/calibre/gui2/store/config/chooser/models.py
@@ -6,7 +6,7 @@ __license__ = 'GPL 3'
__copyright__ = '2011, John Schember '
__docformat__ = 'restructuredtext en'
-from PyQt4.Qt import (Qt, QAbstractItemModel, QIcon, QVariant, QModelIndex)
+from PyQt4.Qt import (Qt, QAbstractItemModel, QIcon, QVariant, QModelIndex, QSize)
from calibre.gui2 import NONE
from calibre.customize.ui import is_disabled, disable_plugin, enable_plugin
@@ -18,13 +18,15 @@ from calibre.utils.search_query_parser import SearchQueryParser
class Matches(QAbstractItemModel):
- HEADERS = [_('Enabled'), _('Name'), _('No DRM'), _('Headquarters'), _('Formats')]
+ HEADERS = [_('Enabled'), _('Name'), _('No DRM'), _('Headquarters'), _('Affiliate'), _('Formats')]
HTML_COLS = [1]
def __init__(self, plugins):
QAbstractItemModel.__init__(self)
self.NO_DRM_ICON = QIcon(I('ok.png'))
+ self.DONATE_ICON = QIcon()
+ self.DONATE_ICON.addFile(I('donate.png'), QSize(16, 16))
self.all_matches = plugins
self.matches = plugins
@@ -53,6 +55,22 @@ class Matches(QAbstractItemModel):
self.layoutChanged.emit()
self.sort(self.sort_col, self.sort_order)
+ def enable_all(self):
+ for i in xrange(len(self.matches)):
+ index = self.createIndex(i, 0)
+ data = QVariant(True)
+ self.setData(index, data, Qt.CheckStateRole)
+
+ def enable_none(self):
+ for i in xrange(len(self.matches)):
+ index = self.createIndex(i, 0)
+ data = QVariant(False)
+ self.setData(index, data, Qt.CheckStateRole)
+
+ def enable_invert(self):
+ for i in xrange(len(self.matches)):
+ self.toggle_plugin(self.createIndex(i, 0))
+
def toggle_plugin(self, index):
new_index = self.createIndex(index.row(), 0)
data = QVariant(is_disabled(self.get_plugin(index)))
@@ -91,12 +109,15 @@ class Matches(QAbstractItemModel):
return QVariant('%s
%s' % (result.name, result.description))
elif col == 3:
return QVariant(result.headquarters)
- elif col == 4:
+ elif col == 5:
return QVariant(', '.join(result.formats).upper())
elif role == Qt.DecorationRole:
if col == 2:
if result.drm_free_only:
return QVariant(self.NO_DRM_ICON)
+ if col == 4:
+ if result.affiliate:
+ return QVariant(self.DONATE_ICON)
elif role == Qt.CheckStateRole:
if col == 0:
if is_disabled(result):
@@ -105,20 +126,23 @@ class Matches(QAbstractItemModel):
elif role == Qt.ToolTipRole:
if col == 0:
if is_disabled(result):
- return QVariant(_('This store is currently diabled and cannot be used in other parts of calibre.
'))
+ return QVariant('' + _('This store is currently diabled and cannot be used in other parts of calibre.') + '
')
else:
- return QVariant(_('This store is currently enabled and can be used in other parts of calibre.
'))
+ return QVariant('' + _('This store is currently enabled and can be used in other parts of calibre.') + '
')
elif col == 1:
return QVariant('%s
' % result.description)
elif col == 2:
if result.drm_free_only:
- return QVariant(_('This store only distributes ebooks with DRM.
'))
+ return QVariant('' + _('This store only distributes ebooks with DRM.') + '
')
else:
- return QVariant(_('This store distributes ebooks with DRM. It may have some titles without DRM, but you will need to check on a per title basis.
'))
+ return QVariant('' + _('This store distributes ebooks with DRM. It may have some titles without DRM, but you will need to check on a per title basis.') + '
')
elif col == 3:
- return QVariant(_('This store is headquartered in %s. This is a good indication of what market the store caters to. However, this does not necessarily mean that the store is limited to that market only.
') % result.headquarters)
+ return QVariant('' + _('This store is headquartered in %s. This is a good indication of what market the store caters to. However, this does not necessarily mean that the store is limited to that market only.') % result.headquarters + '
')
elif col == 4:
- return QVariant(_('This store distributes ebooks in the following formats: %s
') % ', '.join(result.formats))
+ if result.affiliate:
+ return QVariant('' + _('Buying from this store supports the calibre developer: %s.') % result.author + '
')
+ elif col == 5:
+ return QVariant('' + _('This store distributes ebooks in the following formats: %s') % ', '.join(result.formats) + '
')
return NONE
def setData(self, index, data, role):
@@ -148,6 +172,8 @@ class Matches(QAbstractItemModel):
text = 'a' if getattr(match, 'drm_free_only', True) else 'b'
elif col == 3:
text = getattr(match, 'headquarters', '')
+ elif col == 4:
+ text = 'a' if getattr(match, 'affiliate', False) else 'b'
return text
def sort(self, col, order, reset=True):
@@ -167,6 +193,7 @@ class SearchFilter(SearchQueryParser):
USABLE_LOCATIONS = [
'all',
+ 'affiliate',
'description',
'drm',
'enabled',
@@ -207,6 +234,7 @@ class SearchFilter(SearchQueryParser):
all_locs = set(self.USABLE_LOCATIONS) - set(['all'])
locations = all_locs if location == 'all' else [location]
q = {
+ 'affiliate': lambda x: x.affiliate,
'description': lambda x: x.description.lower(),
'drm': lambda x: not x.drm_free_only,
'enabled': lambda x: not is_disabled(x),
@@ -219,21 +247,21 @@ class SearchFilter(SearchQueryParser):
for locvalue in locations:
accessor = q[locvalue]
if query == 'true':
- if locvalue in ('drm', 'enabled'):
+ if locvalue in ('affiliate', 'drm', 'enabled'):
if accessor(sr) == True:
matches.add(sr)
elif accessor(sr) is not None:
matches.add(sr)
continue
if query == 'false':
- if locvalue in ('drm', 'enabled'):
+ if locvalue in ('affiliate', 'drm', 'enabled'):
if accessor(sr) == False:
matches.add(sr)
elif accessor(sr) is None:
matches.add(sr)
continue
# this is bool, so can't match below
- if locvalue in ('drm', 'enabled'):
+ if locvalue in ('affiliate', 'drm', 'enabled'):
continue
try:
### Can't separate authors because comma is used for name sep and author sep
diff --git a/src/calibre/gui2/store/search/adv_search_builder.py b/src/calibre/gui2/store/search/adv_search_builder.py
index 745e709f90..cc89ca4eb7 100644
--- a/src/calibre/gui2/store/search/adv_search_builder.py
+++ b/src/calibre/gui2/store/search/adv_search_builder.py
@@ -45,6 +45,7 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
self.author_box.setText('')
self.price_box.setText('')
self.format_box.setText('')
+ self.affiliate_combo.setCurrentIndex(0)
def tokens(self, raw):
phrases = re.findall(r'\s*".*?"\s*', raw)
@@ -117,7 +118,10 @@ class AdvSearchBuilderDialog(QDialog, Ui_Dialog):
ans.append('price:"' + self.mc + price + '"')
format = unicode(self.format_box.text()).strip()
if format:
- ans.append('format:"' + self.mc + format + '"')
+ ans.append('format:"' + self.mc + format + '"')
+ affiliate = unicode(self.affiliate_combo.currentText()).strip()
+ if affiliate:
+ ans.append('affiliate:' + affiliate)
if ans:
return ' and '.join(ans)
return ''
diff --git a/src/calibre/gui2/store/search/adv_search_builder.ui b/src/calibre/gui2/store/search/adv_search_builder.ui
index a758057311..e07c3d7d48 100644
--- a/src/calibre/gui2/store/search/adv_search_builder.ui
+++ b/src/calibre/gui2/store/search/adv_search_builder.ui
@@ -226,7 +226,7 @@
- -
+
-
-
@@ -244,7 +244,7 @@
- -
+
-
Qt::Vertical
@@ -283,6 +283,32 @@
-
+ -
+
+
+ Affiliate:
+
+
+
+ -
+
+
-
+
+
+
+
+ -
+
+ true
+
+
+ -
+
+ false
+
+
+
+
diff --git a/src/calibre/gui2/store/search/download_thread.py b/src/calibre/gui2/store/search/download_thread.py
index 67b4224981..c55c487b5f 100644
--- a/src/calibre/gui2/store/search/download_thread.py
+++ b/src/calibre/gui2/store/search/download_thread.py
@@ -121,6 +121,7 @@ class SearchThread(Thread):
return
res.store_name = store_name
res.affiliate = store_plugin.base_plugin.affiliate
+ res.plugin_author = store_plugin.base_plugin.author
self.results.put((res, store_plugin))
self.tasks.task_done()
except:
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index 9b2966d0eb..c922bb31d7 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -200,7 +200,7 @@ class Matches(QAbstractItemModel):
return QVariant('%s
' % result.formats)
elif col == 5:
if result.affiliate:
- return QVariant(_('Buying from this store supports a calibre developer'))
+ return QVariant('' + _('Buying from this store supports the calibre developer: %s.') % result.plugin_author + '
')
elif role == Qt.SizeHintRole:
return QSize(64, 64)
return NONE
diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py
index 7e69c61524..aa9aef6c3e 100644
--- a/src/calibre/gui2/store/search/search.py
+++ b/src/calibre/gui2/store/search/search.py
@@ -102,7 +102,7 @@ class SearchDialog(QDialog, Ui_Dialog):
store_list_layout.addWidget(cbox, i, 0, 1, 1)
if self.gui.istores[x].base_plugin.affiliate:
iw = QLabel(self)
- iw.setToolTip(_('Buying from this store supports a calibre developer'))
+ iw.setToolTip('' + _('Buying from this store supports the calibre developer: %s
') % self.gui.istores[x].base_plugin.author + '
')
iw.setPixmap(icon.pixmap(16, 16))
store_list_layout.addWidget(iw, i, 1, 1, 1)
self.store_checks[x] = cbox
diff --git a/src/calibre/gui2/store/search_result.py b/src/calibre/gui2/store/search_result.py
index 83a2c8601d..7d6ac5acad 100644
--- a/src/calibre/gui2/store/search_result.py
+++ b/src/calibre/gui2/store/search_result.py
@@ -23,6 +23,7 @@ class SearchResult(object):
self.drm = None
self.formats = ''
self.affiliate = False
+ self.plugin_author = ''
def __eq__(self, other):
return self.title == other.title and self.author == other.author and self.store_name == other.store_name
From 97774c0f932f1c4d59512e2f1cdbf5ff8ef5d999 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 16:56:58 -0400
Subject: [PATCH 18/44] ...
---
src/calibre/gui2/store/search/models.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py
index c922bb31d7..89c11445b3 100644
--- a/src/calibre/gui2/store/search/models.py
+++ b/src/calibre/gui2/store/search/models.py
@@ -10,7 +10,7 @@ import re
from operator import attrgetter
from PyQt4.Qt import (Qt, QAbstractItemModel, QVariant, QPixmap, QModelIndex, QSize,
- pyqtSignal, QIcon)
+ pyqtSignal)
from calibre.gui2 import NONE, FunctionDispatcher
from calibre.gui2.store.search_result import SearchResult
From b19ebf917aca06a87f8d85689a7d47f4e9214b0a Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 20:29:40 -0400
Subject: [PATCH 19/44] Store: Chooser allow user to configure plugins via
right clicking.
---
.../gui2/store/config/chooser/results_view.py | 21 ++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/calibre/gui2/store/config/chooser/results_view.py b/src/calibre/gui2/store/config/chooser/results_view.py
index 1c18a18d7b..10dff4bcdb 100644
--- a/src/calibre/gui2/store/config/chooser/results_view.py
+++ b/src/calibre/gui2/store/config/chooser/results_view.py
@@ -6,7 +6,9 @@ __license__ = 'GPL 3'
__copyright__ = '2011, John Schember '
__docformat__ = 'restructuredtext en'
-from PyQt4.Qt import (Qt, QTreeView, QSize)
+from functools import partial
+
+from PyQt4.Qt import (Qt, QTreeView, QSize, QMenu)
from calibre.customize.ui import store_plugins
from calibre.gui2.metadata.single_download import RichTextDelegate
@@ -32,3 +34,20 @@ class ResultsView(QTreeView):
self.model().sort(1, Qt.AscendingOrder)
self.header().setSortIndicator(self.model().sort_col, self.model().sort_order)
+
+ def contextMenuEvent(self, event):
+ index = self.indexAt(event.pos())
+
+ if not index.isValid():
+ return
+
+ plugin = self.model().get_plugin(index)
+
+ menu = QMenu()
+ ca = menu.addAction(_('Configure...'), partial(self.configure_plugin, plugin))
+ if not plugin.is_customizable():
+ ca.setEnabled(False)
+ menu.exec_(event.globalPos())
+
+ def configure_plugin(self, plugin):
+ plugin.do_user_config(self)
From 8135b12f2d05435b6bb19d671267569f7dd55e41 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 20:38:41 -0400
Subject: [PATCH 20/44] Store: search, config dialog save size and current tab.
Set better default size.
---
src/calibre/gui2/store/search/search.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py
index aa9aef6c3e..cda89f278e 100644
--- a/src/calibre/gui2/store/search/search.py
+++ b/src/calibre/gui2/store/search/search.py
@@ -268,7 +268,22 @@ class SearchDialog(QDialog, Ui_Dialog):
tab_widget.addTab(chooser_config_widget, _('Choose stores'))
tab_widget.addTab(search_config_widget, _('Configure search'))
+ # Restore dialog state.
+ geometry = self.config.get('config_dialog_geometry', None)
+ if geometry:
+ d.restoreGeometry(geometry)
+ else:
+ d.resize(800, 600)
+ tab_index = self.config.get('config_dialog_tab_index', 0)
+ tab_index = min(tab_index, tab_widget.count() - 1)
+ tab_widget.setCurrentIndex(tab_index)
+
d.exec_()
+
+ # Save dialog state.
+ self.config['config_dialog_geometry'] = bytearray(d.saveGeometry())
+ self.config['config_dialog_tab_index'] = tab_widget.currentIndex()
+
search_config_widget.save_settings()
self.config_changed()
self.gui.load_store_plugins()
From 45e2298080b2b0ddb3a516b111467b09641ebe49 Mon Sep 17 00:00:00 2001
From: John Schember
Date: Sat, 28 May 2011 20:43:34 -0400
Subject: [PATCH 21/44] Store: Remove unnecessary code.
---
src/calibre/gui2/store/config/chooser/chooser_widget.py | 5 +----
src/calibre/gui2/store/search/search.py | 2 ++
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.py b/src/calibre/gui2/store/config/chooser/chooser_widget.py
index cc1db488f1..a9399028f8 100644
--- a/src/calibre/gui2/store/config/chooser/chooser_widget.py
+++ b/src/calibre/gui2/store/config/chooser/chooser_widget.py
@@ -26,14 +26,11 @@ class StoreChooserWidget(QWidget, Ui_Form):
self.enable_all.clicked.connect(self.results_view.model().enable_all)
self.enable_none.clicked.connect(self.results_view.model().enable_none)
self.enable_invert.clicked.connect(self.results_view.model().enable_invert)
- self.results_view.activated.connect(self.toggle_plugin)
+ self.results_view.activated.connect(self.results_view.model().toggle_plugin)
def do_search(self):
self.results_view.model().search(unicode(self.query.text()))
- def toggle_plugin(self, index):
- self.results_view.model().toggle_plugin(index)
-
def build_adv_search(self):
adv = AdvSearchBuilderDialog(self)
if adv.exec_() == QDialog.Accepted:
diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py
index cda89f278e..e1ad24943d 100644
--- a/src/calibre/gui2/store/search/search.py
+++ b/src/calibre/gui2/store/search/search.py
@@ -251,6 +251,8 @@ class SearchDialog(QDialog, Ui_Dialog):
# search widget.
self.config['open_external'] = self.open_external.isChecked()
+ # Create the config dialog. It's going to put two config widgets
+ # into a QTabWidget for displaying all of the settings.
d = QDialog(self)
button_box = QDialogButtonBox(QDialogButtonBox.Close)
v = QVBoxLayout(d)
From 549c65a55752dea1bfd0bda34844cda472a8979d Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sat, 28 May 2011 23:24:58 -0600
Subject: [PATCH 22/44] Change update message so that I stop getting annoyed by
people that can't seem to understand that there is no compulsion to update.
---
src/calibre/gui2/update.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py
index 9929d50a7e..847b5785e9 100644
--- a/src/calibre/gui2/update.py
+++ b/src/calibre/gui2/update.py
@@ -52,7 +52,8 @@ class UpdateNotification(QDialog):
self.label = QLabel(''+
_('%s has been updated to version %s. '
'See the new features.')%(__appname__, version))
+ '">new features. Only update if one of the '
+ 'new features or bug fixes is important to you.')%(__appname__, version))
self.label.setOpenExternalLinks(True)
self.label.setWordWrap(True)
self.setWindowTitle(_('Update available!'))
From 456b6b423eab32be26a8aba637d5ee57fa16ae33 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 29 May 2011 00:31:14 -0600
Subject: [PATCH 23/44] ...
---
src/calibre/manual/develop.rst | 2 +-
src/calibre/manual/faq.rst | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/calibre/manual/develop.rst b/src/calibre/manual/develop.rst
index f95d51bfca..c49176ceb2 100644
--- a/src/calibre/manual/develop.rst
+++ b/src/calibre/manual/develop.rst
@@ -65,7 +65,7 @@ this, make your changes, then run::
bzr send -o my-changes
This will create a :file:`my-changes` file in the current directory,
-simply attach that to a ticket on the |app| `bug tracker `_.
+simply attach that to a ticket on the |app| `bug tracker `_.
If you plan to do a lot of development on |app|, then the best method is to create a
`Launchpad `_ account. Once you have the account, you can use it to register
diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst
index 1c0b49f30b..99c53e5a37 100644
--- a/src/calibre/manual/faq.rst
+++ b/src/calibre/manual/faq.rst
@@ -560,7 +560,7 @@ I want some feature added to |app|. What can I do?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You have two choices:
1. Create a patch by hacking on |app| and send it to me for review and inclusion. See `Development `_.
- 2. `Open a ticket `_ (you have to register and login first). Remember that |app| development is done by volunteers, so if you get no response to your feature request, it means no one feels like implementing it.
+ 2. `Open a ticket `_ (you have to register and login first). Remember that |app| development is done by volunteers, so if you get no response to your feature request, it means no one feels like implementing it.
How is |app| licensed?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From 6c26b9debc72060cfc10f1239d96311c1691ed08 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 10:04:34 +0100
Subject: [PATCH 24/44] Add the ondevice() function to the template language
---
src/calibre/library/database2.py | 1 +
src/calibre/manual/template_lang.rst | 3 ++-
src/calibre/utils/formatter_functions.py | 18 +++++++++++++++++-
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py
index 819ac2cd24..df465c919e 100644
--- a/src/calibre/library/database2.py
+++ b/src/calibre/library/database2.py
@@ -860,6 +860,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
mi.uuid = row[fm['uuid']]
mi.title_sort = row[fm['sort']]
mi.book_size = row[fm['size']]
+ mi.ondevice_col= row[fm['ondevice']]
mi.last_modified = row[fm['last_modified']]
formats = row[fm['formats']]
if not formats:
diff --git a/src/calibre/manual/template_lang.rst b/src/calibre/manual/template_lang.rst
index 059376565d..28c9855ce4 100644
--- a/src/calibre/manual/template_lang.rst
+++ b/src/calibre/manual/template_lang.rst
@@ -255,6 +255,7 @@ The following functions are available in addition to those described in single-f
* ``not(value)`` -- returns the string "1" if the value is empty, otherwise returns the empty string. This function works well with test or first_non_empty. You can have as many values as you want.
* ``merge_lists(list1, list2, separator)`` -- return a list made by merging the items in list1 and list2, removing duplicate items using a case-insensitive compare. If items differ in case, the one in list1 is used. The items in list1 and list2 are separated by separator, as are the items in the returned list.
* ``multiply(x, y)`` -- returns x * y. Throws an exception if either x or y are not numbers.
+ * ``ondevice()`` -- return the string "Yes" if ondevice is set, otherwise return the empty string
* ``or(value, value, ...)`` -- returns the string "1" if any value is not empty, otherwise returns the empty string. This function works well with test or first_non_empty. You can have as many values as you want.
* ``print(a, b, ...)`` -- prints the arguments to standard output. Unless you start calibre from the command line (``calibre-debug -g``), the output will go to a black hole.
* ``raw_field(name)`` -- returns the metadata field named by name without applying any formatting.
@@ -277,7 +278,7 @@ Function classification summary:
* Relational: ``cmp`` , ``strcmp`` for strings
* String case changes: ``lowercase``, ``uppercase``, ``titlecase``, ``capitalize``
* String manipulation: ``re``, ``shorten``, ``substr``
- * Other: ``assign``, ``booksize``, ``print``, ``format_date``,
+ * Other: ``assign``, ``booksize``, ``format_date``, ``ondevice`` ``print``
.. _general_mode:
diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py
index 2f15d5d592..761da2c8e2 100644
--- a/src/calibre/utils/formatter_functions.py
+++ b/src/calibre/utils/formatter_functions.py
@@ -568,7 +568,7 @@ class BuiltinCapitalize(BuiltinFormatterFunction):
class BuiltinBooksize(BuiltinFormatterFunction):
name = 'booksize'
arg_count = 0
- doc = _('booksize() -- return value of the field capitalized')
+ doc = _('booksize() -- return value of the size field')
def evaluate(self, formatter, kwargs, mi, locals):
if mi.book_size is not None:
@@ -578,6 +578,21 @@ class BuiltinBooksize(BuiltinFormatterFunction):
pass
return ''
+class BuiltinOndevice(BuiltinFormatterFunction):
+ name = 'ondevice'
+ arg_count = 0
+ doc = _('ondevice() -- return Yes if ondevice is set, otherwise return '
+ 'the empty string')
+
+ def evaluate(self, formatter, kwargs, mi, locals):
+ print mi.ondevice_col
+ if mi.ondevice_col:
+ try:
+ return _('Yes')
+ except:
+ pass
+ return ''
+
class BuiltinFirstNonEmpty(BuiltinFormatterFunction):
name = 'first_non_empty'
arg_count = -1
@@ -687,6 +702,7 @@ builtin_lowercase = BuiltinLowercase()
builtin_merge_lists = BuiltinMergeLists()
builtin_multiply = BuiltinMultiply()
builtin_not = BuiltinNot()
+builtin_ondevice = BuiltinOndevice()
builtin_or = BuiltinOr()
builtin_print = BuiltinPrint()
builtin_raw_field = BuiltinRaw_field()
From faffa55cf1299cc1beaf257f0aea765db2d37fb5 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 10:05:47 +0100
Subject: [PATCH 25/44] take out print statement
---
src/calibre/utils/formatter_functions.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py
index 761da2c8e2..bf597d5b9c 100644
--- a/src/calibre/utils/formatter_functions.py
+++ b/src/calibre/utils/formatter_functions.py
@@ -585,7 +585,6 @@ class BuiltinOndevice(BuiltinFormatterFunction):
'the empty string')
def evaluate(self, formatter, kwargs, mi, locals):
- print mi.ondevice_col
if mi.ondevice_col:
try:
return _('Yes')
From 393cfe78cdca8f96b4e85d40e612087af86076f0 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 11:30:04 +0100
Subject: [PATCH 26/44] Improvements to editing templates and formatter
exception reporting. Largest improvement is adding a value preview box to the
template editor.
---
src/calibre/ebooks/metadata/book/base.py | 39 +++++++--------
src/calibre/gui2/dialogs/template_dialog.py | 10 +++-
src/calibre/gui2/dialogs/template_dialog.ui | 50 +++++++++++++------
.../gui2/dialogs/template_line_editor.py | 6 ++-
src/calibre/gui2/library/delegates.py | 3 +-
src/calibre/gui2/preferences/look_feel.py | 10 ++++
src/calibre/utils/formatter.py | 9 ++--
src/calibre/utils/formatter_functions.py | 21 +++-----
8 files changed, 92 insertions(+), 56 deletions(-)
diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py
index 5dc3f25dfb..179a96e578 100644
--- a/src/calibre/ebooks/metadata/book/base.py
+++ b/src/calibre/ebooks/metadata/book/base.py
@@ -41,27 +41,24 @@ field_metadata = FieldMetadata()
class SafeFormat(TemplateFormatter):
- def get_value(self, key, args, kwargs):
- try:
- key = key.lower()
- if key != 'title_sort' and key not in TOP_LEVEL_IDENTIFIERS:
- key = field_metadata.search_term_to_field_key(key)
- b = self.book.get_user_metadata(key, False)
- if b and b['datatype'] == 'int' and self.book.get(key, 0) == 0:
- v = ''
- elif b and b['datatype'] == 'float' and self.book.get(key, 0.0) == 0.0:
- v = ''
- else:
- v = self.book.format_field(key, series_with_index=False)[1]
- if v is None:
- return ''
- if v == '':
- return ''
- return v
- except:
- if DEBUG:
- traceback.print_exc()
- return key
+ def get_value(self, orig_key, args, kwargs):
+ key = orig_key.lower()
+ if key != 'title_sort' and key not in TOP_LEVEL_IDENTIFIERS:
+ key = field_metadata.search_term_to_field_key(key)
+ if key is None or key not in self.book.all_field_keys():
+ raise ValueError(_('Value: unknown field ') + orig_key)
+ b = self.book.get_user_metadata(key, False)
+ if b and b['datatype'] == 'int' and self.book.get(key, 0) == 0:
+ v = ''
+ elif b and b['datatype'] == 'float' and self.book.get(key, 0.0) == 0.0:
+ v = ''
+ else:
+ v = self.book.format_field(key, series_with_index=False)[1]
+ if v is None:
+ return ''
+ if v == '':
+ return ''
+ return v
composite_formatter = SafeFormat()
diff --git a/src/calibre/gui2/dialogs/template_dialog.py b/src/calibre/gui2/dialogs/template_dialog.py
index ca55bb0e66..083dacbf00 100644
--- a/src/calibre/gui2/dialogs/template_dialog.py
+++ b/src/calibre/gui2/dialogs/template_dialog.py
@@ -11,6 +11,7 @@ from PyQt4.Qt import (Qt, QDialog, QDialogButtonBox, QSyntaxHighlighter,
from calibre.gui2.dialogs.template_dialog_ui import Ui_TemplateDialog
from calibre.utils.formatter_functions import formatter_functions
+from calibre.ebooks.metadata.book.base import composite_formatter
class ParenPosition:
@@ -194,10 +195,13 @@ class TemplateHighlighter(QSyntaxHighlighter):
class TemplateDialog(QDialog, Ui_TemplateDialog):
- def __init__(self, parent, text):
+ def __init__(self, parent, text, mi):
QDialog.__init__(self, parent)
Ui_TemplateDialog.__init__(self)
self.setupUi(self)
+
+ self.mi = mi
+
# Remove help icon on title bar
icon = self.windowIcon()
self.setWindowFlags(self.windowFlags()&(~Qt.WindowContextHelpButtonHint))
@@ -233,12 +237,16 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
self.function.addItems(func_names)
self.function.setCurrentIndex(0)
self.function.currentIndexChanged[str].connect(self.function_changed)
+ self.textbox_changed()
def textbox_changed(self):
cur_text = unicode(self.textbox.toPlainText())
if self.last_text != cur_text:
self.last_text = cur_text
self.highlighter.regenerate_paren_positions()
+ self.template_value.setText(
+ composite_formatter.safe_format(cur_text, self.mi,
+ _('EXCEPTION: '), self.mi))
def text_cursor_changed(self):
cursor = self.textbox.textCursor()
diff --git a/src/calibre/gui2/dialogs/template_dialog.ui b/src/calibre/gui2/dialogs/template_dialog.ui
index dd8fb7bd88..d36cbbd3d4 100644
--- a/src/calibre/gui2/dialogs/template_dialog.ui
+++ b/src/calibre/gui2/dialogs/template_dialog.ui
@@ -23,19 +23,39 @@
-
- -
-
-
- Qt::Horizontal
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
-
-
+
+
+ Template value:
+
+
+ template_value
+
+
+ The value the of the template using the current book in the library view
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
Function &name:
@@ -45,10 +65,10 @@
- -
+
-
- -
+
-
&Documentation:
@@ -61,7 +81,7 @@
- -
+
-
Python &code:
@@ -74,7 +94,7 @@
- -
+
-
@@ -84,7 +104,7 @@
- -
+
-
diff --git a/src/calibre/gui2/dialogs/template_line_editor.py b/src/calibre/gui2/dialogs/template_line_editor.py
index 98b74b391d..a724b5b072 100644
--- a/src/calibre/gui2/dialogs/template_line_editor.py
+++ b/src/calibre/gui2/dialogs/template_line_editor.py
@@ -21,6 +21,10 @@ class TemplateLineEditor(QLineEdit):
def __init__(self, parent):
QLineEdit.__init__(self, parent)
self.tags = None
+ self.mi = None
+
+ def set_mi(self, mi):
+ self.mi = mi
def set_tags(self, tags):
self.tags = tags
@@ -37,7 +41,7 @@ class TemplateLineEditor(QLineEdit):
menu.exec_(event.globalPos())
def open_editor(self):
- t = TemplateDialog(self, self.text())
+ t = TemplateDialog(self, self.text(), self.mi)
t.setWindowTitle(_('Edit template'))
if t.exec_():
self.setText(t.textbox.toPlainText())
diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py
index 6990a76b21..94c3deb403 100644
--- a/src/calibre/gui2/library/delegates.py
+++ b/src/calibre/gui2/library/delegates.py
@@ -418,8 +418,9 @@ class CcTemplateDelegate(QStyledItemDelegate): # {{{
def createEditor(self, parent, option, index):
m = index.model()
+ mi = m.db.get_metadata(index.row(), index_is_id=False)
text = m.custom_columns[m.column_map[index.column()]]['display']['composite_template']
- editor = TemplateDialog(parent, text)
+ editor = TemplateDialog(parent, text, mi)
editor.setWindowTitle(_("Edit template"))
editor.textbox.setTabChangesFocus(False)
editor.textbox.setTabStopWidth(20)
diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py
index b6e6de1902..fcdd56fd5f 100644
--- a/src/calibre/gui2/preferences/look_feel.py
+++ b/src/calibre/gui2/preferences/look_feel.py
@@ -205,11 +205,21 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
choices.insert(0, '')
self.column_color_count = db.column_color_count+1
tags = db.all_tags()
+
+ mi=None
+ try:
+ idx = gui.library_view.currentIndex().row()
+ if idx:
+ mi = db.get_metadata(idx, index_is_id=False)
+ except:
+ pass
+
for i in range(1, self.column_color_count):
r('column_color_name_'+str(i), db.prefs, choices=choices)
r('column_color_template_'+str(i), db.prefs)
tpl = getattr(self, 'opt_column_color_template_'+str(i))
tpl.set_tags(tags)
+ tpl.set_mi(mi)
toolbutton = getattr(self, 'opt_column_color_wizard_'+str(i))
toolbutton.clicked.connect(tpl.tag_wizard)
all_colors = [unicode(s) for s in list(QColor.colorNames())]
diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py
index fccd0015c1..695355330e 100644
--- a/src/calibre/utils/formatter.py
+++ b/src/calibre/utils/formatter.py
@@ -98,7 +98,10 @@ class _Parser(object):
cls = funcs['assign']
return cls.eval_(self.parent, self.parent.kwargs,
self.parent.book, self.parent.locals, id, self.expr())
- return self.parent.locals.get(id, _('unknown id ') + id)
+ val = self.parent.locals.get(id, None)
+ if val is None:
+ self.error(_('Unknown identifier ') + id)
+ return val
# We have a function.
# Check if it is a known one. We do this here so error reporting is
# better, as it can identify the tokens near the problem.
@@ -317,8 +320,8 @@ class TemplateFormatter(string.Formatter):
try:
ans = self.vformat(fmt, [], kwargs).strip()
except Exception as e:
- if DEBUG:
- traceback.print_exc()
+# if DEBUG:
+# traceback.print_exc()
ans = error_value + ' ' + e.message
return ans
diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py
index bf597d5b9c..d7b6e63f5e 100644
--- a/src/calibre/utils/formatter_functions.py
+++ b/src/calibre/utils/formatter_functions.py
@@ -63,20 +63,13 @@ class FormatterFunction(object):
raise NotImplementedError()
def eval_(self, formatter, kwargs, mi, locals, *args):
- try:
- ret = self.evaluate(formatter, kwargs, mi, locals, *args)
- if isinstance(ret, (str, unicode)):
- return ret
- if isinstance(ret, (int, float, bool)):
- return unicode(ret)
- if isinstance(ret, list):
- return ','.join(list)
- except:
- traceback.print_exc()
- exc_type, exc_value, exc_traceback = sys.exc_info()
- info = ': '.join(traceback.format_exception(exc_type, exc_value,
- exc_traceback)[-2:]).replace('\n', '')
- return _('Exception ') + info
+ ret = self.evaluate(formatter, kwargs, mi, locals, *args)
+ if isinstance(ret, (str, unicode)):
+ return ret
+ if isinstance(ret, (int, float, bool)):
+ return unicode(ret)
+ if isinstance(ret, list):
+ return ','.join(list)
all_builtin_functions = []
class BuiltinFormatterFunction(FormatterFunction):
From 52da86dbb6fa48d61ea852436082b6c7b8607e82 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 13:17:07 +0100
Subject: [PATCH 27/44] Added an else box to the tag color wizard. Also added
more extensive tooltips.
---
.../gui2/dialogs/template_line_editor.py | 61 ++++++++++++++++---
1 file changed, 53 insertions(+), 8 deletions(-)
diff --git a/src/calibre/gui2/dialogs/template_line_editor.py b/src/calibre/gui2/dialogs/template_line_editor.py
index a724b5b072..d466cecc55 100644
--- a/src/calibre/gui2/dialogs/template_line_editor.py
+++ b/src/calibre/gui2/dialogs/template_line_editor.py
@@ -69,10 +69,38 @@ class TagWizard(QDialog):
self.setLayout(l)
l.setColumnStretch(0, 1)
l.setColumnMinimumWidth(0, 300)
- l.addWidget(QLabel(_('Tags (more than one per box permitted)')), 0, 0, 1, 1)
- l.addWidget(QLabel(_('Color')), 0, 1, 1, 1)
+ h = QLabel(_('Tags (see the popup help for more information)'))
+ h.setToolTip('' +
+ _('You can enter more than one tag per box, separated by commas. '
+ 'The comparison ignores letter case.
'
+ 'A tag value can be a regular expression. '
+ 'When using regular expressions, note that the wizard '
+ 'puts anchors (^ and $) around the expression, so you '
+ 'must ensure your expression matches from the beginning '
+ 'to the end of the tag.
'
+ 'Regular expression examples:') + '
' +
+ _('.*
matches any tag. No empty tags are '
+ 'checked, so you don\'t need to worry about empty strings '
+ 'A.*
matches any tag beginning with A '
+ '.*mystery.*
matches any tag containing '
+ 'the word "mystery" ') + '
')
+ l.addWidget(h , 0, 0, 1, 1)
+ c = QLabel(_('Color if tag found'))
+ c.setToolTip('' +
+ _('At least one of the two color boxes must have a value. Leave '
+ 'one color box empty if you want the template to use the next '
+ 'line in this wizard. If both boxes are filled in, the rest of '
+ 'the lines in this wizard will be ignored.') + '
')
+ l.addWidget(c, 0, 1, 1, 1)
+ c = QLabel(_('Color if tag not found'))
+ c.setToolTip('' +
+ _('This box is usually filled in only on the last test. If it is '
+ 'filled in before the last test, then the color for tag found box '
+ 'must be empty or all the rest of the tests will be ignored.') + '
')
+ l.addWidget(c, 0, 2, 1, 1)
self.tagboxes = []
self.colorboxes = []
+ self.nfcolorboxes = []
self.colors = [unicode(s) for s in list(QColor.colorNames())]
self.colors.insert(0, '')
for i in range(0, 10):
@@ -85,15 +113,25 @@ class TagWizard(QDialog):
cb.addItems(self.colors)
self.colorboxes.append(cb)
l.addWidget(cb, i+1, 1, 1, 1)
+ cb = QComboBox(self)
+ cb.addItems(self.colors)
+ self.nfcolorboxes.append(cb)
+ l.addWidget(cb, i+1, 2, 1, 1)
if txt:
lines = txt.split('\n')[3:]
i = 0
for line in lines:
if line.startswith('#'):
- t,c = line[1:].split(':|:')
+ vals = line[1:].split(':|:')
+ if len(vals) == 2:
+ t, c = vals
+ nc = ''
+ else:
+ t,c,nc = vals
try:
self.colorboxes[i].setCurrentIndex(self.colorboxes[i].findText(c))
+ self.nfcolorboxes[i].setCurrentIndex(self.nfcolorboxes[i].findText(nc))
self.tagboxes[i].setText(t)
except:
pass
@@ -109,28 +147,35 @@ class TagWizard(QDialog):
res = ("program:\n#tag wizard -- do not directly edit\n"
" t = field('tags');\n first_non_empty(\n")
lines = []
- for tb, cb in zip(self.tagboxes, self.colorboxes):
+ for tb, cb, nfcb in zip(self.tagboxes, self.colorboxes, self.nfcolorboxes):
tags = [t.strip() for t in unicode(tb.text()).split(',') if t.strip()]
tags = '$|^'.join(tags)
c = unicode(cb.currentText()).strip()
- if not tags or not c:
+ nfc = unicode(nfcb.currentText()).strip()
+ if not tags or not (c or nfc):
continue
if c not in self.colors:
error_dialog(self, _('Invalid color'),
_('The color {0} is not valid').format(c),
show=True, show_copy_button=False)
return False
- lines.append(" in_list(t, ',', '^{0}$', '{1}', '')".format(tags, c))
+ if nfc not in self.colors:
+ error_dialog(self, _('Invalid color'),
+ _('The color {0} is not valid').format(nfc),
+ show=True, show_copy_button=False)
+ return False
+ lines.append(" in_list(t, ',', '^{0}$', '{1}', '{2}')".format(tags, c, nfc))
res += ',\n'.join(lines)
res += ')\n'
self.template = res
res = ''
- for tb, cb in zip(self.tagboxes, self.colorboxes):
+ for tb, cb, nfcb in zip(self.tagboxes, self.colorboxes, self.nfcolorboxes):
t = unicode(tb.text()).strip()
if t.endswith(','):
t = t[:-1]
c = unicode(cb.currentText()).strip()
+ nfc = unicode(nfcb.currentText()).strip()
if t and c:
- res += '#' + t + ':|:' + c + '\n'
+ res += '#' + t + ':|:' + c + ':|:' + nfc + '\n'
self.template += res
self.accept()
From 67d570de1c99867e69796cac4710a409bfaf34c2 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 13:39:35 +0100
Subject: [PATCH 28/44] Permit empty keys in templates. Simplifies using
functions that don't require a value
---
src/calibre/ebooks/metadata/book/base.py | 2 ++
src/calibre/library/save_to_disk.py | 2 ++
src/calibre/utils/formatter.py | 2 ++
3 files changed, 6 insertions(+)
diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py
index 179a96e578..f98bebe1dc 100644
--- a/src/calibre/ebooks/metadata/book/base.py
+++ b/src/calibre/ebooks/metadata/book/base.py
@@ -42,6 +42,8 @@ field_metadata = FieldMetadata()
class SafeFormat(TemplateFormatter):
def get_value(self, orig_key, args, kwargs):
+ if not orig_key:
+ return ''
key = orig_key.lower()
if key != 'title_sort' and key not in TOP_LEVEL_IDENTIFIERS:
key = field_metadata.search_term_to_field_key(key)
diff --git a/src/calibre/library/save_to_disk.py b/src/calibre/library/save_to_disk.py
index dc83b44c01..5f49833564 100644
--- a/src/calibre/library/save_to_disk.py
+++ b/src/calibre/library/save_to_disk.py
@@ -134,6 +134,8 @@ class SafeFormat(TemplateFormatter):
'''
def get_value(self, key, args, kwargs):
+ if key == '':
+ return ''
try:
key = key.lower()
try:
diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py
index 695355330e..ebf47db854 100644
--- a/src/calibre/utils/formatter.py
+++ b/src/calibre/utils/formatter.py
@@ -342,6 +342,8 @@ class EvalFormatter(TemplateFormatter):
A template formatter that uses a simple dict instead of an mi instance
'''
def get_value(self, key, args, kwargs):
+ if key == '':
+ return ''
key = key.lower()
return kwargs.get(key, _('No such variable ') + key)
From 0d57a3fb18f03574a242789cce9189e33aa2e54e Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 14:09:01 +0100
Subject: [PATCH 29/44] Correct some problems with setting the ondevice column
values when the device is disconnected.
---
src/calibre/gui2/device.py | 3 ++-
src/calibre/gui2/library/models.py | 2 +-
src/calibre/utils/formatter_functions.py | 5 +----
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py
index 3977a6bca1..dd9d7aaa50 100644
--- a/src/calibre/gui2/device.py
+++ b/src/calibre/gui2/device.py
@@ -1294,7 +1294,8 @@ class DeviceMixin(object): # {{{
self.book_db_uuid_path_map = None
return
- if not hasattr(self, 'db_book_uuid_cache'):
+ if not self.device_manager.is_device_connected or \
+ not hasattr(self, 'db_book_uuid_cache'):
return loc
if self.book_db_id_cache is None:
diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py
index 554b104c34..793f2d353b 100644
--- a/src/calibre/gui2/library/models.py
+++ b/src/calibre/gui2/library/models.py
@@ -125,7 +125,7 @@ class BooksModel(QAbstractTableModel): # {{{
def refresh_ondevice(self):
self.db.refresh_ondevice()
- self.resort()
+ self.refresh(reset=False)
self.research()
def set_book_on_device_func(self, func):
diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py
index d7b6e63f5e..76faf04941 100644
--- a/src/calibre/utils/formatter_functions.py
+++ b/src/calibre/utils/formatter_functions.py
@@ -579,10 +579,7 @@ class BuiltinOndevice(BuiltinFormatterFunction):
def evaluate(self, formatter, kwargs, mi, locals):
if mi.ondevice_col:
- try:
- return _('Yes')
- except:
- pass
+ return _('Yes')
return ''
class BuiltinFirstNonEmpty(BuiltinFormatterFunction):
From 322e6d9ac44e9304cccfedda1d69a654f9805673 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 15:09:56 +0100
Subject: [PATCH 30/44] Add an RE box to the color tags wizard. Add the
necessary function to the template language. Fix problem with passing mi to
the template editor.
---
src/calibre/ebooks/metadata/book/base.py | 2 +-
.../gui2/dialogs/template_line_editor.py | 67 +++++++++++++------
src/calibre/gui2/preferences/look_feel.py | 3 +-
src/calibre/utils/formatter_functions.py | 22 +++++-
4 files changed, 70 insertions(+), 24 deletions(-)
diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py
index f98bebe1dc..3e2201f6a4 100644
--- a/src/calibre/ebooks/metadata/book/base.py
+++ b/src/calibre/ebooks/metadata/book/base.py
@@ -47,7 +47,7 @@ class SafeFormat(TemplateFormatter):
key = orig_key.lower()
if key != 'title_sort' and key not in TOP_LEVEL_IDENTIFIERS:
key = field_metadata.search_term_to_field_key(key)
- if key is None or key not in self.book.all_field_keys():
+ if key is None or (self.book and key not in self.book.all_field_keys()):
raise ValueError(_('Value: unknown field ') + orig_key)
b = self.book.get_user_metadata(key, False)
if b and b['datatype'] == 'int' and self.book.get(key, 0) == 0:
diff --git a/src/calibre/gui2/dialogs/template_line_editor.py b/src/calibre/gui2/dialogs/template_line_editor.py
index d466cecc55..3d199b156c 100644
--- a/src/calibre/gui2/dialogs/template_line_editor.py
+++ b/src/calibre/gui2/dialogs/template_line_editor.py
@@ -5,7 +5,7 @@ __license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal '
__docformat__ = 'restructuredtext en'
-from PyQt4.Qt import (QLineEdit, QDialog, QGridLayout, QLabel,
+from PyQt4.Qt import (QLineEdit, QDialog, QGridLayout, QLabel, QCheckBox,
QDialogButtonBox, QColor, QComboBox, QIcon)
from calibre.gui2.dialogs.template_dialog import TemplateDialog
@@ -73,8 +73,8 @@ class TagWizard(QDialog):
h.setToolTip('' +
_('You can enter more than one tag per box, separated by commas. '
'The comparison ignores letter case.
'
- 'A tag value can be a regular expression. '
- 'When using regular expressions, note that the wizard '
+ 'A tag value can be a regular expression. Check the box to turn '
+ 'them on. When using regular expressions, note that the wizard '
'puts anchors (^ and $) around the expression, so you '
'must ensure your expression matches from the beginning '
'to the end of the tag.
'
@@ -85,22 +85,29 @@ class TagWizard(QDialog):
'
.*mystery.*
matches any tag containing '
'the word "mystery"') + '')
l.addWidget(h , 0, 0, 1, 1)
+
+ c = QLabel(_('is RE'))
+ c.setToolTip('' +
+ _('Check this box if the tag box contains regular expressions') + '
')
+ l.addWidget(c, 0, 1, 1, 1)
+
c = QLabel(_('Color if tag found'))
c.setToolTip('' +
_('At least one of the two color boxes must have a value. Leave '
'one color box empty if you want the template to use the next '
'line in this wizard. If both boxes are filled in, the rest of '
'the lines in this wizard will be ignored.') + '
')
- l.addWidget(c, 0, 1, 1, 1)
+ l.addWidget(c, 0, 2, 1, 1)
c = QLabel(_('Color if tag not found'))
c.setToolTip('' +
_('This box is usually filled in only on the last test. If it is '
'filled in before the last test, then the color for tag found box '
'must be empty or all the rest of the tests will be ignored.') + '
')
- l.addWidget(c, 0, 2, 1, 1)
+ l.addWidget(c, 0, 3, 1, 1)
self.tagboxes = []
self.colorboxes = []
self.nfcolorboxes = []
+ self.reboxes = []
self.colors = [unicode(s) for s in list(QColor.colorNames())]
self.colors.insert(0, '')
for i in range(0, 10):
@@ -109,14 +116,20 @@ class TagWizard(QDialog):
tb.update_items_cache(self.tags)
self.tagboxes.append(tb)
l.addWidget(tb, i+1, 0, 1, 1)
- cb = QComboBox(self)
- cb.addItems(self.colors)
- self.colorboxes.append(cb)
- l.addWidget(cb, i+1, 1, 1, 1)
- cb = QComboBox(self)
- cb.addItems(self.colors)
- self.nfcolorboxes.append(cb)
- l.addWidget(cb, i+1, 2, 1, 1)
+
+ w = QCheckBox(self)
+ self.reboxes.append(w)
+ l.addWidget(w, i+1, 1, 1, 1)
+
+ w = QComboBox(self)
+ w.addItems(self.colors)
+ self.colorboxes.append(w)
+ l.addWidget(w, i+1, 2, 1, 1)
+
+ w = QComboBox(self)
+ w.addItems(self.colors)
+ self.nfcolorboxes.append(w)
+ l.addWidget(w, i+1, 3, 1, 1)
if txt:
lines = txt.split('\n')[3:]
@@ -127,18 +140,20 @@ class TagWizard(QDialog):
if len(vals) == 2:
t, c = vals
nc = ''
+ re = False
else:
- t,c,nc = vals
+ t,c,nc,re = vals
try:
self.colorboxes[i].setCurrentIndex(self.colorboxes[i].findText(c))
self.nfcolorboxes[i].setCurrentIndex(self.nfcolorboxes[i].findText(nc))
self.tagboxes[i].setText(t)
+ self.reboxes[i].setChecked(re == '2')
except:
pass
i += 1
bb = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel, parent=self)
- l.addWidget(bb, 100, 1, 1, 1)
+ l.addWidget(bb, 100, 2, 1, 2)
bb.accepted.connect(self.accepted)
bb.rejected.connect(self.reject)
self.template = ''
@@ -147,11 +162,16 @@ class TagWizard(QDialog):
res = ("program:\n#tag wizard -- do not directly edit\n"
" t = field('tags');\n first_non_empty(\n")
lines = []
- for tb, cb, nfcb in zip(self.tagboxes, self.colorboxes, self.nfcolorboxes):
+ for tb, cb, nfcb, reb in zip(self.tagboxes, self.colorboxes,
+ self.nfcolorboxes, self.reboxes):
tags = [t.strip() for t in unicode(tb.text()).split(',') if t.strip()]
- tags = '$|^'.join(tags)
c = unicode(cb.currentText()).strip()
nfc = unicode(nfcb.currentText()).strip()
+ re = reb.checkState()
+ if re == 2:
+ tags = '$|^'.join(tags)
+ else:
+ tags = ','.join(tags)
if not tags or not (c or nfc):
continue
if c not in self.colors:
@@ -164,18 +184,25 @@ class TagWizard(QDialog):
_('The color {0} is not valid').format(nfc),
show=True, show_copy_button=False)
return False
- lines.append(" in_list(t, ',', '^{0}$', '{1}', '{2}')".format(tags, c, nfc))
+ if re == 2:
+ lines.append(" in_list(t, ',', '^{0}$', '{1}', '{2}')".\
+ format(tags, c, nfc))
+ else:
+ lines.append(" str_in_list(t, ',', '{0}', '{1}', '{2}')".\
+ format(tags, c, nfc))
res += ',\n'.join(lines)
res += ')\n'
self.template = res
res = ''
- for tb, cb, nfcb in zip(self.tagboxes, self.colorboxes, self.nfcolorboxes):
+ for tb, cb, nfcb, reb in zip(self.tagboxes, self.colorboxes,
+ self.nfcolorboxes, self.reboxes):
t = unicode(tb.text()).strip()
if t.endswith(','):
t = t[:-1]
c = unicode(cb.currentText()).strip()
nfc = unicode(nfcb.currentText()).strip()
+ re = unicode(reb.checkState())
if t and c:
- res += '#' + t + ':|:' + c + ':|:' + nfc + '\n'
+ res += '#' + t + ':|:' + c + ':|:' + nfc + ':|:' + re + '\n'
self.template += res
self.accept()
diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py
index fcdd56fd5f..37e4588b9b 100644
--- a/src/calibre/gui2/preferences/look_feel.py
+++ b/src/calibre/gui2/preferences/look_feel.py
@@ -209,8 +209,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
mi=None
try:
idx = gui.library_view.currentIndex().row()
- if idx:
- mi = db.get_metadata(idx, index_is_id=False)
+ mi = db.get_metadata(idx, index_is_id=False)
except:
pass
diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py
index 76faf04941..7d5dbe3e0e 100644
--- a/src/calibre/utils/formatter_functions.py
+++ b/src/calibre/utils/formatter_functions.py
@@ -8,7 +8,7 @@ __license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal '
__docformat__ = 'restructuredtext en'
-import inspect, re, traceback, sys
+import inspect, re, traceback
from calibre.utils.titlecase import titlecase
from calibre.utils.icu import capitalize, strcmp, sort_key
@@ -336,6 +336,25 @@ class BuiltinInList(BuiltinFormatterFunction):
return fv
return nfv
+class BuiltinStrInList(BuiltinFormatterFunction):
+ name = 'str_in_list'
+ arg_count = 5
+ doc = _('str_in_list(val, separator, string, found_val, not_found_val) -- '
+ 'treat val as a list of items separated by separator, '
+ 'comparing the string against each value in the list. If the '
+ 'string matches a value, return found_val, otherwise return '
+ 'not_found_val. If the string contains separators, then it is '
+ 'also treated as a list and each value is checked.')
+
+ def evaluate(self, formatter, kwargs, mi, locals, val, sep, str, fv, nfv):
+ l = [v.strip() for v in val.split(sep) if v.strip()]
+ c = [v.strip() for v in str.split(sep) if v.strip()]
+ for v in l:
+ for t in c:
+ if strcmp(t, v) == 0:
+ return fv
+ return nfv
+
class BuiltinRe(BuiltinFormatterFunction):
name = 're'
arg_count = 3
@@ -700,6 +719,7 @@ builtin_select = BuiltinSelect()
builtin_shorten = BuiltinShorten()
builtin_strcat = BuiltinStrcat()
builtin_strcmp = BuiltinStrcmp()
+builtin_str_in_list = BuiltinStrInList()
builtin_subitems = BuiltinSubitems()
builtin_sublist = BuiltinSublist()
builtin_substr = BuiltinSubstr()
From b9b6286209dcf3e3355f6696cdfb0218e612c017 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 15:18:19 +0100
Subject: [PATCH 31/44] ...
---
src/calibre/manual/template_lang.rst | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/calibre/manual/template_lang.rst b/src/calibre/manual/template_lang.rst
index 28c9855ce4..ec398b5d28 100644
--- a/src/calibre/manual/template_lang.rst
+++ b/src/calibre/manual/template_lang.rst
@@ -130,6 +130,7 @@ The functions available are:
* ``switch(pattern, value, pattern, value, ..., else_value)`` -- for each ``pattern, value`` pair, checks if the field matches the regular expression ``pattern`` and if so, returns that ``value``. If no ``pattern`` matches, then ``else_value`` is returned. You can have as many ``pattern, value`` pairs as you want.
* ``lookup(pattern, field, pattern, field, ..., else_field)`` -- like switch, except the arguments are field (metadata) names, not text. The value of the appropriate field will be fetched and used. Note that because composite columns are fields, you can use this function in one composite field to use the value of some other composite field. This is extremely useful when constructing variable save paths (more later).
* ``select(key)`` -- interpret the field as a comma-separated list of items, with the items being of the form "id:value". Find the pair with the id equal to key, and return the corresponding value. This function is particularly useful for extracting a value such as an isbn from the set of identifiers for a book.
+ * ``str_in_list(val, separator, string, found_val, not_found_val)`` -- treat val as a list of items separated by separator, comparing the string against each value in the list. If the string matches a value, return found_val, otherwise return not_found_val. If the string contains separators, then it is also treated as a list and each value is checked.
* ``subitems(val, start_index, end_index)`` -- This function is used to break apart lists of tag-like hierarchical items such as genres. It interprets the value as a comma-separated list of tag-like items, where each item is a period-separated list. Returns a new list made by first finding all the period-separated tag-like items, then for each such item extracting the components from `start_index` to `end_index`, then combining the results back together. The first component in a period-separated list has an index of zero. If an index is negative, then it counts from the end of the list. As a special case, an end_index of zero is assumed to be the length of the list. Examples::
Assuming a #genre column containing "A.B.C":
@@ -272,10 +273,10 @@ Function classification summary:
* Boolean: ``and``, ``or``, ``not``. The function ``if_empty`` is similar to ``and`` called with one argument.
* If-then-else: ``contains``, ``test``
* Iterating over values: ``first_non_empty``, ``lookup``, ``switch``
- * List lookup: ``in_list``, ``list_item``, ``select``,
+ * List lookup: ``in_list``, ``list_item``, ``select``, ``str_in_list``
* List manipulation: ``count``, ``merge_lists``, ``sublist``, ``subitems``
* Recursion: ``eval``, ``template``
- * Relational: ``cmp`` , ``strcmp`` for strings
+ * Relational: ``cmp`` (for numbers), ``strcmp`` (for strings)
* String case changes: ``lowercase``, ``uppercase``, ``titlecase``, ``capitalize``
* String manipulation: ``re``, ``shorten``, ``substr``
* Other: ``assign``, ``booksize``, ``format_date``, ``ondevice`` ``print``
From 87bd2bd5716640f114acae839e7c1c598c477298 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 15:46:17 +0100
Subject: [PATCH 32/44] Make formatter functions that use regexps ignore case
---
src/calibre/utils/formatter_functions.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py
index 7d5dbe3e0e..32822e1d72 100644
--- a/src/calibre/utils/formatter_functions.py
+++ b/src/calibre/utils/formatter_functions.py
@@ -269,7 +269,7 @@ class BuiltinLookup(BuiltinFormatterFunction):
while i < len(args):
if i + 1 >= len(args):
return formatter.vformat('{' + args[i].strip() + '}', [], kwargs)
- if re.search(args[i], val):
+ if re.search(args[i], val, flags=re.I):
return formatter.vformat('{'+args[i+1].strip() + '}', [], kwargs)
i += 2
@@ -295,7 +295,7 @@ class BuiltinContains(BuiltinFormatterFunction):
def evaluate(self, formatter, kwargs, mi, locals,
val, test, value_if_present, value_if_not):
- if re.search(test, val):
+ if re.search(test, val, flags=re.I):
return value_if_present
else:
return value_if_not
@@ -316,7 +316,7 @@ class BuiltinSwitch(BuiltinFormatterFunction):
while i < len(args):
if i + 1 >= len(args):
return args[i]
- if re.search(args[i], val):
+ if re.search(args[i], val, flags=re.I):
return args[i+1]
i += 2
@@ -332,7 +332,7 @@ class BuiltinInList(BuiltinFormatterFunction):
def evaluate(self, formatter, kwargs, mi, locals, val, sep, pat, fv, nfv):
l = [v.strip() for v in val.split(sep) if v.strip()]
for v in l:
- if re.search(pat, v):
+ if re.search(pat, v, flags=re.I):
return fv
return nfv
@@ -364,7 +364,7 @@ class BuiltinRe(BuiltinFormatterFunction):
'python-compatible regular expressions')
def evaluate(self, formatter, kwargs, mi, locals, val, pattern, replacement):
- return re.sub(pattern, replacement, val)
+ return re.sub(pattern, replacement, val, flags=re.I)
class BuiltinIfempty(BuiltinFormatterFunction):
name = 'ifempty'
From 267687f424a3527aac683a1ea00c0d87244b0fe9 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 15:48:20 +0100
Subject: [PATCH 33/44] ...
---
src/calibre/manual/template_lang.rst | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/calibre/manual/template_lang.rst b/src/calibre/manual/template_lang.rst
index ec398b5d28..f1d2844d37 100644
--- a/src/calibre/manual/template_lang.rst
+++ b/src/calibre/manual/template_lang.rst
@@ -114,6 +114,8 @@ The syntax for using functions is ``{field:function(arguments)}``, or ``{field:f
If you have programming experience, please note that the syntax in this mode (single function) is not what you might expect. Strings are not quoted. Spaces are significant. All arguments must be constants; there is no sub-evaluation. Use :ref:`template program mode ` and :ref:`general program mode ` to avoid these differences.
+Many functions use regular expressions. In all cases, regular expression matching is case-insensitive.
+
The functions available are:
* ``lowercase()`` -- return value of the field in lower case.
From 35bf5ed46e359a13211abd3f71a78da16de309db Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 17:36:06 +0100
Subject: [PATCH 34/44] Refresh the db when on_device is refreshed only if
composite columns are defined.
---
src/calibre/gui2/library/models.py | 2 +-
src/calibre/library/caches.py | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py
index 793f2d353b..554b104c34 100644
--- a/src/calibre/gui2/library/models.py
+++ b/src/calibre/gui2/library/models.py
@@ -125,7 +125,7 @@ class BooksModel(QAbstractTableModel): # {{{
def refresh_ondevice(self):
self.db.refresh_ondevice()
- self.refresh(reset=False)
+ self.resort()
self.research()
def set_book_on_device_func(self, func):
diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py
index 98fd3a9fbc..2ad425fc00 100644
--- a/src/calibre/library/caches.py
+++ b/src/calibre/library/caches.py
@@ -914,6 +914,8 @@ class ResultCache(SearchQueryParser): # {{{
return len(self._map)
def refresh_ondevice(self, db):
+ if self.composites:
+ self.refresh(db)
ondevice_col = self.FIELD_MAP['ondevice']
for item in self._data:
if item is not None:
From 88709bb88ffbdc2cd5972987b89b4047fde831b2 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 29 May 2011 11:06:56 -0600
Subject: [PATCH 35/44] Windows installer: Remember and use previous settings
for installing desktop icons, adding to path, etc.
---
setup/installer/windows/wix-template.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/setup/installer/windows/wix-template.xml b/setup/installer/windows/wix-template.xml
index d4bfbc3c7c..0a85b6fb81 100644
--- a/setup/installer/windows/wix-template.xml
+++ b/setup/installer/windows/wix-template.xml
@@ -17,6 +17,7 @@
IncludeMaximum="yes"
OnlyDetect="no"
Language="1033"
+ MigrateFeatures="yes"
Property="OLDPRODUCTFOUND"/>
Date: Sun, 29 May 2011 11:26:35 -0600
Subject: [PATCH 36/44] Observatorul cultural by song2 and update Dilema Veche
---
recipes/dilemaveche.recipe | 116 +++++++++++++++------------
recipes/observatorul_cultural.recipe | 64 +++++++++++++++
2 files changed, 130 insertions(+), 50 deletions(-)
create mode 100644 recipes/observatorul_cultural.recipe
diff --git a/recipes/dilemaveche.recipe b/recipes/dilemaveche.recipe
index 0d5013b287..8ba75c4123 100644
--- a/recipes/dilemaveche.recipe
+++ b/recipes/dilemaveche.recipe
@@ -1,55 +1,71 @@
-# -*- coding: utf-8 -*-
-#!/usr/bin/env python
-
-__license__ = 'GPL v3'
-__copyright__ = u'2011, Silviu Cotoar\u0103'
-'''
-dilemaveche.ro
-'''
-
from calibre.web.feeds.news import BasicNewsRecipe
class DilemaVeche(BasicNewsRecipe):
- title = u'Dilema Veche'
- __author__ = u'Silviu Cotoar\u0103'
- description = u'Sunt vechi, domnule!'
- publisher = u'Dilema Veche'
- oldest_article = 50
- language = 'ro'
- max_articles_per_feed = 100
- no_stylesheets = True
- use_embedded_content = False
- category = 'Ziare'
- encoding = 'utf-8'
- cover_url = 'http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png'
-
- conversion_options = {
- 'comments' : description
- ,'tags' : category
- ,'language' : language
- ,'publisher' : publisher
- }
-
- keep_only_tags = [
- dict(name='h1', attrs={'class':'art_title'})
- , dict(name='h1', attrs={'class':'art_title online'})
- , dict(name='div', attrs={'class':'item'})
- , dict(name='div', attrs={'class':'art_content'})
- ]
-
+ title = u'Dilema Veche' # apare vinerea, mai pe dupa-masa,depinde de Luiza cred (care se semneaza ca fiind creatorul fiecarui articol in feed-ul RSS)
+ __author__ = 'song2' # inspirat din scriptul pentru Le Monde. Inspired from the Le Monde script
+ description = '"Sint vechi, domnule!" (I.L. Caragiale)'
+ publisher = 'Adevarul Holding'
+ oldest_article = 7
+ max_articles_per_feed = 200
+ encoding = 'utf8'
+ language = 'ro'
+ masthead_url = 'http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png'
+ publication_type = 'magazine'
+ feeds = [
+ ('Editoriale si opinii - Situatiunea', 'http://www.dilemaveche.ro/taxonomy/term/37/0/feed'),
+ ('Editoriale si opinii - Pe ce lume traim', 'http://www.dilemaveche.ro/taxonomy/term/38/0/feed'),
+ ('Editoriale si opinii - Bordeie si obiceie', 'http://www.dilemaveche.ro/taxonomy/term/44/0/feed'),
+ ('Editoriale si opinii - Talc Show', 'http://www.dilemaveche.ro/taxonomy/term/44/0/feed'),
+ ('Tema saptamanii', 'http://www.dilemaveche.ro/taxonomy/term/19/0/feed'),
+ ('La zi in cultura - Dilema va recomanda', 'http://www.dilemaveche.ro/taxonomy/term/58/0/feed'),
+ ('La zi in cultura - Carte', 'http://www.dilemaveche.ro/taxonomy/term/14/0/feed'),
+ ('La zi in cultura - Film', 'http://www.dilemaveche.ro/taxonomy/term/13/0/feed'),
+ ('La zi in cultura - Muzica', 'http://www.dilemaveche.ro/taxonomy/term/1341/0/feed'),
+ ('La zi in cultura - Arte performative', 'http://www.dilemaveche.ro/taxonomy/term/1342/0/feed'),
+ ('La zi in cultura - Arte vizuale', 'http://www.dilemaveche.ro/taxonomy/term/1512/0/feed'),
+ ('Societate - Ieri cu vedere spre azi', 'http://www.dilemaveche.ro/taxonomy/term/15/0/feed'),
+ ('Societate - Din polul opus', 'http://www.dilemaveche.ro/taxonomy/term/41/0/feed'),
+ ('Societate - Mass comedia', 'http://www.dilemaveche.ro/taxonomy/term/43/0/feed'),
+ ('Societate - La singular si la plural', 'http://www.dilemaveche.ro/taxonomy/term/42/0/feed'),
+ ('Oameni si idei - Educatie', 'http://www.dilemaveche.ro/taxonomy/term/46/0/feed'),
+ ('Oameni si idei - Polemici si dezbateri', 'http://www.dilemaveche.ro/taxonomy/term/48/0/feed'),
+ ('Oameni si idei - Stiinta si tehnologie', 'http://www.dilemaveche.ro/taxonomy/term/46/0/feed'),
+ ('Dileme on-line', 'http://www.dilemaveche.ro/taxonomy/term/005/0/feed')
+ ]
+ remove_tags_before = dict(name='div',attrs={'class':'spacer_10'})
remove_tags = [
- dict(name='div', attrs={'class':['article_details']})
- , dict(name='div', attrs={'class':['controale']})
- , dict(name='div', attrs={'class':['art_related_left']})
- ]
+ dict(name='div', attrs={'class':'art_related_left'}),
+ dict(name='div', attrs={'class':'controale'}),
+ dict(name='div', attrs={'class':'simple_overlay'}),
+ ]
+ remove_tags_after = [dict(id='facebookLike')]
+ remove_javascript = True
+ no_stylesheets = True
+ remove_empty_feeds = True
+ extra_css = """
+ body{font-family: Georgia,Times,serif }
+ img{margin-bottom: 0.4em; display:block}
+ """
+ def get_cover_url(self):
+ cover_url = None
+ soup = self.index_to_soup('http://dilemaveche.ro')
+ link_item = soup.find('div',attrs={'class':'box_dr_pdf_picture'})
+ if link_item and link_item.a:
+ cover_url = link_item.a['href']
+ br = BasicNewsRecipe.get_browser()
+ try:
+ br.open(cover_url)
+ except: #daca nu gaseste pdf-ul
+ self.log("\nPDF indisponibil")
+ link_item = soup.find('div',attrs={'class':'box_dr_pdf_picture'})
+ if link_item and link_item.img:
+ cover_url = link_item.img['src']
+ br = BasicNewsRecipe.get_browser()
+ try:
+ br.open(cover_url)
+ except: #daca nu gaseste nici imaginea mica mica
+ print('Mama lor de nenorociti! nu este nici pdf nici imagine')
+ cover_url ='http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png'
+ return cover_url
+ cover_margins = (10, 15, '#ffffff')
- remove_tags_after = [
- dict(name='div', attrs={'class':['article_details']})
- ]
-
- feeds = [
- (u'Feeds', u'http://www.dilemaveche.ro/rss.xml')
- ]
-
- def preprocess_html(self, soup):
- return self.adeify_images(soup)
diff --git a/recipes/observatorul_cultural.recipe b/recipes/observatorul_cultural.recipe
new file mode 100644
index 0000000000..0d64334fd5
--- /dev/null
+++ b/recipes/observatorul_cultural.recipe
@@ -0,0 +1,64 @@
+import re
+from calibre.web.feeds.news import BasicNewsRecipe
+coverpage = None
+
+class ObservatorulCultural(BasicNewsRecipe):
+ title = u'Observatorul cultural'
+ __author__ = 'song2' #prelucrat dupa un script de http://www.thenowhereman.com
+ encoding = 'utf-8'
+ language = 'ro'
+ publication_type = 'magazine'
+ description = 'Spiritul critic in acţiune\n'
+ no_stylesheets = True
+ remove_javascript = True
+ masthead_url='http://www.observatorcultural.ro/userfiles/article/sigla%20Observator%20cultural_02231058.JPG'
+ keep_only_tags = [
+ dict(name='div', attrs={'class':'detaliuArticol'})]
+ remove_tags = [dict(name='div', attrs={'class':'comentariiArticol'}),
+ dict(name='div', attrs={'class':'postComment'}),
+ dict(name='div', attrs={'class':'utileArticol'}),
+ dict(name='p', attrs={'class':'butonComenteaza'}),
+ dict(name='h5'),
+ dict(name='div', attrs={'style':'margin-top: 0px; padding-top: 0px;'})
+ ]
+ def parse_index(self):
+ soup = self.index_to_soup('http://www.observatorcultural.ro/Arhiva*-archive.html')
+ issueTag = soup.find('a', href=re.compile("observatorcultural.ro\/Numarul"))
+ issueURL = issueTag['href']
+ print issueURL;
+ issueSoup = self.index_to_soup(issueURL)
+ feeds = []
+ stories = []
+ for categorie in issueSoup.findAll('dl',attrs={'class':'continutArhive'}):
+ categ=self.tag_to_string(categorie.find('dt'))
+ for story in categorie.findAll('dd'):
+ title=[]
+ for bucatele in story.findAll('a'):
+ title.append(bucatele)
+ if len(title)==1: #daca articolul nu are autor
+ stories.append({
+ 'title' : self.tag_to_string(title[0]),
+ 'url' : title[0]['href'],
+ 'date' : '',
+ 'author' : ''})
+ else: # daca articolul are autor len(title)=2
+ stories.append({
+ 'title' : self.tag_to_string(title[1]),
+ 'url' :title[1]['href'],
+ 'date' : '',
+ 'author' : self.tag_to_string(title[0])})
+ print(self.tag_to_string(title[0]))
+ if 'Editorial' in categ:
+ global coverpage
+ coverpage=title[1]['href'] # am luat link-ul spre editorial
+ feeds.append((categ,stories))
+ stories = []
+ print feeds
+ return feeds
+#procedura de luat coperta
+ def get_cover_url(self):
+ soup = self.index_to_soup(coverpage)
+ link_item = soup.find('a',attrs={'rel':'lightbox'}) # caut imaginea textului
+ a=''
+ cover_url = a.join(link_item.img['src'].split('_details_'))
+ return cover_url
From f25c4232618063c096653faee6e2337b39fa43bf Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 18:28:21 +0100
Subject: [PATCH 37/44] Got the ondevice composite column optimization to work.
---
src/calibre/library/caches.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py
index 2ad425fc00..470bbcdfa8 100644
--- a/src/calibre/library/caches.py
+++ b/src/calibre/library/caches.py
@@ -200,6 +200,11 @@ class CacheRow(list): # {{{
def __getslice__(self, i, j):
return self.__getitem__(slice(i, j))
+ def refresh_composites(self):
+ for c in self._composites:
+ self[c] = None
+ self._must_do = True
+
# }}}
class ResultCache(SearchQueryParser): # {{{
@@ -914,12 +919,11 @@ class ResultCache(SearchQueryParser): # {{{
return len(self._map)
def refresh_ondevice(self, db):
- if self.composites:
- self.refresh(db)
ondevice_col = self.FIELD_MAP['ondevice']
for item in self._data:
if item is not None:
item[ondevice_col] = db.book_on_device_string(item[0])
+ item.refresh_composites()
def refresh(self, db, field=None, ascending=True):
temp = db.conn.get('SELECT * FROM meta2')
From 7a6f8b13a2d83e38117268f3abd2d0845d36cd8d Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 29 May 2011 12:58:54 -0600
Subject: [PATCH 38/44] ...
---
src/calibre/gui2/update.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py
index 847b5785e9..9aae245d98 100644
--- a/src/calibre/gui2/update.py
+++ b/src/calibre/gui2/update.py
@@ -49,11 +49,12 @@ class UpdateNotification(QDialog):
self.logo.setMaximumWidth(110)
self.logo.setPixmap(QPixmap(I('lt.png')).scaled(100, 100,
Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
- self.label = QLabel(''+
+ self.label = QLabel(('
'+
_('%s has been updated to version %s. '
'See the new features. Only update if one of the '
- 'new features or bug fixes is important to you.')%(__appname__, version))
+ '">new features.') + '
'+_('Update only if one of the '
+ 'new features or bug fixes is important to you. '
+ 'If the current version works well for you, do not update.'))%(__appname__, version))
self.label.setOpenExternalLinks(True)
self.label.setWordWrap(True)
self.setWindowTitle(_('Update available!'))
From 19261f15eede6fdf17ec5769a31f8e28c69486bf Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 20:12:31 +0100
Subject: [PATCH 39/44] Add field box to color wizard
---
.../gui2/dialogs/template_line_editor.py | 169 ++++++++++++------
src/calibre/gui2/preferences/look_feel.py | 3 +-
src/calibre/utils/formatter_functions.py | 16 +-
3 files changed, 127 insertions(+), 61 deletions(-)
diff --git a/src/calibre/gui2/dialogs/template_line_editor.py b/src/calibre/gui2/dialogs/template_line_editor.py
index 3d199b156c..bea2c4e316 100644
--- a/src/calibre/gui2/dialogs/template_line_editor.py
+++ b/src/calibre/gui2/dialogs/template_line_editor.py
@@ -5,12 +5,16 @@ __license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal '
__docformat__ = 'restructuredtext en'
+from functools import partial
+from collections import defaultdict
+
from PyQt4.Qt import (QLineEdit, QDialog, QGridLayout, QLabel, QCheckBox,
QDialogButtonBox, QColor, QComboBox, QIcon)
from calibre.gui2.dialogs.template_dialog import TemplateDialog
from calibre.gui2.complete import MultiCompleteLineEdit
from calibre.gui2 import error_dialog
+from calibre.utils.icu import sort_key
class TemplateLineEditor(QLineEdit):
@@ -26,8 +30,8 @@ class TemplateLineEditor(QLineEdit):
def set_mi(self, mi):
self.mi = mi
- def set_tags(self, tags):
- self.tags = tags
+ def set_db(self, db):
+ self.db = db
def contextMenuEvent(self, event):
menu = self.createStandardContextMenu()
@@ -35,9 +39,6 @@ class TemplateLineEditor(QLineEdit):
action_open_editor = menu.addAction(_('Open Template Editor'))
action_open_editor.triggered.connect(self.open_editor)
- if self.tags:
- action_tag_wizard = menu.addAction(_('Open Tag Wizard'))
- action_tag_wizard.triggered.connect(self.tag_wizard)
menu.exec_(event.globalPos())
def open_editor(self):
@@ -53,84 +54,117 @@ class TemplateLineEditor(QLineEdit):
_('The text in the box was not generated by this wizard'),
show=True, show_copy_button=False)
return
- d = TagWizard(self, self.tags, unicode(self.text()))
+ d = TagWizard(self, self.db, unicode(self.text()))
if d.exec_():
self.setText(d.template)
class TagWizard(QDialog):
- def __init__(self, parent, tags, txt):
+ def __init__(self, parent, db, txt):
QDialog.__init__(self, parent)
- self.setWindowTitle(_('Tag Wizard'))
+ self.setWindowTitle(_('Coloring Wizard'))
self.setWindowIcon(QIcon(I('wizard.png')))
- self.tags = tags
+ self.columns = []
+ self.completion_values = defaultdict(dict)
+ for k in db.all_field_keys():
+ m = db.metadata_for_field(k)
+ if m['datatype'] in ('text', 'enumeration', 'series'):
+ self.columns.append(k)
+ if m['is_custom']:
+# self.completion_values[k] = {}
+ self.completion_values[k]['v'] = db.all_custom(m['label'])
+ elif k == 'tags':
+# self.completion_values[k] = {}
+ self.completion_values[k]['v'] = db.all_tags()
+ else:
+ f = getattr(db, 'all' + k, None)
+ if f:
+ self.completion_values[k] = {}
+ self.completion_values[k]['v'] = [v[1] for v in f()]
+ if k in self.completion_values:
+ self.completion_values[k]['m'] = m['is_multiple']
+
+ self.columns.sort(key=sort_key)
+ self.columns.insert(0, '')
+
l = QGridLayout()
self.setLayout(l)
- l.setColumnStretch(0, 1)
- l.setColumnMinimumWidth(0, 300)
- h = QLabel(_('Tags (see the popup help for more information)'))
+ l.setColumnStretch(1, 10)
+ l.setColumnMinimumWidth(1, 300)
+
+ h = QLabel(_('Column'))
+ l.addWidget(h, 0, 0, 1, 1)
+
+ h = QLabel(_('Values (see the popup help for more information)'))
h.setToolTip('' +
- _('You can enter more than one tag per box, separated by commas. '
+ _('You can enter more than one value per box, separated by commas. '
'The comparison ignores letter case.
'
- 'A tag value can be a regular expression. Check the box to turn '
+ 'A value can be a regular expression. Check the box to turn '
'them on. When using regular expressions, note that the wizard '
'puts anchors (^ and $) around the expression, so you '
'must ensure your expression matches from the beginning '
- 'to the end of the tag.
'
+ 'to the end of the column you are checking.
'
'Regular expression examples:') + '
' +
- _('.*
matches any tag. No empty tags are '
- 'checked, so you don\'t need to worry about empty strings '
- 'A.*
matches any tag beginning with A '
- '.*mystery.*
matches any tag containing '
+ _('.*
matches anything in the column. No '
+ 'empty values are checked, so you don\'t need to worry about '
+ 'empty strings '
+ 'A.*
matches anything beginning with A '
+ '.*mystery.*
matches anything containing '
'the word "mystery" ') + '
')
- l.addWidget(h , 0, 0, 1, 1)
+ l.addWidget(h , 0, 1, 1, 1)
c = QLabel(_('is RE'))
c.setToolTip('' +
- _('Check this box if the tag box contains regular expressions') + '
')
- l.addWidget(c, 0, 1, 1, 1)
+ _('Check this box if the values box contains regular expressions') + '')
+ l.addWidget(c, 0, 2, 1, 1)
- c = QLabel(_('Color if tag found'))
+ c = QLabel(_('Color if value found'))
c.setToolTip('' +
_('At least one of the two color boxes must have a value. Leave '
'one color box empty if you want the template to use the next '
'line in this wizard. If both boxes are filled in, the rest of '
'the lines in this wizard will be ignored.') + '
')
- l.addWidget(c, 0, 2, 1, 1)
- c = QLabel(_('Color if tag not found'))
+ l.addWidget(c, 0, 3, 1, 1)
+ c = QLabel(_('Color if value not found'))
c.setToolTip('' +
_('This box is usually filled in only on the last test. If it is '
- 'filled in before the last test, then the color for tag found box '
+ 'filled in before the last test, then the color for value found box '
'must be empty or all the rest of the tests will be ignored.') + '
')
- l.addWidget(c, 0, 3, 1, 1)
+ l.addWidget(c, 0, 4, 1, 1)
self.tagboxes = []
self.colorboxes = []
self.nfcolorboxes = []
self.reboxes = []
+ self.colboxes = []
self.colors = [unicode(s) for s in list(QColor.colorNames())]
self.colors.insert(0, '')
for i in range(0, 10):
+ w = QComboBox()
+ w.addItems(self.columns)
+ l.addWidget(w, i+1, 0, 1, 1)
+ self.colboxes.append(w)
+
tb = MultiCompleteLineEdit(self)
tb.set_separator(', ')
- tb.update_items_cache(self.tags)
self.tagboxes.append(tb)
- l.addWidget(tb, i+1, 0, 1, 1)
+ l.addWidget(tb, i+1, 1, 1, 1)
+ w.currentIndexChanged[str].connect(partial(self.column_changed, valbox=tb))
w = QCheckBox(self)
self.reboxes.append(w)
- l.addWidget(w, i+1, 1, 1, 1)
-
- w = QComboBox(self)
- w.addItems(self.colors)
- self.colorboxes.append(w)
l.addWidget(w, i+1, 2, 1, 1)
w = QComboBox(self)
w.addItems(self.colors)
- self.nfcolorboxes.append(w)
+ self.colorboxes.append(w)
l.addWidget(w, i+1, 3, 1, 1)
+ w = QComboBox(self)
+ w.addItems(self.colors)
+ self.nfcolorboxes.append(w)
+ l.addWidget(w, i+1, 4, 1, 1)
+
if txt:
lines = txt.split('\n')[3:]
i = 0
@@ -141,37 +175,59 @@ class TagWizard(QDialog):
t, c = vals
nc = ''
re = False
+ f = 'tags'
else:
- t,c,nc,re = vals
+ t,c,f,nc,re = vals
try:
self.colorboxes[i].setCurrentIndex(self.colorboxes[i].findText(c))
self.nfcolorboxes[i].setCurrentIndex(self.nfcolorboxes[i].findText(nc))
self.tagboxes[i].setText(t)
self.reboxes[i].setChecked(re == '2')
+ self.colboxes[i].setCurrentIndex(self.colboxes[i].findText(f))
except:
pass
i += 1
bb = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel, parent=self)
- l.addWidget(bb, 100, 2, 1, 2)
+ l.addWidget(bb, 100, 3, 1, 2)
bb.accepted.connect(self.accepted)
bb.rejected.connect(self.reject)
self.template = ''
+ def column_changed(self, s, valbox=None):
+ k = unicode(s)
+ if k in self.completion_values:
+ valbox.update_items_cache(self.completion_values[k]['v'])
+ if self.completion_values[k]['m']:
+ valbox.set_separator(', ')
+ else:
+ valbox.set_separator(None)
+ else:
+ valbox.update_items_cache([])
+ valbox.set_separator(None)
+
def accepted(self):
res = ("program:\n#tag wizard -- do not directly edit\n"
- " t = field('tags');\n first_non_empty(\n")
+ " first_non_empty(\n")
lines = []
- for tb, cb, nfcb, reb in zip(self.tagboxes, self.colorboxes,
- self.nfcolorboxes, self.reboxes):
- tags = [t.strip() for t in unicode(tb.text()).split(',') if t.strip()]
+ for tb, cb, fb, nfcb, reb in zip(self.tagboxes, self.colorboxes,
+ self.colboxes, self.nfcolorboxes, self.reboxes):
+ f = unicode(fb.currentText())
+ if not f:
+ continue
+ m = self.completion_values[f]['m']
c = unicode(cb.currentText()).strip()
nfc = unicode(nfcb.currentText()).strip()
re = reb.checkState()
- if re == 2:
- tags = '$|^'.join(tags)
+ if m:
+ tags = [t.strip() for t in unicode(tb.text()).split(',') if t.strip()]
+ if re == 2:
+ tags = '$|^'.join(tags)
+ else:
+ tags = ','.join(tags)
else:
- tags = ','.join(tags)
+ tags = unicode(tb.text()).strip()
+
if not tags or not (c or nfc):
continue
if c not in self.colors:
@@ -185,24 +241,33 @@ class TagWizard(QDialog):
show=True, show_copy_button=False)
return False
if re == 2:
- lines.append(" in_list(t, ',', '^{0}$', '{1}', '{2}')".\
- format(tags, c, nfc))
+ if m:
+ lines.append(" in_list(field('{3}'), ',', '^{0}$', '{1}', '{2}')".\
+ format(tags, c, nfc, f))
+ else:
+ lines.append(" contains(field('{3}'), '{0}', '{1}', '{2}')".\
+ format(tags, c, nfc, f))
else:
- lines.append(" str_in_list(t, ',', '{0}', '{1}', '{2}')".\
- format(tags, c, nfc))
+ if m:
+ lines.append(" str_in_list(field('{3}'), ',', '{0}', '{1}', '{2}')".\
+ format(tags, c, nfc, f))
+ else:
+ lines.append(" strcmp(field('{3}'), '{0}', '{2}', '{1}', '{2}')".\
+ format(tags, c, nfc, f))
res += ',\n'.join(lines)
res += ')\n'
self.template = res
res = ''
- for tb, cb, nfcb, reb in zip(self.tagboxes, self.colorboxes,
- self.nfcolorboxes, self.reboxes):
+ for tb, cb, fb, nfcb, reb in zip(self.tagboxes, self.colorboxes,
+ self.colboxes, self.nfcolorboxes, self.reboxes):
t = unicode(tb.text()).strip()
if t.endswith(','):
t = t[:-1]
c = unicode(cb.currentText()).strip()
+ f = unicode(fb.currentText())
nfc = unicode(nfcb.currentText()).strip()
re = unicode(reb.checkState())
- if t and c:
- res += '#' + t + ':|:' + c + ':|:' + nfc + ':|:' + re + '\n'
+ if f and t and c:
+ res += '#' + t + ':|:' + c + ':|:' + f +':|:' + nfc + ':|:' + re + '\n'
self.template += res
self.accept()
diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py
index 37e4588b9b..79db1aecf8 100644
--- a/src/calibre/gui2/preferences/look_feel.py
+++ b/src/calibre/gui2/preferences/look_feel.py
@@ -204,7 +204,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
choices.sort(key=sort_key)
choices.insert(0, '')
self.column_color_count = db.column_color_count+1
- tags = db.all_tags()
mi=None
try:
@@ -217,7 +216,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
r('column_color_name_'+str(i), db.prefs, choices=choices)
r('column_color_template_'+str(i), db.prefs)
tpl = getattr(self, 'opt_column_color_template_'+str(i))
- tpl.set_tags(tags)
+ tpl.set_db(db)
tpl.set_mi(mi)
toolbutton = getattr(self, 'opt_column_color_wizard_'+str(i))
toolbutton.clicked.connect(tpl.tag_wizard)
diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py
index 32822e1d72..b66aec2cb9 100644
--- a/src/calibre/utils/formatter_functions.py
+++ b/src/calibre/utils/formatter_functions.py
@@ -331,9 +331,10 @@ class BuiltinInList(BuiltinFormatterFunction):
def evaluate(self, formatter, kwargs, mi, locals, val, sep, pat, fv, nfv):
l = [v.strip() for v in val.split(sep) if v.strip()]
- for v in l:
- if re.search(pat, v, flags=re.I):
- return fv
+ if l:
+ for v in l:
+ if re.search(pat, v, flags=re.I):
+ return fv
return nfv
class BuiltinStrInList(BuiltinFormatterFunction):
@@ -349,10 +350,11 @@ class BuiltinStrInList(BuiltinFormatterFunction):
def evaluate(self, formatter, kwargs, mi, locals, val, sep, str, fv, nfv):
l = [v.strip() for v in val.split(sep) if v.strip()]
c = [v.strip() for v in str.split(sep) if v.strip()]
- for v in l:
- for t in c:
- if strcmp(t, v) == 0:
- return fv
+ if l:
+ for v in l:
+ for t in c:
+ if strcmp(t, v) == 0:
+ return fv
return nfv
class BuiltinRe(BuiltinFormatterFunction):
From cc288ff4cac08b4a3047ef3782aba344aa3b81a5 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 21:21:02 +0100
Subject: [PATCH 40/44] Add a preview field to the wizard. Vary the button
according to whether the wizard created the template Don't show the template
if wizard created
---
.../gui2/dialogs/template_line_editor.py | 88 ++++++++++++++++---
src/calibre/gui2/preferences/look_feel.py | 9 +-
2 files changed, 81 insertions(+), 16 deletions(-)
diff --git a/src/calibre/gui2/dialogs/template_line_editor.py b/src/calibre/gui2/dialogs/template_line_editor.py
index bea2c4e316..2e4a6595fd 100644
--- a/src/calibre/gui2/dialogs/template_line_editor.py
+++ b/src/calibre/gui2/dialogs/template_line_editor.py
@@ -8,9 +8,10 @@ __docformat__ = 'restructuredtext en'
from functools import partial
from collections import defaultdict
-from PyQt4.Qt import (QLineEdit, QDialog, QGridLayout, QLabel, QCheckBox,
- QDialogButtonBox, QColor, QComboBox, QIcon)
+from PyQt4.Qt import (QLineEdit, QDialog, QGridLayout, QLabel, QCheckBox, QIcon,
+ QDialogButtonBox, QColor, QComboBox, QPushButton)
+from calibre.ebooks.metadata.book.base import composite_formatter
from calibre.gui2.dialogs.template_dialog import TemplateDialog
from calibre.gui2.complete import MultiCompleteLineEdit
from calibre.gui2 import error_dialog
@@ -26,6 +27,7 @@ class TemplateLineEditor(QLineEdit):
QLineEdit.__init__(self, parent)
self.tags = None
self.mi = None
+ self.txt = None
def set_mi(self, mi):
self.mi = mi
@@ -42,46 +44,82 @@ class TemplateLineEditor(QLineEdit):
menu.exec_(event.globalPos())
def open_editor(self):
- t = TemplateDialog(self, self.text(), self.mi)
+ if self.txt:
+ t = TemplateDialog(self, self.txt, self.mi)
+ else:
+ t = TemplateDialog(self, self.text(), self.mi)
t.setWindowTitle(_('Edit template'))
if t.exec_():
self.setText(t.textbox.toPlainText())
+ self.txt = None
+
+ def show_wizard_button(self, txt):
+ if not txt or txt.startswith('program:\n#tag wizard'):
+ return True
+ return False
+
+ def setText(self, txt):
+ txt = unicode(txt)
+ if txt and txt.startswith('program:\n#tag wizard'):
+ self.txt = txt
+ self.setReadOnly(True)
+ QLineEdit.setText(self, '')
+ QLineEdit.setText(self, _('Template generated by the wizard'))
+ self.setStyleSheet('TemplateLineEditor { color: gray }')
+ else:
+ QLineEdit.setText(self, txt)
def tag_wizard(self):
txt = unicode(self.text())
- if txt and not txt.startswith('program:\n#tag wizard'):
+ if txt and not self.txt:
error_dialog(self, _('Invalid text'),
_('The text in the box was not generated by this wizard'),
show=True, show_copy_button=False)
return
- d = TagWizard(self, self.db, unicode(self.text()))
+ d = TagWizard(self, self.db, unicode(self.txt), self.mi)
if d.exec_():
self.setText(d.template)
+ def text(self):
+ if self.txt:
+ return self.txt
+ return QLineEdit.text(self)
+
class TagWizard(QDialog):
- def __init__(self, parent, db, txt):
+ def __init__(self, parent, db, txt, mi):
QDialog.__init__(self, parent)
self.setWindowTitle(_('Coloring Wizard'))
self.setWindowIcon(QIcon(I('wizard.png')))
+ self.mi = mi
+
self.columns = []
self.completion_values = defaultdict(dict)
for k in db.all_field_keys():
m = db.metadata_for_field(k)
- if m['datatype'] in ('text', 'enumeration', 'series'):
+ if m['datatype'] in ('text', 'enumeration', 'series') and \
+ m['is_category'] and k not in ('identifiers'):
self.columns.append(k)
if m['is_custom']:
-# self.completion_values[k] = {}
self.completion_values[k]['v'] = db.all_custom(m['label'])
elif k == 'tags':
-# self.completion_values[k] = {}
self.completion_values[k]['v'] = db.all_tags()
+ elif k == 'formats':
+ self.completion_values[k]['v'] = db.all_formats()
else:
- f = getattr(db, 'all' + k, None)
+ if k in ('publisher'):
+ ck = k + 's'
+ else:
+ ck = k
+ f = getattr(db, 'all_' + ck, None)
if f:
- self.completion_values[k] = {}
- self.completion_values[k]['v'] = [v[1] for v in f()]
+ if k == 'authors':
+ self.completion_values[k]['v'] = [v[1].\
+ replace('|', ',') for v in f()]
+ else:
+ self.completion_values[k]['v'] = [v[1] for v in f()]
+
if k in self.completion_values:
self.completion_values[k]['m'] = m['is_multiple']
@@ -188,12 +226,28 @@ class TagWizard(QDialog):
pass
i += 1
+ w = QLabel(_('Preview'))
+ l.addWidget(w, 99, 0, 1, 1)
+ w = self.test_box = QLineEdit(self)
+ w.setReadOnly(True)
+ l.addWidget(w, 99, 1, 1, 1)
+ w = QPushButton(_('Test'))
+ l.addWidget(w, 99, 3, 1, 1)
+ w.clicked.connect(self.preview)
+
bb = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel, parent=self)
l.addWidget(bb, 100, 3, 1, 2)
bb.accepted.connect(self.accepted)
bb.rejected.connect(self.reject)
self.template = ''
+ def preview(self):
+ if not self.generate_program():
+ return
+ t = composite_formatter.safe_format(self.template, self.mi,
+ _('EXCEPTION'), self.mi)
+ self.test_box.setText(t)
+
def column_changed(self, s, valbox=None):
k = unicode(s)
if k in self.completion_values:
@@ -206,7 +260,7 @@ class TagWizard(QDialog):
valbox.update_items_cache([])
valbox.set_separator(None)
- def accepted(self):
+ def generate_program(self):
res = ("program:\n#tag wizard -- do not directly edit\n"
" first_non_empty(\n")
lines = []
@@ -270,4 +324,10 @@ class TagWizard(QDialog):
if f and t and c:
res += '#' + t + ':|:' + c + ':|:' + f +':|:' + nfc + ':|:' + re + '\n'
self.template += res
- self.accept()
+ return True
+
+ def accepted(self):
+ if self.generate_program():
+ self.accept()
+ else:
+ self.template = ''
diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py
index 79db1aecf8..d292cada4b 100644
--- a/src/calibre/gui2/preferences/look_feel.py
+++ b/src/calibre/gui2/preferences/look_feel.py
@@ -6,7 +6,7 @@ __copyright__ = '2010, Kovid Goyal '
__docformat__ = 'restructuredtext en'
from PyQt4.Qt import (QApplication, QFont, QFontInfo, QFontDialog,
- QAbstractListModel, Qt, QColor)
+ QAbstractListModel, Qt, QColor, QIcon)
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, CommaSeparatedList
from calibre.gui2.preferences.look_feel_ui import Ui_Form
@@ -215,11 +215,16 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
for i in range(1, self.column_color_count):
r('column_color_name_'+str(i), db.prefs, choices=choices)
r('column_color_template_'+str(i), db.prefs)
+ txt = db.prefs.get('column_color_template_'+str(i), None)
tpl = getattr(self, 'opt_column_color_template_'+str(i))
tpl.set_db(db)
tpl.set_mi(mi)
toolbutton = getattr(self, 'opt_column_color_wizard_'+str(i))
- toolbutton.clicked.connect(tpl.tag_wizard)
+ if tpl.show_wizard_button(txt):
+ toolbutton.clicked.connect(tpl.tag_wizard)
+ else:
+ toolbutton.clicked.connect(tpl.open_editor)
+ toolbutton.setIcon(QIcon(I('edit_input.png')))
all_colors = [unicode(s) for s in list(QColor.colorNames())]
self.colors_box.setText(', '.join(all_colors))
From b8e12adf641fcd60966c22c59398f88738a1b70d Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 21:28:27 +0100
Subject: [PATCH 41/44] Fix help text
---
src/calibre/gui2/preferences/look_feel.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py
index d292cada4b..3530931c9c 100644
--- a/src/calibre/gui2/preferences/look_feel.py
+++ b/src/calibre/gui2/preferences/look_feel.py
@@ -167,11 +167,10 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
''
'tutorial on using templates.') +
'' +
- _('If you want to color a field based on tags, then click the '
- 'button next to an empty line to open the tags wizard. '
+ _('If you want to color a field based on contents of columns, '
+ 'then click the button next to an empty line to open the wizard. '
'It will build a template for you. You can later edit that '
- 'template with the same wizard. If you edit it by hand, the '
- 'wizard might not work or might restore old values.') +
+ 'template with the same wizard.') +
'
' +
_('The template must evaluate to one of the color names shown '
'below. You can use any legal template expression. '
From 1ae716a115664b46b51a02355fa11df6c3c5972b Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 29 May 2011 14:38:35 -0600
Subject: [PATCH 42/44] Change default toolbar to make it a little more newbie
on small screen/non maximized window friendly
---
src/calibre/gui2/__init__.py | 7 ++++---
src/calibre/gui2/layout.py | 1 -
src/calibre/gui2/preferences/look_feel.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py
index 2cb18f3bda..8499e304c3 100644
--- a/src/calibre/gui2/__init__.py
+++ b/src/calibre/gui2/__init__.py
@@ -48,8 +48,9 @@ else:
gprefs.defaults['action-layout-menubar-device'] = ()
gprefs.defaults['action-layout-toolbar'] = (
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View', None,
- 'Choose Library', 'Donate', None, 'Fetch News', 'Store', 'Save To Disk',
- 'Connect Share', None, 'Remove Books', None, 'Help', 'Preferences',
+ 'Store', 'Donate', 'Fetch News', 'Help', None,
+ 'Remove Books', 'Choose Library', 'Save To Disk',
+ 'Connect Share', 'Preferences',
)
gprefs.defaults['action-layout-toolbar-device'] = (
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View',
@@ -75,7 +76,7 @@ gprefs.defaults['action-layout-context-menu-device'] = (
gprefs.defaults['show_splash_screen'] = True
gprefs.defaults['toolbar_icon_size'] = 'medium'
gprefs.defaults['automerge'] = 'ignore'
-gprefs.defaults['toolbar_text'] = 'auto'
+gprefs.defaults['toolbar_text'] = 'always'
gprefs.defaults['font'] = None
gprefs.defaults['tags_browser_partition_method'] = 'first letter'
gprefs.defaults['tags_browser_collapse_at'] = 100
diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py
index 7d07463b87..76b9f5f9a2 100644
--- a/src/calibre/gui2/layout.py
+++ b/src/calibre/gui2/layout.py
@@ -238,7 +238,6 @@ class Spacer(QWidget): # {{{
self.l.addStretch(10)
# }}}
-
class MainWindowMixin(object): # {{{
def __init__(self, db):
diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py
index 37e4588b9b..862636cb04 100644
--- a/src/calibre/gui2/preferences/look_feel.py
+++ b/src/calibre/gui2/preferences/look_feel.py
@@ -129,7 +129,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
(_('Medium'), 'medium'), (_('Large'), 'large')]
r('toolbar_icon_size', gprefs, choices=choices)
- choices = [(_('Automatic'), 'auto'), (_('Always'), 'always'),
+ choices = [(_('If there is enough room'), 'auto'), (_('Always'), 'always'),
(_('Never'), 'never')]
r('toolbar_text', gprefs, choices=choices)
From dbdee0d46dcd1d43581f95f0ae9582a08d6fd243 Mon Sep 17 00:00:00 2001
From: Charles Haley <>
Date: Sun, 29 May 2011 21:41:36 +0100
Subject: [PATCH 43/44] Add a context menu item to clear the template from a
box
---
src/calibre/gui2/dialogs/template_line_editor.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/calibre/gui2/dialogs/template_line_editor.py b/src/calibre/gui2/dialogs/template_line_editor.py
index 2e4a6595fd..90dec0ccf8 100644
--- a/src/calibre/gui2/dialogs/template_line_editor.py
+++ b/src/calibre/gui2/dialogs/template_line_editor.py
@@ -39,10 +39,18 @@ class TemplateLineEditor(QLineEdit):
menu = self.createStandardContextMenu()
menu.addSeparator()
+ action_clear_field = menu.addAction(_('Remove any template from the box'))
+ action_clear_field.triggered.connect(self.clear_field)
action_open_editor = menu.addAction(_('Open Template Editor'))
action_open_editor.triggered.connect(self.open_editor)
menu.exec_(event.globalPos())
+ def clear_field(self):
+ self.setText('')
+ self.txt = None
+ self.setReadOnly(False)
+ self.setStyleSheet('TemplateLineEditor { color: black }')
+
def open_editor(self):
if self.txt:
t = TemplateDialog(self, self.txt, self.mi)
From 1035de793d7feb398966aa2c83c5e42b11a260c4 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 29 May 2011 15:04:37 -0600
Subject: [PATCH 44/44] ...
---
src/calibre/translations/calibre.pot | 945 ++++++++++++++++-----------
1 file changed, 547 insertions(+), 398 deletions(-)
diff --git a/src/calibre/translations/calibre.pot b/src/calibre/translations/calibre.pot
index a8273ccac2..50576b12ae 100644
--- a/src/calibre/translations/calibre.pot
+++ b/src/calibre/translations/calibre.pot
@@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: calibre 0.8.3\n"
-"POT-Creation-Date: 2011-05-27 10:15+MDT\n"
-"PO-Revision-Date: 2011-05-27 10:15+MDT\n"
+"POT-Creation-Date: 2011-05-29 15:03+MDT\n"
+"PO-Revision-Date: 2011-05-29 15:03+MDT\n"
"Last-Translator: Automatically generated\n"
"Language-Team: LANGUAGE\n"
"MIME-Version: 1.0\n"
@@ -46,10 +46,10 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/__init__.py:253
#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:34
#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:35
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:89
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:455
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:460
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:724
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:88
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:454
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:459
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:729
#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/ereader.py:36
#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/ereader.py:61
#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/extz.py:23
@@ -123,8 +123,8 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/ebooks/pdf/writer.py:102
#: /home/kovid/work/calibre/src/calibre/ebooks/rtf/input.py:313
#: /home/kovid/work/calibre/src/calibre/ebooks/rtf/input.py:315
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:347
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:355
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:348
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:356
#: /home/kovid/work/calibre/src/calibre/gui2/actions/add.py:156
#: /home/kovid/work/calibre/src/calibre/gui2/actions/edit_metadata.py:364
#: /home/kovid/work/calibre/src/calibre/gui2/actions/edit_metadata.py:367
@@ -145,11 +145,11 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/email.py:152
#: /home/kovid/work/calibre/src/calibre/gui2/email.py:167
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:401
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1012
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1188
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1191
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1018
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1194
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1279
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1197
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1200
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1285
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/basic_widgets.py:82
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/basic_widgets.py:212
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/basic_widgets.py:231
@@ -158,23 +158,23 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/single_download.py:160
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/single_download.py:164
#: /home/kovid/work/calibre/src/calibre/gui2/store/google_books_plugin.py:90
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:156
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:163
#: /home/kovid/work/calibre/src/calibre/gui2/viewer/main.py:199
#: /home/kovid/work/calibre/src/calibre/library/cli.py:217
#: /home/kovid/work/calibre/src/calibre/library/database.py:914
#: /home/kovid/work/calibre/src/calibre/library/database2.py:506
#: /home/kovid/work/calibre/src/calibre/library/database2.py:514
#: /home/kovid/work/calibre/src/calibre/library/database2.py:525
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:1804
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:1941
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:2948
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:2950
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:3083
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:1805
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:1942
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:2949
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:2951
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:3084
#: /home/kovid/work/calibre/src/calibre/library/server/mobile.py:233
#: /home/kovid/work/calibre/src/calibre/library/server/opds.py:156
#: /home/kovid/work/calibre/src/calibre/library/server/opds.py:159
#: /home/kovid/work/calibre/src/calibre/library/server/xml.py:79
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:131
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:134
#: /home/kovid/work/calibre/src/calibre/utils/podofo/__init__.py:46
#: /home/kovid/work/calibre/src/calibre/utils/podofo/__init__.py:64
#: /home/kovid/work/calibre/src/calibre/utils/podofo/__init__.py:78
@@ -328,7 +328,7 @@ msgid "Change the way calibre behaves"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/customize/builtins.py:906
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:220
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:221
msgid "Add your own columns"
msgstr ""
@@ -801,7 +801,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/scheduler.py:445
#: /home/kovid/work/calibre/src/calibre/library/database2.py:302
#: /home/kovid/work/calibre/src/calibre/library/database2.py:315
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:2812
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:2813
#: /home/kovid/work/calibre/src/calibre/library/field_metadata.py:159
msgid "News"
msgstr ""
@@ -809,8 +809,8 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/devices/apple/driver.py:2669
#: /home/kovid/work/calibre/src/calibre/gui2/catalog/catalog_epub_mobi.py:65
#: /home/kovid/work/calibre/src/calibre/library/catalog.py:643
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:2772
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:2790
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:2773
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:2791
msgid "Catalog"
msgstr ""
@@ -2304,27 +2304,32 @@ msgstr ""
msgid "Extract common e-book formats from archives (zip/rar) files. Also try to autodetect if they are actually cbz/cbr files."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:145
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:51
+msgid "Value: unknown field "
+msgstr ""
+
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:144
msgid "TEMPLATE ERROR"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:628
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:627
#: /home/kovid/work/calibre/src/calibre/gui2/custom_column_widgets.py:63
#: /home/kovid/work/calibre/src/calibre/gui2/custom_column_widgets.py:563
msgid "No"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:628
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:627
#: /home/kovid/work/calibre/src/calibre/gui2/custom_column_widgets.py:63
#: /home/kovid/work/calibre/src/calibre/gui2/custom_column_widgets.py:563
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:601
msgid "Yes"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:723
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:728
#: /home/kovid/work/calibre/src/calibre/ebooks/pdf/manipulate/info.py:45
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/delete_matching_from_device.py:75
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:64
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1017
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1023
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/single_download.py:132
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/metadata_sources.py:152
#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/models.py:23
@@ -2334,32 +2339,32 @@ msgstr ""
msgid "Title"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:724
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:729
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:66
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1018
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1024
#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/models.py:23
msgid "Author(s)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:725
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:730
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:71
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/metadata_sources.py:149
msgid "Publisher"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:726
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:731
#: /home/kovid/work/calibre/src/calibre/ebooks/pdf/manipulate/info.py:49
msgid "Producer"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:727
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:732
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/single.py:871
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/metadata_sources.py:147
#: /home/kovid/work/calibre/src/calibre/library/field_metadata.py:211
msgid "Comments"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:729
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:734
#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/transforms/jacket.py:170
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/tag_categories.py:60
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:72
@@ -2370,7 +2375,7 @@ msgstr ""
msgid "Tags"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:731
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:736
#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/transforms/jacket.py:168
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/tag_categories.py:60
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:73
@@ -2380,16 +2385,16 @@ msgstr ""
msgid "Series"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:732
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:737
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/metadata_sources.py:154
msgid "Language"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:734
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:739
msgid "Timestamp"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:736
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:741
#: /home/kovid/work/calibre/src/calibre/ebooks/oeb/transforms/jacket.py:167
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:69
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/single_download.py:132
@@ -2397,7 +2402,7 @@ msgstr ""
msgid "Published"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:738
+#: /home/kovid/work/calibre/src/calibre/ebooks/metadata/book/base.py:743
msgid "Rights"
msgstr ""
@@ -3086,131 +3091,131 @@ msgstr ""
msgid "Do not remove font color from output. This is only useful when txt-output-formatting is set to textile. Textile is the only formatting that supports setting font color. If this option is not specified font color will not be set and default to the color displayed by the reader (generally this is black)."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:103
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:104
msgid "Send file to storage card instead of main memory by default"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:105
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:106
msgid "Confirm before deleting"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:107
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:108
msgid "Main window geometry"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:109
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:110
msgid "Notify when a new version is available"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:111
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:112
msgid "Use Roman numerals for series number"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:113
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:114
msgid "Sort tags list by name, popularity, or rating"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:115
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:116
msgid "Match tags by any or all."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:117
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:118
msgid "Number of covers to show in the cover browsing mode"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:119
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:120
msgid "Defaults for conversion to LRF"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:121
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:122
msgid "Options for the LRF ebook viewer"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:124
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:125
msgid "Formats that are viewed using the internal viewer"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:126
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:127
msgid "Columns to be displayed in the book list"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:127
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:128
msgid "Automatically launch content server on application startup"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:128
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:129
msgid "Oldest news kept in database"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:129
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:130
msgid "Show system tray icon"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:131
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:132
msgid "Upload downloaded news to device"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:133
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:134
msgid "Delete books from library after uploading to device"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:135
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:136
msgid "Show the cover flow in a separate window instead of in the main calibre window"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:137
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:138
msgid "Disable notifications from the system tray icon"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:139
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:140
msgid "Default action to perform when send to device button is clicked"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:144
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:145
msgid "Start searching as you type. If this is disabled then search will only take place when the Enter or Return key is pressed."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:147
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:148
msgid "When searching, show all books with search results highlighted instead of showing only the matches. You can use the N or F3 keys to go to the next match."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:165
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:166
msgid "Maximum number of simultaneous conversion/news download jobs. This number is twice the actual value for historical reasons."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:169
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:170
msgid "Download social metadata (tags/rating/etc.)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:171
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:172
msgid "Overwrite author and title with new metadata"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:173
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:174
msgid "Automatically download the cover, if available"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:175
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:176
msgid "Limit max simultaneous jobs to number of CPUs"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:177
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:178
msgid "The layout of the user interface"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:179
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:180
msgid "Show the average rating per item indication in the tag browser"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:181
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:182
msgid "Disable UI animations"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:186
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:187
msgid "tag browser categories not to display"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:461
+#: /home/kovid/work/calibre/src/calibre/gui2/__init__.py:462
msgid "Choose Files"
msgstr ""
@@ -3340,11 +3345,11 @@ msgstr ""
msgid "Select books"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/add.py:328
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/add.py:329
msgid "Merged some books"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/add.py:329
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/add.py:330
msgid "The following duplicate books were found and incoming book formats were processed and merged into your Calibre database according to your automerge settings:"
msgstr ""
@@ -3364,9 +3369,9 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/actions/add.py:376
#: /home/kovid/work/calibre/src/calibre/gui2/actions/delete.py:127
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:78
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:97
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:106
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:83
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:102
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:111
#: /home/kovid/work/calibre/src/calibre/gui2/actions/tweak_epub.py:28
#: /home/kovid/work/calibre/src/calibre/gui2/actions/view.py:139
#: /home/kovid/work/calibre/src/calibre/gui2/actions/view.py:185
@@ -3644,7 +3649,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/actions/choose_library.py:405
#: /home/kovid/work/calibre/src/calibre/gui2/actions/copy_to_library.py:167
#: /home/kovid/work/calibre/src/calibre/gui2/actions/save_to_disk.py:101
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:854
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:857
msgid "Not allowed"
msgstr ""
@@ -4071,7 +4076,7 @@ msgid "Move to next highlighted match"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/actions/next_match.py:13
-#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:373
+#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:388
msgid "N"
msgstr ""
@@ -4274,35 +4279,35 @@ msgstr ""
msgid "Stores"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:38
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:43
#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_dialog.py:18
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:261
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:270
msgid "Choose stores"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:78
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:97
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:106
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:83
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:102
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:111
msgid "Cannot search"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:125
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:130
msgid "Calibre helps you find the ebooks you want by searching the websites of various commercial and public domain book sources for you."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:129
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:134
msgid "Using the integrated search you can easily find which store has the book you are looking for, at the best price. You also get DRM status and other useful information."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:133
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:138
msgid "All transactions (paid or otherwise) are handled between you and the book seller. Calibre is not part of this process and any issues related to a purchase should be directed to the website you are buying from. Be sure to double check that any books you get will work with your e-book reader, especially if the book you are buying has DRM."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:143
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:148
msgid "Show this message again"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:144
+#: /home/kovid/work/calibre/src/calibre/gui2/actions/store.py:149
msgid "About Get Books"
msgstr ""
@@ -4569,7 +4574,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/toolbar_ui.py:110
#: /home/kovid/work/calibre/src/calibre/gui2/shortcuts_ui.py:80
#: /home/kovid/work/calibre/src/calibre/gui2/shortcuts_ui.py:85
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:57
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:79
#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/store_dialog_ui.py:75
#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:133
#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:139
@@ -4606,7 +4611,7 @@ msgid "Book %s of %s"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/book_details.py:144
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1021
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1027
msgid "Collections"
msgstr ""
@@ -4732,7 +4737,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/toolbar_ui.py:98
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/tweaks_ui.py:87
#: /home/kovid/work/calibre/src/calibre/gui2/store/basic_config_widget_ui.py:37
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:55
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:77
#: /home/kovid/work/calibre/src/calibre/gui2/store/config/search/search_widget_ui.py:98
#: /home/kovid/work/calibre/src/calibre/gui2/store/config/search_widget_ui.py:98
#: /home/kovid/work/calibre/src/calibre/gui2/wizard/send_email_ui.py:123
@@ -5333,7 +5338,7 @@ msgstr ""
msgid ""
"This wizard will help you choose an appropriate font size key for your needs. Just enter the base font size of the input document and then enter an input font size. The wizard will display what font size it will be mapped to, by the font rescaling algorithm. You can adjust the algorithm by adjusting the output base font size and font key below. When you find values suitable for you, click OK.
\n"
"By default, if the output base font size is zero and/or no font size key is specified, calibre will use the values from the current Output Profile.
\n"
-"See the User Manual for a discussion of how font size rescaling works.
"
+"See the User Manual for a discussion of how font size rescaling works.
"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/convert/font_key_ui.py:108
@@ -5396,7 +5401,7 @@ msgid "Modify the document text and structure using common patterns."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/convert/heuristics_ui.py:113
-msgid "Heuristic processing means that calibre will scan your book for common patterns and fix them. As the name implies, this involves guesswork, which means that it could end up worsening the result of a conversion, if calibre guesses wrong. Therefore, it is disabled by default. Often, if a conversion does not turn out as you expect, turning on heuristics can improve matters. Read more about the various heuristic processing options in the User Manual."
+msgid "Heuristic processing means that calibre will scan your book for common patterns and fix them. As the name implies, this involves guesswork, which means that it could end up worsening the result of a conversion, if calibre guesses wrong. Therefore, it is disabled by default. Often, if a conversion does not turn out as you expect, turning on heuristics can improve matters. Read more about the various heuristic processing options in the User Manual."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/convert/heuristics_ui.py:114
@@ -5810,8 +5815,9 @@ msgid "PDB Output"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/convert/pdb_output_ui.py:48
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:215
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:195
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:225
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:186
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:205
msgid "&Format:"
msgstr ""
@@ -5970,7 +5976,7 @@ msgstr ""
#:
#: /home/kovid/work/calibre/src/calibre/gui2/convert/search_and_replace_ui.py:154
-msgid "Search and replace uses regular expressions. See the regular expressions tutorial to get started with regular expressions. Also clicking the wizard buttons below will allow you to test your regular expression against the current input document."
+msgid "
Search and replace uses regular expressions. See the regular expressions tutorial to get started with regular expressions. Also clicking the wizard buttons below will allow you to test your regular expression against the current input document."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/convert/single.py:173
@@ -6286,7 +6292,7 @@ msgid "(A regular expression)"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/convert/xpath_wizard_ui.py:89
-msgid "
For example, to match all h2 tags that have class=\"chapter\", set tag to h2, attribute to class and value to chapter.
Leaving attribute blank will match any attribute and leaving value blank will match any value. Setting tag to * will match any tag.
To learn more advanced usage of XPath see the XPath Tutorial."
+msgid "
For example, to match all h2 tags that have class=\"chapter\", set tag to h2, attribute to class and value to chapter.
Leaving attribute blank will match any attribute and leaving value blank will match any value. Setting tag to * will match any tag.
To learn more advanced usage of XPath see the XPath Tutorial."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/cover_flow.py:128
@@ -6312,8 +6318,8 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:128
#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:148
#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:230
-#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:263
-#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:267
+#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:279
+#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:283
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/basic_widgets.py:1139
msgid "Undefined"
msgstr ""
@@ -6569,7 +6575,7 @@ msgstr ""
#:
#: /home/kovid/work/calibre/src/calibre/gui2/device_drivers/configwidget.py:148
-#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:421
+#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:437
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/plugboard.py:273
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/save_template.py:61
msgid "Invalid template"
@@ -6577,7 +6583,7 @@ msgstr ""
#:
#: /home/kovid/work/calibre/src/calibre/gui2/device_drivers/configwidget.py:149
-#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:422
+#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:438
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/plugboard.py:274
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/save_template.py:62
msgid "The template %s is invalid:"
@@ -6937,7 +6943,8 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/comicconf_ui.py:97
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:211
#: /home/kovid/work/calibre/src/calibre/gui2/metadata/basic_widgets.py:73
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:189
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:181
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:199
msgid "&Title:"
msgstr ""
@@ -6951,12 +6958,12 @@ msgid "&Profile:"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/comments_dialog.py:24
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:218
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:222
msgid "&OK"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/comments_dialog.py:25
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:219
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:223
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/tweak_epub_ui.py:65
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/main.py:233
msgid "&Cancel"
@@ -7011,7 +7018,7 @@ msgstr ""
#:
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/delete_matching_from_device.py:76
#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:68
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1019
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1025
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:32
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:73
#: /home/kovid/work/calibre/src/calibre/library/field_metadata.py:321
@@ -8019,91 +8026,105 @@ msgid "Negate"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:198
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:196
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:176
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:206
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:168
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:186
msgid "Advanced Search"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:199
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:197
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:177
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:207
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:169
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:187
msgid "&What kind of match to use:"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:200
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:198
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:178
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:208
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:170
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:188
msgid "Contains: the word or phrase matches anywhere in the metadata field"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:201
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:199
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:179
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:209
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:171
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:189
msgid "Equals: the word or phrase must match the entire metadata field"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:202
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:200
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:180
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:210
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:172
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:190
msgid "Regular expression: the expression must match anywhere in the metadata field"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:203
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:201
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:181
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:211
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:173
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:191
msgid "Find entries that have..."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:204
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:202
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:182
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:212
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:174
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:192
msgid "&All these words:"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:205
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:203
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:183
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:213
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:175
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:193
msgid "This exact &phrase:"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:206
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:204
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:184
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:214
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:176
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:194
msgid "&One or more of these words:"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:207
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:205
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:185
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:215
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:177
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:195
msgid "But dont show entries that have..."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:208
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:206
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:186
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:216
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:178
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:196
msgid "Any of these &unwanted words:"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:209
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:207
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:187
-msgid "See the User Manual for more help"
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:217
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:197
+msgid "See the User Manual for more help"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:210
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:208
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:188
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:218
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:180
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:198
msgid "A&dvanced Search"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:212
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:210
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:190
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:220
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:182
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:200
msgid "Enter the title."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:213
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:191
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:183
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:201
msgid "&Author:"
msgstr ""
@@ -8126,14 +8147,16 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:219
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/template_functions_ui.py:101
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:213
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:193
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:223
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:184
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:203
msgid "&Clear"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/search_ui.py:220
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:214
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:194
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:224
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:185
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:204
msgid "Search only in specific fields:"
msgstr ""
@@ -8341,6 +8364,10 @@ msgstr ""
msgid "Ctrl+S"
msgstr ""
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:249
+msgid "EXCEPTION: "
+msgstr ""
+
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog_ui.py:71
msgid "Function &name:"
msgstr ""
@@ -8355,53 +8382,90 @@ msgid "Python &code:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:32
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:36
msgid "Open Template Editor"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:35
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:39
msgid "Open Tag Wizard"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:41
-#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:408
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:45
+#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:424
msgid "Edit template"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:48
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:52
msgid "Invalid text"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:49
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:53
msgid "The text in the box was not generated by this wizard"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:60
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:64
msgid "Tag Wizard"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:68
-msgid "Tags (more than one per box permitted)"
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:72
+msgid "Tags (see the popup help for more information)"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:69
-msgid "Color"
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:74
+msgid "You can enter more than one tag per box, separated by commas. The comparison ignores letter case.
A tag value can be a regular expression. Check the box to turn them on. When using regular expressions, note that the wizard puts anchors (^ and $) around the expression, so you must ensure your expression matches from the beginning to the end of the tag.
Regular expression examples:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:115
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:82
+msgid "
.*
matches any tag. No empty tags are checked, so you don't need to worry about empty stringsA.*
matches any tag beginning with A.*mystery.*
matches any tag containing the word \"mystery\""
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:89
+msgid "is RE"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:91
+msgid "Check this box if the tag box contains regular expressions"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:94
+msgid "Color if tag found"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:96
+msgid "At least one of the two color boxes must have a value. Leave one color box empty if you want the template to use the next line in this wizard. If both boxes are filled in, the rest of the lines in this wizard will be ignored."
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:101
+msgid "Color if tag not found"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:103
+msgid "This box is usually filled in only on the last test. If it is filled in before the last test, then the color for tag found box must be empty or all the rest of the tests will be ignored."
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:178
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:183
msgid "Invalid color"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:116
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:179
+#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_line_editor.py:184
msgid "The color {0} is not valid"
msgstr ""
@@ -8623,7 +8687,7 @@ msgid "&Add feed"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/user_profiles_ui.py:286
-msgid "For help with writing advanced news recipes, please visit User Recipes"
+msgid "For help with writing advanced news recipes, please visit User Recipes"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/user_profiles_ui.py:287
@@ -8719,7 +8783,7 @@ msgstr ""
msgid ""
"\n"
"
Set a regular expression pattern to use when trying to guess ebook metadata from filenames.
\n"
-"
A tutorial on using regular expressions is available.
\n"
+"
A tutorial on using regular expressions is available.
\n"
"
Use the Test functionality below to test your regular expression on a few sample filenames (remember to include the file extension). The group names for the various metadata entries are documented in tooltips.
"
msgstr ""
@@ -8941,7 +9005,7 @@ msgid "Show books in the main memory of the device"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/layout.py:72
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:1023
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:1024
msgid "Card A"
msgstr ""
@@ -8950,7 +9014,7 @@ msgid "Show books in storage card A"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/layout.py:74
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:1025
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:1026
msgid "Card B"
msgstr ""
@@ -8990,7 +9054,7 @@ msgstr ""
msgid "Copy current search text (instead of search name)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:373
+#: /home/kovid/work/calibre/src/calibre/gui2/library/delegates.py:388
msgid "Y"
msgstr ""
@@ -9008,75 +9072,75 @@ msgstr ""
msgid "Modified"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:760
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1317
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:766
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1323
#: /home/kovid/work/calibre/src/calibre/gui2/tag_view.py:797
msgid "The lookup/search name is \"{0}\""
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:766
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1319
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:772
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1325
msgid "This book's UUID is \"{0}\""
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1016
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1022
msgid "In Library"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1020
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1026
#: /home/kovid/work/calibre/src/calibre/library/field_metadata.py:311
msgid "Size"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1297
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1303
msgid "Marked for deletion"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1300
+#: /home/kovid/work/calibre/src/calibre/gui2/library/models.py:1306
msgid "Double click to edit me
"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:158
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:159
msgid "Hide column %s"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:163
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:164
msgid "Sort on %s"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:164
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:165
msgid "Ascending"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:167
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:168
msgid "Descending"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:179
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:180
msgid "Change text alignment for %s"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:181
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:182
msgid "Left"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:181
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:182
msgid "Right"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:182
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:183
msgid "Center"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:201
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:202
msgid "Show column"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:213
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:214
msgid "Restore default layout"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:855
+#: /home/kovid/work/calibre/src/calibre/gui2/library/views.py:858
msgid "Dropping onto a device is not supported. First add the book to the calibre library."
msgstr ""
@@ -9995,7 +10059,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:41
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:66
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:73
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:153
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:156
msgid "Yes/No"
msgstr ""
@@ -10027,7 +10091,7 @@ msgstr ""
#:
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:65
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:152
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:155
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/emailp.py:27
#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:21
#: /home/kovid/work/calibre/src/calibre/library/field_metadata.py:124
@@ -10071,117 +10135,127 @@ msgid "Selected column is not a user-defined column"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:154
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:157
msgid "My Tags"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:155
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:158
msgid "My Series"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:156
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:159
msgid "My Rating"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:157
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:160
msgid "People"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:185
-msgid "No lookup name was provided"
-msgstr ""
-
-#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:189
-msgid "The lookup name must contain only lower case letters, digits and underscores, and start with a letter"
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:187
+msgid "Examples: The format {0:0>4d}
gives a 4-digit number with leading zeros. The format {0:d} days
prints the number then the word \"days\""
msgstr ""
#:
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:192
+msgid "Examples: The format {0:.1f}
gives a floating point number with 1 digit after the decimal point. The format Price: $ {0:,.2f}
prints \"Price $ \" then displays the number with 2 digits after the decimal point and thousands separated by commas."
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:201
+msgid "No lookup name was provided"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:205
+msgid "The lookup name must contain only lower case letters, digits and underscores, and start with a letter"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:208
msgid "Lookup names cannot end with _index, because these names are reserved for the index of a series column."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:202
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:218
msgid "No column heading was provided"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:212
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:228
msgid "The lookup name %s is already used"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:224
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:240
msgid "The heading %s is already used"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:235
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:251
msgid "You must enter a template for composite columns"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:244
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:260
msgid "You must enter at least one value for enumeration columns"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:248
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:264
msgid "You cannot provide the empty value, as it is included by default"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:252
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:268
msgid "The value \"{0}\" is in the list more than once"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:260
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:276
msgid "The colors box must be empty or contain the same number of items as the value box"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:265
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column.py:281
msgid "The color {0} is unknown"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:201
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:217
msgid "&Lookup name"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:202
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:218
msgid "Column &heading"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:203
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:219
msgid "Used for searching the column. Must contain only digits and lower case letters."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:204
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:220
msgid "Column heading in the library view and category name in the tag browser"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:205
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:221
msgid "&Column type"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:206
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:222
msgid "What kind of information will be kept in the column."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:207
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:223
msgid ""
"Show check marks in the GUI. Values of 'yes', 'checked', and 'true'\n"
"will show a green check. Values of 'no', 'unchecked', and 'false' will show a red X.\n"
@@ -10189,22 +10263,22 @@ msgid ""
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:210
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:226
msgid "Show checkmarks"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:211
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:227
msgid "Check this box if this column contains names, like the authors column."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:212
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:228
msgid "Contains names"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:213
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:229
msgid ""
"Date format. Use 1-4 'd's for day, 1-4 'M's for month, and 2 or 4 'y's for year.
\n"
"For example:\n"
@@ -10215,68 +10289,86 @@ msgid ""
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:219
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:235
msgid "Use MMM yyyy for month + year, yyyy for year only"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:220
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:236
msgid "Default: dd MMM yyyy."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:221
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:237
+msgid ""
+"
The format specifier must begin with {0:
\n"
+"and end with }
You can have text before and after the format specifier.\n"
+" "
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:240
+msgid "
Default: Not formatted. For format language details see the python documentation"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:241
msgid "Format for &dates"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:222
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:242
+msgid "Format for &numbers"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:243
msgid "&Template"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:223
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:244
msgid "Field template. Uses the same syntax as save templates."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:224
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:245
msgid "Similar to save templates. For example, {title} {isbn}"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:225
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:246
msgid "Default: (nothing)"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:226
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:247
msgid "&Sort/search column by"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:227
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:248
msgid "How this column should handled in the GUI when sorting and searching"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:228
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:249
msgid "If checked, this column will appear in the tags browser as a category"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:229
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:250
msgid "Show in tags browser"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:230
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:235
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:251
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:256
msgid "Values"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:231
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:252
msgid ""
"A comma-separated list of permitted values. The empty value is always\n"
"included, and is the default. For example, the list 'one,two,three' has\n"
@@ -10284,19 +10376,19 @@ msgid ""
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:234
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:255
msgid "The empty string is always the first value"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:236
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:257
msgid ""
"A list of color names to use when displaying an item. The\n"
"list must be empty or contain a color for each value."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:238
+#: /home/kovid/work/calibre/src/calibre/gui2/preferences/create_custom_column_ui.py:259
msgid "Colors"
msgstr ""
@@ -10418,7 +10510,7 @@ msgid "Always"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/look_feel.py:132
-msgid "Automatic"
+msgid "If there is enough room"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/look_feel.py:133
@@ -10438,7 +10530,7 @@ msgid "Partitioned"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/look_feel.py:163
-msgid "Here you can specify coloring rules for columns shown in the library view. Choose the column you wish to color, then supply a template that specifies the color to use based on the values in the column. There is a tutorial on using templates."
+msgid "Here you can specify coloring rules for columns shown in the library view. Choose the column you wish to color, then supply a template that specifies the color to use based on the values in the column. There is a tutorial on using templates."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/look_feel.py:170
@@ -10920,7 +11012,7 @@ msgid "Search for plugin"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/plugins.py:230
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:297
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:321
msgid "No matches"
msgstr ""
@@ -11561,7 +11653,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/search_box.py:95
#: /home/kovid/work/calibre/src/calibre/gui2/search_box.py:279
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:58
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:80
#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/store_dialog_ui.py:76
#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:134
#: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:109
@@ -11646,6 +11738,7 @@ msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/shortcuts.py:48
#: /home/kovid/work/calibre/src/calibre/gui2/shortcuts_ui.py:78
#: /home/kovid/work/calibre/src/calibre/gui2/shortcuts_ui.py:83
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:83
#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:138
#: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:113
#: /home/kovid/work/calibre/src/calibre/gui2/widgets.py:351
@@ -11718,54 +11811,87 @@ msgid "Open store in external web browswer"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:209
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:219
msgid "&Name:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:211
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:221
msgid "&Description:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:212
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:222
msgid "&Headquarters:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:216
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:226
msgid "Enabled:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:217
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:227
msgid "DRM:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:218
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:220
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:228
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:230
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:233
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:207
msgid "true"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:219
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:221
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:229
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:231
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:234
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:208
msgid "false"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:222
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:232
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:206
+msgid "Affiliate:"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/adv_search_builder_ui.py:235
msgid "Nam&e/Description ..."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:56
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:78
#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:132
#: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:108
msgid "Query:"
msgstr ""
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:81
+msgid "Enable"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:82
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:136
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:111
+msgid "All"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/chooser_widget_ui.py:84
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:137
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:112
+msgid "Invert"
+msgstr ""
+
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:21
+msgid "Affiliate"
+msgstr ""
+
#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:21
msgid "Enabled"
msgstr ""
@@ -11779,33 +11905,44 @@ msgid "No DRM"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:108
-msgid "
This store is currently diabled and cannot be used in other parts of calibre.
"
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:129
+msgid "This store is currently diabled and cannot be used in other parts of calibre."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:110
-msgid "This store is currently enabled and can be used in other parts of calibre.
"
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:131
+msgid "This store is currently enabled and can be used in other parts of calibre."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:115
-msgid "This store only distributes ebooks with DRM.
"
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:136
+msgid "This store only distributes ebooks with DRM."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:117
-msgid "This store distributes ebooks with DRM. It may have some titles without DRM, but you will need to check on a per title basis.
"
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:138
+msgid "This store distributes ebooks with DRM. It may have some titles without DRM, but you will need to check on a per title basis."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:119
-msgid "This store is headquartered in %s. This is a good indication of what market the store caters to. However, this does not necessarily mean that the store is limited to that market only.
"
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:140
+msgid "This store is headquartered in %s. This is a good indication of what market the store caters to. However, this does not necessarily mean that the store is limited to that market only."
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:121
-msgid "This store distributes ebooks in the following formats: %s
"
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:143
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:203
+msgid "Buying from this store supports the calibre developer: %s."
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/models.py:145
+msgid "This store distributes ebooks in the following formats: %s"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/config/chooser/results_view.py:47
+msgid "Configure..."
msgstr ""
#:
@@ -11898,6 +12035,17 @@ msgstr ""
msgid "Not Available"
msgstr ""
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:179
+msgid "See the User Manual for more help"
+msgstr ""
+
+#:
+#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/adv_search_builder_ui.py:187
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:209
+msgid "Titl&e/Author/Price ..."
+msgstr ""
+
#:
#: /home/kovid/work/calibre/src/calibre/gui2/store/mobileread/cache_progress_dialog_ui.py:51
msgid "Updating book cache"
@@ -11955,13 +12103,12 @@ msgid "Search:"
msgstr ""
#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:192
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:202
msgid "&Price:"
msgstr ""
-#:
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/adv_search_builder_ui.py:196
-msgid "Titl&e/Author/Price ..."
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:36
+msgid ""
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:36
@@ -11972,31 +12119,35 @@ msgstr ""
msgid "Price"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:180
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:191
msgid "Detected price as: %s. Check with the store before making a purchase to verify this price is correct. This price often does not include promotions the store may be running."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:183
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:194
msgid "This book as been detected as having DRM restrictions. This book may not work with your reader and you will have limitations placed upon you as to what you can do with this book. Check with the store before making any purchases to ensure you can actually read this book."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:185
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:196
msgid "This book has been detected as being DRM Free. You should be able to use this book on any device provided it is in a format calibre supports for conversion. However, before making a purchase double check the DRM status with the store. The store may not be disclosing the use of DRM."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:187
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/models.py:198
msgid "The DRM status of this book could not be determined. There is a very high likelihood that this book is actually DRM restricted."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:252
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:105
+msgid "Buying from this store supports the calibre developer: %s
"
+msgstr ""
+
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:261
msgid "Customize get books search"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:262
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:271
msgid "Configure search"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:297
+#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search.py:321
msgid "Couldn't find any books matching your query."
msgstr ""
@@ -12005,16 +12156,6 @@ msgstr ""
msgid "Get Books"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:136
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:111
-msgid "All"
-msgstr ""
-
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:137
-#: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:112
-msgid "Invert"
-msgstr ""
-
#: /home/kovid/work/calibre/src/calibre/gui2/store/search/search_ui.py:140
msgid "Open a selected book in the system's web browser"
msgstr ""
@@ -12381,15 +12522,19 @@ msgstr ""
msgid "%s has been updated to version %s. See the new features."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/update.py:58
+#: /home/kovid/work/calibre/src/calibre/gui2/update.py:55
+msgid "Update only if one of the new features or bug fixes is important to you. If the current version works well for you, do not update."
+msgstr ""
+
+#: /home/kovid/work/calibre/src/calibre/gui2/update.py:60
msgid "Update available!"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/update.py:63
+#: /home/kovid/work/calibre/src/calibre/gui2/update.py:65
msgid "Show this notification for future updates"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/gui2/update.py:68
+#: /home/kovid/work/calibre/src/calibre/gui2/update.py:70
msgid "&Get update"
msgstr ""
@@ -12960,7 +13105,7 @@ msgid "Demo videos
Videos demonstrating the various features of calibre
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/wizard/finish_ui.py:51
-msgid "User Manual
A User Manual is also available online."
+msgid "User Manual
A User Manual is also available online."
msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/wizard/kindle_ui.py:49
@@ -13166,63 +13311,63 @@ msgid "Turn on the &content server"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/library/caches.py:161
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:562
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:576
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:586
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:567
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:581
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:591
msgid "checked"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/library/caches.py:161
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:562
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:576
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:586
-#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:214
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:567
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:581
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:591
+#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:216
msgid "yes"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/library/caches.py:163
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:561
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:573
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:583
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:566
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:578
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:588
msgid "unchecked"
msgstr ""
#: /home/kovid/work/calibre/src/calibre/library/caches.py:163
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:561
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:573
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:583
-#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:214
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:566
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:578
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:588
+#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:216
msgid "no"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:356
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:361
msgid "today"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:359
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:364
msgid "yesterday"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:362
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:367
msgid "thismonth"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:365
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:366
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:370
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:371
msgid "daysago"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:563
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:580
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:568
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:585
msgid "blank"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:563
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:580
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:568
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:585
msgid "empty"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/caches.py:564
+#: /home/kovid/work/calibre/src/calibre/library/caches.py:569
msgid "Invalid boolean query \"{0}\""
msgstr ""
@@ -13980,19 +14125,19 @@ msgstr ""
msgid "%sAverage rating is %3.1f"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:1021
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:1022
msgid "Main"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:3109
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:3110
msgid "Migrating old database to ebook library in %s
"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:3138
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:3139
msgid "Copying %s"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/database2.py:3155
+#: /home/kovid/work/calibre/src/calibre/library/database2.py:3156
msgid "Compacting database"
msgstr ""
@@ -14117,8 +14262,8 @@ msgstr ""
msgid "Replace whitespace with underscores."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:370
-#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:398
+#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:372
+#: /home/kovid/work/calibre/src/calibre/library/save_to_disk.py:400
msgid "Requested formats not available"
msgstr ""
@@ -14447,35 +14592,35 @@ msgstr ""
msgid "syntax error - program ends before EOF"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:101
-msgid "unknown id "
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:103
+msgid "Unknown identifier "
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:107
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:110
msgid "unknown function {0}"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:126
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:129
msgid "missing closing parenthesis"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:145
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:148
msgid "expression is not function or constant"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:179
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:182
msgid "format: type {0} requires an integer value, got {1}"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:185
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:188
msgid "format: type {0} requires a decimal (float) value, got {1}"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:296
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:299
msgid "%s: unknown function"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:343
+#: /home/kovid/work/calibre/src/calibre/utils/formatter.py:348
msgid "No such variable "
msgstr ""
@@ -14483,167 +14628,171 @@ msgstr ""
msgid "No documentation provided"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:79
-msgid "Exception "
-msgstr ""
-
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:97
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:90
msgid "strcmp(x, y, lt, eq, gt) -- does a case-insensitive comparison of x and y as strings. Returns lt if x < y. Returns eq if x == y. Otherwise returns gt."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:112
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:105
msgid "cmp(x, y, lt, eq, gt) -- compares x and y after converting both to numbers. Returns lt if x < y. Returns eq if x == y. Otherwise returns gt."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:127
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:120
msgid "strcat(a, b, ...) -- can take any number of arguments. Returns a string formed by concatenating all the arguments"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:140
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:133
msgid "add(x, y) -- returns x + y. Throws an exception if either x or y are not numbers."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:150
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:143
msgid "subtract(x, y) -- returns x - y. Throws an exception if either x or y are not numbers."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:160
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:153
msgid "multiply(x, y) -- returns x * y. Throws an exception if either x or y are not numbers."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:170
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:163
msgid "divide(x, y) -- returns x / y. Throws an exception if either x or y are not numbers."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:180
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:173
msgid "template(x) -- evaluates x as a template. The evaluation is done in its own context, meaning that variables are not shared between the caller and the template evaluation. Because the { and } characters are special, you must use [[ for the { character and ]] for the } character; they are converted automatically. For example, template('[[title_sort]]') will evaluate the template {title_sort} and return its value."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:195
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:188
msgid "eval(template) -- evaluates the template, passing the local variables (those 'assign'ed to) instead of the book metadata. This permits using the template processor to construct complex results from local variables."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:208
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:201
msgid "assign(id, val) -- assigns val to id, then returns val. id must be an identifier, not an expression"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:218
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:211
msgid "print(a, b, ...) -- prints the arguments to standard output. Unless you start calibre from the command line (calibre-debug -g), the output will go to a black hole."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:229
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:222
msgid "field(name) -- returns the metadata field named by name"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:237
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:230
msgid "raw_field(name) -- returns the metadata field named by name without applying any formatting."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:246
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:239
msgid "substr(str, start, end) -- returns the start'th through the end'th characters of str. The first character in str is the zero'th character. If end is negative, then it indicates that many characters counting from the right. If end is zero, then it indicates the last character. For example, substr('12345', 1, 0) returns '2345', and substr('12345', 1, -1) returns '234'."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:259
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:252
msgid "lookup(val, pattern, field, pattern, field, ..., else_field) -- like switch, except the arguments are field (metadata) names, not text. The value of the appropriate field will be fetched and used. Note that because composite columns are fields, you can use this function in one composite field to use the value of some other composite field. This is extremely useful when constructing variable save paths"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:274
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:267
msgid "lookup requires either 2 or an odd number of arguments"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:286
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:279
msgid "test(val, text if not empty, text if empty) -- return `text if not empty` if the field is not empty, otherwise return `text if empty`"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:298
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:291
msgid "contains(val, pattern, text if match, text if not match) -- checks if field contains matches for the regular expression `pattern`. Returns `text if match` if matches are found, otherwise it returns `text if no match`"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:313
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:306
msgid "switch(val, pattern, value, pattern, value, ..., else_value) -- for each `pattern, value` pair, checks if the field matches the regular expression `pattern` and if so, returns that `value`. If no pattern matches, then else_value is returned. You can have as many `pattern, value` pairs as you want"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:321
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:314
msgid "switch requires an odd number of arguments"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:333
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:326
msgid "in_list(val, separator, pattern, found_val, not_found_val) -- treat val as a list of items separated by separator, comparing the pattern against each value in the list. If the pattern matches a value, return found_val, otherwise return not_found_val."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:349
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:342
+msgid "str_in_list(val, separator, string, found_val, not_found_val) -- treat val as a list of items separated by separator, comparing the string against each value in the list. If the string matches a value, return found_val, otherwise return not_found_val. If the string contains separators, then it is also treated as a list and each value is checked."
+msgstr ""
+
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:361
msgid "re(val, pattern, replacement) -- return the field after applying the regular expression. All instances of `pattern` are replaced with `replacement`. As in all of calibre, these are python-compatible regular expressions"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:360
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:372
msgid "ifempty(val, text if empty) -- return val if val is not empty, otherwise return `text if empty`"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:372
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:384
msgid "shorten(val, left chars, middle text, right chars) -- Return a shortened version of the field, consisting of `left chars` characters from the beginning of the field, followed by `middle text`, followed by `right chars` characters from the end of the string. `Left chars` and `right chars` must be integers. For example, assume the title of the book is `Ancient English Laws in the Times of Ivanhoe`, and you want it to fit in a space of at most 15 characters. If you use {title:shorten(9,-,5)}, the result will be `Ancient E-nhoe`. If the field's length is less than left chars + right chars + the length of `middle text`, then the field will be used intact. For example, the title `The Dome` would not be changed."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:397
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:409
msgid "count(val, separator) -- interprets the value as a list of items separated by `separator`, returning the number of items in the list. Most lists use a comma as the separator, but authors uses an ampersand. Examples: {tags:count(,)}, {authors:count(&)}"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:408
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:420
msgid "list_item(val, index, separator) -- interpret the value as a list of items separated by `separator`, returning the `index`th item. The first item is number zero. The last item can be returned using `list_item(-1,separator)`. If the item is not in the list, then the empty value is returned. The separator has the same meaning as in the count function."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:428
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:440
msgid "select(val, key) -- interpret the value as a comma-separated list of items, with the items being \"id:value\". Find the pair with theid equal to key, and return the corresponding value."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:445
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:457
msgid "sublist(val, start_index, end_index, separator) -- interpret the value as a list of items separated by `separator`, returning a new list made from the `start_index`th to the `end_index`th item. The first item is number zero. If an index is negative, then it counts from the end of the list. As a special case, an end_index of zero is assumed to be the length of the list. Examples using basic template mode and assuming that the tags column (which is comma-separated) contains \"A, B, C\": {tags:sublist(0,1,\\,)} returns \"A\". {tags:sublist(-1,0,\\,)} returns \"C\". {tags:sublist(0,-1,\\,)} returns \"A, B\"."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:474
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:486
msgid "subitems(val, start_index, end_index) -- This function is used to break apart lists of items such as genres. It interprets the value as a comma-separated list of items, where each item is a period-separated list. Returns a new list made by first finding all the period-separated items, then for each such item extracting the start_index`th to the `end_index`th components, then combining the results back together. The first component in a period-separated list has an index of zero. If an index is negative, then it counts from the end of the list. As a special case, an end_index of zero is assumed to be the length of the list. Example using basic template mode and assuming a #genre value of \"A.B.C\": {#genre:subitems(0,1)} returns \"A\". {#genre:subitems(0,2)} returns \"A.B\". {#genre:subitems(1,0)} returns \"B.C\". Assuming a #genre value of \"A.B.C, D.E.F\", {#genre:subitems(0,1)} returns \"A, D\". {#genre:subitems(0,2)} returns \"A.B, D.E\""
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:511
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:523
msgid "format_date(val, format_string) -- format the value, which must be a date field, using the format_string, returning a string. The formatting codes are: d : the day as number without a leading zero (1 to 31) dd : the day as number with a leading zero (01 to 31) ddd : the abbreviated localized day name (e.g. \"Mon\" to \"Sun\"). dddd : the long localized day name (e.g. \"Monday\" to \"Sunday\"). M : the month as number without a leading zero (1 to 12). MM : the month as number with a leading zero (01 to 12) MMM : the abbreviated localized month name (e.g. \"Jan\" to \"Dec\"). MMMM : the long localized month name (e.g. \"January\" to \"December\"). yy : the year as two digit number (00 to 99). yyyy : the year as four digit number. iso : the date with time and timezone. Must be the only format present"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:539
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:551
msgid "uppercase(val) -- return value of the field in upper case"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:547
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:559
msgid "lowercase(val) -- return value of the field in lower case"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:555
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:567
msgid "titlecase(val) -- return value of the field in title case"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:563
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:575
msgid "capitalize(val) -- return value of the field capitalized"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:571
-msgid "booksize() -- return value of the field capitalized"
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:583
+msgid "booksize() -- return value of the size field"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:584
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:596
+msgid "ondevice() -- return Yes if ondevice is set, otherwise return the empty string"
+msgstr ""
+
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:607
msgid "first_non_empty(value, value, ...) -- returns the first value that is not empty. If all values are empty, then the empty value is returned.You can have as many values as you want."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:600
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:623
msgid "and(value, value, ...) -- returns the string \"1\" if all values are not empty, otherwise returns the empty string. This function works well with test or first_non_empty. You can have as many values as you want."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:616
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:639
msgid "or(value, value, ...) -- returns the string \"1\" if any value is not empty, otherwise returns the empty string. This function works well with test or first_non_empty. You can have as many values as you want."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:632
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:655
msgid "not(value) -- returns the string \"1\" if the value is empty, otherwise returns the empty string. This function works well with test or first_non_empty. You can have as many values as you want."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:648
+#: /home/kovid/work/calibre/src/calibre/utils/formatter_functions.py:671
msgid "merge_lists(list1, list2, separator) -- return a list made by merging the items in list1 and list2, removing duplicate items using a case-insensitive compare. If items differ in case, the one in list1 is used. The items in list1 and list2 are separated by separator, as are the items in the returned list."
msgstr ""
@@ -14663,147 +14812,147 @@ msgstr ""
msgid "Working..."
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:95
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:98
msgid "Brazilian Portuguese"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:96
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:99
msgid "English (UK)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:97
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:100
msgid "Simplified Chinese"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:98
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:101
msgid "Chinese (HK)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:99
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:102
msgid "Traditional Chinese"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:100
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:103
msgid "English"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:101
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:104
msgid "English (Australia)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:102
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:105
msgid "English (New Zealand)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:103
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:106
msgid "English (Canada)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:104
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:107
msgid "English (India)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:105
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:108
msgid "English (Thailand)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:106
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:109
msgid "English (Cyprus)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:107
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:110
msgid "English (Czechoslovakia)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:108
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:111
msgid "English (Pakistan)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:109
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:112
msgid "English (Croatia)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:110
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:113
msgid "English (Indonesia)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:111
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:114
msgid "English (Israel)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:112
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:115
msgid "English (Singapore)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:113
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:116
msgid "English (Yemen)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:114
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:117
msgid "English (Ireland)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:115
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:118
msgid "English (China)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:116
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:119
msgid "Spanish (Paraguay)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:117
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:120
msgid "Spanish (Uruguay)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:118
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:121
msgid "Spanish (Argentina)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:119
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:122
msgid "Spanish (Mexico)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:120
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:123
msgid "Spanish (Cuba)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:121
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:124
msgid "Spanish (Chile)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:122
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:125
msgid "Spanish (Ecuador)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:123
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:126
msgid "Spanish (Honduras)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:124
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:127
msgid "Spanish (Venezuela)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:125
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:128
msgid "Spanish (Bolivia)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:126
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:129
msgid "Spanish (Nicaragua)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:127
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:130
msgid "German (AT)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:128
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:131
msgid "French (BE)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:129
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:132
msgid "Dutch (NL)"
msgstr ""
-#: /home/kovid/work/calibre/src/calibre/utils/localization.py:130
+#: /home/kovid/work/calibre/src/calibre/utils/localization.py:133
msgid "Dutch (BE)"
msgstr ""