mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Commit one local change and several merged from cloud
This commit is contained in:
commit
1ed17a1793
@ -8,6 +8,7 @@ __builtin__.__dict__['dynamic_property'] = lambda func: func(None)
|
||||
from math import floor
|
||||
from functools import partial
|
||||
|
||||
print ("Hello, world!")
|
||||
warnings.simplefilter('ignore', DeprecationWarning)
|
||||
try:
|
||||
os.getcwdu()
|
||||
|
@ -57,6 +57,14 @@ class TOLINO(EB600):
|
||||
FORMATS = ['epub', 'pdf', 'txt']
|
||||
BCD = [0x226]
|
||||
|
||||
def linux_swap_drives(self, drives):
|
||||
if len(drives) < 2 or not drives[1] or not drives[2]: return drives
|
||||
drives = list(drives)
|
||||
t = drives[0]
|
||||
drives[0] = drives[1]
|
||||
drives[1] = t
|
||||
return tuple(drives)
|
||||
|
||||
class COOL_ER(EB600):
|
||||
|
||||
name = 'Cool-er device interface'
|
||||
|
@ -446,6 +446,7 @@ class WAYTEQ(USBMS):
|
||||
return drives
|
||||
|
||||
def linux_swap_drives(self, drives):
|
||||
# See https://bugs.launchpad.net/bugs/1151901
|
||||
if len(drives) < 2 or not drives[1] or not drives[2]: return drives
|
||||
drives = list(drives)
|
||||
t = drives[0]
|
||||
|
@ -242,7 +242,6 @@ class FlowSplitter(object):
|
||||
self.trees[i:i+1] = [before_tree, after_tree]
|
||||
break
|
||||
|
||||
self.trees.append(tree)
|
||||
trees, ids = [], set([])
|
||||
for tree in self.trees:
|
||||
root = tree.getroot()
|
||||
|
@ -315,6 +315,8 @@ class PdfDevice(QPaintDevice): # {{{
|
||||
self.page_width, self.page_height = page_size
|
||||
self.body_width = self.page_width - left_margin - right_margin
|
||||
self.body_height = self.page_height - top_margin - bottom_margin
|
||||
self.left_margin, self.right_margin = left_margin, right_margin
|
||||
self.top_margin, self.bottom_margin = top_margin, bottom_margin
|
||||
self.engine = PdfEngine(file_object, self.page_width, self.page_height,
|
||||
left_margin, top_margin, right_margin,
|
||||
bottom_margin, self.width(), self.height(),
|
||||
@ -351,6 +353,14 @@ class PdfDevice(QPaintDevice): # {{{
|
||||
def init_page(self):
|
||||
self.engine.init_page()
|
||||
|
||||
@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)
|
||||
|
||||
@property
|
||||
def current_page_num(self):
|
||||
return self.engine.current_page_num
|
||||
|
@ -106,7 +106,7 @@ def draw_image_page(page_rect, painter, p, preserve_aspect_ratio=True):
|
||||
page_rect.height())
|
||||
dx = int((page_rect.width() - nnw)/2.)
|
||||
dy = int((page_rect.height() - nnh)/2.)
|
||||
page_rect.moveTo(dx, dy)
|
||||
page_rect.translate(dx, dy)
|
||||
page_rect.setHeight(nnh)
|
||||
page_rect.setWidth(nnw)
|
||||
painter.drawPixmap(page_rect, p, p.rect())
|
||||
@ -192,7 +192,7 @@ class PDFWriter(QObject):
|
||||
p.loadFromData(self.cover_data)
|
||||
if not p.isNull():
|
||||
self.doc.init_page()
|
||||
draw_image_page(QRect(0, 0, self.doc.width(), self.doc.height()),
|
||||
draw_image_page(QRect(*self.doc.full_page_rect),
|
||||
self.painter, p,
|
||||
preserve_aspect_ratio=self.opts.preserve_cover_aspect_ratio)
|
||||
self.doc.end_page()
|
||||
|
@ -166,7 +166,7 @@ class ZshCompleter(object): # {{{
|
||||
exclude = u"'(- *)'"
|
||||
h = opt.help or ''
|
||||
h = h.replace('"', "'").replace('[', '(').replace(
|
||||
']', ')').replace('\n', ' ').replace(':', '\\:')
|
||||
']', ')').replace('\n', ' ').replace(':', '\\:').replace('`', "'")
|
||||
h = h.replace('%default', type(u'')(opt.default))
|
||||
arg = ''
|
||||
if opt.takes_value():
|
||||
|
Loading…
x
Reference in New Issue
Block a user