Merge from trunk

This commit is contained in:
Charles Haley 2012-12-23 11:20:09 +01:00
commit e412f0bc81
9 changed files with 52 additions and 28 deletions

View File

@ -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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -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('<body><p>', '<p>').replace('</p></body>', '</p>')
def postprocess_html(self, soup, first_fetch):
for t in soup.findAll(['table', 'tr', 'td','center']):
t.name = 'div'

View File

@ -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)--------------------"

View File

@ -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;

View File

@ -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']

View File

@ -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

View File

@ -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')

View File

@ -227,7 +227,7 @@ p, li { white-space: pre-wrap; }
<number>1</number>
</property>
<property name="maximum">
<number>365</number>
<number>36500</number>
</property>
<property name="value">
<number>7</number>

View File

@ -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:']