From d588060e39753886539e2e2d0337b18b05a1bb27 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Fri, 21 Dec 2012 21:52:13 +0530
Subject: [PATCH 1/8] Use custom icons in the content server as well. Fixes
#1092098 (UserCategory Icons (Whishlist))
---
src/calibre/library/server/browse.py | 30 +++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py
index cd5a7c0ffa..a7789e5035 100644
--- a/src/calibre/library/server/browse.py
+++ b/src/calibre/library/server/browse.py
@@ -11,11 +11,11 @@ from collections import OrderedDict
import cherrypy
-from calibre.constants import filesystem_encoding
-from calibre import isbytestring, force_unicode, fit_image, \
- prepare_string_for_xml
+from calibre.constants import filesystem_encoding, config_dir
+from calibre import (isbytestring, force_unicode, fit_image,
+ prepare_string_for_xml, sanitize_file_name2)
from calibre.utils.filenames import ascii_filename
-from calibre.utils.config import prefs
+from calibre.utils.config import prefs, JSONConfig
from calibre.utils.icu import sort_key
from calibre.utils.magick import Image
from calibre.library.comments import comments_to_html
@@ -242,6 +242,8 @@ class BrowseServer(object):
connect('browse_category_icon', base_href+'/icon/{name}',
self.browse_icon)
+ self.icon_map = JSONConfig('gui').get('tags_browser_category_icons', {})
+
# Templates {{{
def browse_template(self, sort, category=True, initial_search=''):
@@ -321,10 +323,18 @@ class BrowseServer(object):
if not hasattr(self, '__browse_icon_cache__'):
self.__browse_icon_cache__ = {}
if name not in self.__browse_icon_cache__:
- try:
- data = I(name, data=True)
- except:
- raise cherrypy.HTTPError(404, 'no icon named: %r'%name)
+ if name.startswith('_'):
+ name = sanitize_file_name2(name[1:])
+ try:
+ with open(os.path.join(config_dir, 'tb_icons', name), 'rb') as f:
+ data = f.read()
+ except:
+ raise cherrypy.HTTPError(404, 'no icon named: %r'%name)
+ else:
+ try:
+ data = I(name, data=True)
+ except:
+ raise cherrypy.HTTPError(404, 'no icon named: %r'%name)
img = Image()
img.load(data)
width, height = img.size
@@ -359,7 +369,9 @@ class BrowseServer(object):
if meta['is_custom'] and category not in displayed_custom_fields:
continue
# get the icon files
- if category in category_icon_map:
+ if category in self.icon_map:
+ icon = '_'+quote(self.icon_map[category])
+ elif category in category_icon_map:
icon = category_icon_map[category]
elif meta['is_custom']:
icon = category_icon_map['custom:']
From a0adbf150bbbc1289ec383d33b55c856fa504498 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Fri, 21 Dec 2012 21:53:29 +0530
Subject: [PATCH 2/8] ...
---
resources/content_server/browse/browse.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/resources/content_server/browse/browse.css b/resources/content_server/browse/browse.css
index 2c50853ae9..b32c470803 100644
--- a/resources/content_server/browse/browse.css
+++ b/resources/content_server/browse/browse.css
@@ -81,6 +81,7 @@ body {
background-color: #39a9cf;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
+ border-radius: 5px;
text-shadow: #27211b 1px 1px 1px;
-moz-box-shadow: 5px 5px 5px #222;
-webkit-box-shadow: 5px 5px 5px #222;
From ff5dc4b039e6c7b140203ed2b631ff49207dfab8 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sat, 22 Dec 2012 10:04:43 +0530
Subject: [PATCH 3/8] ...
---
src/calibre/ebooks/pdf/render/engine.py | 8 ++++----
src/calibre/ebooks/pdf/render/serialize.py | 5 ++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/calibre/ebooks/pdf/render/engine.py b/src/calibre/ebooks/pdf/render/engine.py
index 047084d9af..47ed68f60b 100644
--- a/src/calibre/ebooks/pdf/render/engine.py
+++ b/src/calibre/ebooks/pdf/render/engine.py
@@ -306,8 +306,8 @@ class PdfEngine(QPaintEngine):
image = pixmap.toImage()
ref = self.add_image(image, pixmap.cacheKey())
if ref is not None:
- self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
- ref)
+ self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
+ -rect.height(), ref)
@store_error
def drawImage(self, rect, image, source_rect, flags=Qt.AutoColor):
@@ -316,8 +316,8 @@ class PdfEngine(QPaintEngine):
image.copy(source_rect))
ref = self.add_image(image, image.cacheKey())
if ref is not None:
- self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
- ref)
+ self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
+ -rect.height(), ref)
def add_image(self, img, cache_key):
if img.isNull(): return
diff --git a/src/calibre/ebooks/pdf/render/serialize.py b/src/calibre/ebooks/pdf/render/serialize.py
index 90e0558fe7..9fe89cfafb 100644
--- a/src/calibre/ebooks/pdf/render/serialize.py
+++ b/src/calibre/ebooks/pdf/render/serialize.py
@@ -423,10 +423,9 @@ class PDFStream(object):
self.objects.commit(r, self.stream)
return r
- def draw_image(self, x, y, w, h, imgref):
+ def draw_image(self, x, y, xscale, yscale, imgref):
name = self.current_page.add_image(imgref)
- sx, sy = w, h
- self.current_page.write('q %g 0 0 %g %g %g cm '%(sx, -sy, x, y+h))
+ self.current_page.write('q %g 0 0 %g %g %g cm '%(xscale, yscale, x, y))
serialize(Name(name), self.current_page)
self.current_page.write_line(' Do Q')
From cb6ecf08eaa18f21b3fe3128e815bb9dc9ba2609 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sat, 22 Dec 2012 16:58:52 +0530
Subject: [PATCH 4/8] ...
---
manual/develop.rst | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/manual/develop.rst b/manual/develop.rst
index b9fba195d3..719c876b33 100644
--- a/manual/develop.rst
+++ b/manual/develop.rst
@@ -49,7 +49,7 @@ All the |app| python code is in the ``calibre`` package. This package contains t
* Metadata reading, writing, and downloading is all in ebooks.metadata
* Conversion happens in a pipeline, for the structure of the pipeline,
see :ref:`conversion-introduction`. The pipeline consists of an input
- plugin, various transforms and an output plugin. The code constructs
+ plugin, various transforms and an output plugin. The that code constructs
and drives the pipeline is in plumber.py. The pipeline works on a
representation of an ebook that is like an unzipped epub, with
manifest, spine, toc, guide, html content, etc. The
@@ -74,10 +74,6 @@ After installing Bazaar, you can get the |app| source code with the command::
On Windows you will need the complete path name, that will be something like :file:`C:\\Program Files\\Bazaar\\bzr.exe`.
-To update a branch to the latest code, use the command::
-
- bzr merge
-
|app| is a very large project with a very long source control history, so the
above can take a while (10mins to an hour depending on your internet speed).
@@ -88,6 +84,11 @@ using::
bzr branch --stacked lp:calibre
+
+To update a branch to the latest code, use the command::
+
+ bzr merge
+
Submitting your changes to be included
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
From 64021ac0ac796d203aaccd41262cc16acbd1be70 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 23 Dec 2012 09:56:16 +0530
Subject: [PATCH 5/8] Fix #1093104 (No device recognition)
---
src/calibre/devices/teclast/driver.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/calibre/devices/teclast/driver.py b/src/calibre/devices/teclast/driver.py
index 192f03cb45..51ec8cc8f4 100644
--- a/src/calibre/devices/teclast/driver.py
+++ b/src/calibre/devices/teclast/driver.py
@@ -19,7 +19,8 @@ class TECLAST_K3(USBMS):
PRODUCT_ID = [0x3203]
BCD = [0x0000, 0x0100]
- VENDOR_NAME = ['TECLAST', 'IMAGIN', 'RK28XX', 'PER3274B', 'BEBOOK']
+ VENDOR_NAME = ['TECLAST', 'IMAGIN', 'RK28XX', 'PER3274B', 'BEBOOK',
+ 'RK2728']
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = ['DIGITAL_PLAYER', 'TL-K5',
'EREADER', 'USB-MSC', 'PER3274B', 'BEBOOK']
From 68bca924572d15e302cd3f38846e4d79901a0766 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 23 Dec 2012 10:34:46 +0530
Subject: [PATCH 6/8] Update Nikkei News
---
recipes/nikkei_news.recipe | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/recipes/nikkei_news.recipe b/recipes/nikkei_news.recipe
index aa351e0a0d..3260b8c168 100644
--- a/recipes/nikkei_news.recipe
+++ b/recipes/nikkei_news.recipe
@@ -13,8 +13,11 @@ class NikkeiNet_paper_subscription(BasicNewsRecipe):
max_articles_per_feed = 30
language = 'ja'
no_stylesheets = True
- cover_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
- masthead_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
+ #cover_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
+ cover_url = 'http://cdn.nikkei.co.jp/parts/ds/images/common/st_nikkei_r1_20101003_1.gif'
+ #masthead_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
+ masthead_url = 'http://cdn.nikkei.co.jp/parts/ds/images/common/st_nikkei_r1_20101003_1.gif'
+ cover_margins = (10, 188, '#ffffff')
remove_tags_before = {'class':"cmn-indent"}
remove_tags = [
@@ -40,8 +43,11 @@ class NikkeiNet_paper_subscription(BasicNewsRecipe):
print "-------------------------open top page-------------------------------------"
br.open('http://www.nikkei.com/')
print "-------------------------open first login form-----------------------------"
- link = br.links(url_regex="www.nikkei.com/etc/accounts/login").next()
- br.follow_link(link)
+ try:
+ url = br.links(url_regex="www.nikkei.com/etc/accounts/login").next().url
+ except StopIteration:
+ url = 'http://www.nikkei.com/etc/accounts/login?dps=3&pageflag=top&url=http%3A%2F%2Fwww.nikkei.com%2F'
+ br.open(url) #br.follow_link(link)
#response = br.response()
#print response.get_data()
print "-------------------------JS redirect(send autoPostForm)--------------------"
From 67cc77eb8a8b91b50fc6775ed13f9636820da145 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 23 Dec 2012 11:29:33 +0530
Subject: [PATCH 7/8] Update The Hindu
---
recipes/hindu.recipe | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/recipes/hindu.recipe b/recipes/hindu.recipe
index cc5305eb77..eb84fc4031 100644
--- a/recipes/hindu.recipe
+++ b/recipes/hindu.recipe
@@ -16,10 +16,14 @@ class TheHindu(BasicNewsRecipe):
keep_only_tags = [dict(id='content')]
remove_tags = [dict(attrs={'class':['article-links', 'breadcr']}),
- dict(id=['email-section', 'right-column', 'printfooter'])]
+ dict(id=['email-section', 'right-column', 'printfooter', 'topover',
+ 'slidebox', 'th_footer'])]
extra_css = '.photo-caption { font-size: smaller }'
+ def preprocess_raw_html(self, raw, url):
+ return raw.replace('', '
').replace('
', '
')
+
def postprocess_html(self, soup, first_fetch):
for t in soup.findAll(['table', 'tr', 'td','center']):
t.name = 'div'
From 955ace268798a377c29f97ebac22ed5cb58a7166 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sun, 23 Dec 2012 14:52:08 +0530
Subject: [PATCH 8/8] ...
---
src/calibre/gui2/dialogs/user_profiles.ui | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/calibre/gui2/dialogs/user_profiles.ui b/src/calibre/gui2/dialogs/user_profiles.ui
index 6493846c2b..1e29477e6c 100644
--- a/src/calibre/gui2/dialogs/user_profiles.ui
+++ b/src/calibre/gui2/dialogs/user_profiles.ui
@@ -227,7 +227,7 @@ p, li { white-space: pre-wrap; }
1
- 365
+ 36500
7