mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge changes from lp:~cbhaley/calibre/charles_store.
This commit is contained in:
commit
65365b4ca0
@ -7,7 +7,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import sys, traceback
|
||||
import sys, traceback, math
|
||||
from collections import namedtuple
|
||||
from functools import wraps, partial
|
||||
from future_builtins import map
|
||||
@ -355,11 +355,11 @@ class PdfDevice(QPaintDevice): # {{{
|
||||
|
||||
@property
|
||||
def full_page_rect(self):
|
||||
page_width = self.page_width * self.xdpi / 72.0
|
||||
lm = self.left_margin * self.xdpi / 72.0
|
||||
page_height = self.page_height * self.ydpi / 72.0
|
||||
tm = self.top_margin * self.ydpi / 72.0
|
||||
return (-lm, -tm, page_width, page_height)
|
||||
page_width = int(math.ceil(self.page_width * self.xdpi / 72.0))
|
||||
lm = int(math.ceil(self.left_margin * self.xdpi / 72.0))
|
||||
page_height = int(math.ceil(self.page_height * self.ydpi / 72.0))
|
||||
tm = int(math.ceil(self.top_margin * self.ydpi / 72.0))
|
||||
return (-lm, -tm, page_width+1, page_height+1)
|
||||
|
||||
@property
|
||||
def current_page_num(self):
|
||||
|
@ -302,6 +302,10 @@ class PDFWriter(QObject):
|
||||
py_bridge.value = book_indexing.all_links_and_anchors();
|
||||
'''%(self.margin_top, 0, self.margin_bottom))
|
||||
|
||||
amap = self.bridge_value
|
||||
if not isinstance(amap, dict):
|
||||
amap = {'links':[], 'anchors':{}} # Some javascript error occurred
|
||||
|
||||
if self.header:
|
||||
self.bridge_value = self.header
|
||||
evaljs('paged_display.header_template = py_bridge.value')
|
||||
@ -311,9 +315,6 @@ class PDFWriter(QObject):
|
||||
if self.header or self.footer:
|
||||
evaljs('paged_display.create_header_footer();')
|
||||
|
||||
amap = self.bridge_value
|
||||
if not isinstance(amap, dict):
|
||||
amap = {'links':[], 'anchors':{}} # Some javascript error occurred
|
||||
start_page = self.current_page_num
|
||||
|
||||
mf = self.view.page().mainFrame()
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 1 # Needed for dynamic plugin loading
|
||||
store_version = 2 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
@ -46,12 +46,18 @@ class AmazonEUBase(StorePlugin):
|
||||
doc = html.fromstring(f.read())#.decode('latin-1', 'replace'))
|
||||
|
||||
data_xpath = '//div[contains(@class, "prod")]'
|
||||
format_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
format_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()')
|
||||
asin_xpath = '@name'
|
||||
cover_xpath = './/img[@class="productImage"]/@src'
|
||||
title_xpath = './/h3[@class="newaps"]/a//text()'
|
||||
author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()'
|
||||
price_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and contains(@class, "bld")]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
price_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and contains(@class, "bld")]/text()')
|
||||
|
||||
for data in doc.xpath(data_xpath):
|
||||
if counter <= 0:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 1 # Needed for dynamic plugin loading
|
||||
store_version = 2 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
@ -45,12 +45,18 @@ class AmazonEUBase(StorePlugin):
|
||||
doc = html.fromstring(f.read())#.decode('latin-1', 'replace'))
|
||||
|
||||
data_xpath = '//div[contains(@class, "prod")]'
|
||||
format_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
format_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()')
|
||||
asin_xpath = '@name'
|
||||
cover_xpath = './/img[@class="productImage"]/@src'
|
||||
title_xpath = './/h3[@class="newaps"]/a//text()'
|
||||
author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()'
|
||||
price_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and contains(@class, "bld")]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
price_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and contains(@class, "bld")]/text()')
|
||||
|
||||
for data in doc.xpath(data_xpath):
|
||||
if counter <= 0:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 1 # Needed for dynamic plugin loading
|
||||
store_version = 2 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
@ -46,12 +46,18 @@ class AmazonEUBase(StorePlugin):
|
||||
doc = html.fromstring(f.read())#.decode('latin-1', 'replace'))
|
||||
|
||||
data_xpath = '//div[contains(@class, "prod")]'
|
||||
format_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
format_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()')
|
||||
asin_xpath = '@name'
|
||||
cover_xpath = './/img[@class="productImage"]/@src'
|
||||
title_xpath = './/h3[@class="newaps"]/a//text()'
|
||||
author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()'
|
||||
price_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and contains(@class, "bld")]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
price_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and contains(@class, "bld")]/text()')
|
||||
|
||||
for data in doc.xpath(data_xpath):
|
||||
if counter <= 0:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 1 # Needed for dynamic plugin loading
|
||||
store_version = 2 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
@ -45,12 +45,18 @@ class AmazonEUBase(StorePlugin):
|
||||
doc = html.fromstring(f.read())#.decode('latin-1', 'replace'))
|
||||
|
||||
data_xpath = '//div[contains(@class, "prod")]'
|
||||
format_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
format_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()')
|
||||
asin_xpath = '@name'
|
||||
cover_xpath = './/img[@class="productImage"]/@src'
|
||||
title_xpath = './/h3[@class="newaps"]/a//text()'
|
||||
author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()'
|
||||
price_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and contains(@class, "bld")]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
price_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and contains(@class, "bld")]/text()')
|
||||
|
||||
for data in doc.xpath(data_xpath):
|
||||
if counter <= 0:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||
store_version = 1 # Needed for dynamic plugin loading
|
||||
store_version = 2 # Needed for dynamic plugin loading
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
@ -45,12 +45,18 @@ class AmazonEUBase(StorePlugin):
|
||||
doc = html.fromstring(f.read())#.decode('latin-1', 'replace'))
|
||||
|
||||
data_xpath = '//div[contains(@class, "prod")]'
|
||||
format_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
format_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and not(contains(@class, "bld"))]/text()')
|
||||
asin_xpath = '@name'
|
||||
cover_xpath = './/img[@class="productImage"]/@src'
|
||||
title_xpath = './/h3[@class="newaps"]/a//text()'
|
||||
author_xpath = './/h3[@class="newaps"]//span[contains(@class, "reg")]//text()'
|
||||
price_xpath = './/ul[contains(@class, "rsltL")]//span[contains(@class, "lrg") and contains(@class, "bld")]/text()'
|
||||
# Results can be in a grid (table) or a column
|
||||
price_xpath = (
|
||||
'.//ul[contains(@class, "rsltL") or contains(@class, "rsltGridList")]'
|
||||
'//span[contains(@class, "lrg") and contains(@class, "bld")]/text()')
|
||||
|
||||
for data in doc.xpath(data_xpath):
|
||||
if counter <= 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user