Fix #755105 (FreeBSD pdftohtml)

This commit is contained in:
Kovid Goyal 2011-04-08 17:51:07 -06:00
parent 86e17cc100
commit 2697f4d0ec
3 changed files with 28 additions and 6 deletions

View File

@ -13,7 +13,7 @@ from functools import partial
from calibre.ebooks import ConversionError, DRMError
from calibre.ptempfile import PersistentTemporaryFile
from calibre import isosx, iswindows, islinux, isfreebsd
from calibre.constants import isosx, iswindows, islinux, isfreebsd
from calibre import CurrentDir
PDFTOHTML = 'pdftohtml'
@ -43,6 +43,8 @@ def pdftohtml(output_dir, pdf_path, no_images):
# This is neccessary as pdftohtml doesn't always (linux) respect absolute paths
pdf_path = os.path.abspath(pdf_path)
cmd = [PDFTOHTML, '-enc', 'UTF-8', '-noframes', '-p', '-nomerge', '-nodrm', '-q', pdf_path, os.path.basename(index)]
if isfreebsd:
cmd.remove('-nodrm')
if no_images:
cmd.append('-i')

View File

@ -238,7 +238,7 @@ class Spacer(QWidget): # {{{
self.l.addStretch(10)
# }}}
class MenuAction(QAction):
class MenuAction(QAction): # {{{
def __init__(self, clone, parent):
QAction.__init__(self, clone.text(), parent)
@ -247,7 +247,7 @@ class MenuAction(QAction):
def clone_changed(self):
self.setText(self.clone.text())
# }}}
class MenuBar(QMenuBar): # {{{

View File

@ -398,12 +398,24 @@ class IdentifyWidget(QWidget): # {{{
self.abort.set()
# }}}
class FullFetch(QDialog): # {{{
class CoverWidget(QWidget): # {{{
def __init__(self, log, parent=None):
QDialog.__init__(self, parent)
QWidget.__init__(self, parent)
self.log = log
def start(self, book, current_cover, title, authors):
self.book, self.current_cover = book, current_cover
self.title, self.authors = title, authors
self.log('\n\nStarting cover download for:', book.title)
# }}}
class FullFetch(QDialog): # {{{
def __init__(self, log, current_cover=None, parent=None):
QDialog.__init__(self, parent)
self.log, self.current_cover = log, current_cover
self.setWindowTitle(_('Downloading metadata...'))
self.setWindowIcon(QIcon(I('metadata.png')))
@ -428,12 +440,19 @@ class FullFetch(QDialog): # {{{
self.identify_widget.results_found.connect(self.identify_results_found)
self.identify_widget.book_selected.connect(self.book_selected)
self.stack.addWidget(self.identify_widget)
self.cover_widget = CoverWidget(self.log, parent=self)
self.stack.addWidget(self.cover_widget)
self.resize(850, 500)
def book_selected(self, book):
print (book)
self.next_button.setVisible(False)
self.ok_button.setVisible(True)
self.book = book
self.stack.setCurrentIndex(1)
self.cover_widget.start(book, self.current_cover,
self.title, self.authors)
def accept(self):
# Prevent the usual dialog accept mechanisms from working
@ -453,6 +472,7 @@ class FullFetch(QDialog): # {{{
pass
def start(self, title=None, authors=None, identifiers={}):
self.title, self.authors = title, authors
self.identify_widget.start(title=title, authors=authors,
identifiers=identifiers)
self.exec_()