mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #755105 (FreeBSD pdftohtml)
This commit is contained in:
parent
86e17cc100
commit
2697f4d0ec
@ -13,7 +13,7 @@ from functools import partial
|
|||||||
|
|
||||||
from calibre.ebooks import ConversionError, DRMError
|
from calibre.ebooks import ConversionError, DRMError
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
from calibre import isosx, iswindows, islinux, isfreebsd
|
from calibre.constants import isosx, iswindows, islinux, isfreebsd
|
||||||
from calibre import CurrentDir
|
from calibre import CurrentDir
|
||||||
|
|
||||||
PDFTOHTML = 'pdftohtml'
|
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
|
# This is neccessary as pdftohtml doesn't always (linux) respect absolute paths
|
||||||
pdf_path = os.path.abspath(pdf_path)
|
pdf_path = os.path.abspath(pdf_path)
|
||||||
cmd = [PDFTOHTML, '-enc', 'UTF-8', '-noframes', '-p', '-nomerge', '-nodrm', '-q', pdf_path, os.path.basename(index)]
|
cmd = [PDFTOHTML, '-enc', 'UTF-8', '-noframes', '-p', '-nomerge', '-nodrm', '-q', pdf_path, os.path.basename(index)]
|
||||||
|
if isfreebsd:
|
||||||
|
cmd.remove('-nodrm')
|
||||||
if no_images:
|
if no_images:
|
||||||
cmd.append('-i')
|
cmd.append('-i')
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ class Spacer(QWidget): # {{{
|
|||||||
self.l.addStretch(10)
|
self.l.addStretch(10)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class MenuAction(QAction):
|
class MenuAction(QAction): # {{{
|
||||||
|
|
||||||
def __init__(self, clone, parent):
|
def __init__(self, clone, parent):
|
||||||
QAction.__init__(self, clone.text(), parent)
|
QAction.__init__(self, clone.text(), parent)
|
||||||
@ -247,7 +247,7 @@ class MenuAction(QAction):
|
|||||||
|
|
||||||
def clone_changed(self):
|
def clone_changed(self):
|
||||||
self.setText(self.clone.text())
|
self.setText(self.clone.text())
|
||||||
|
# }}}
|
||||||
|
|
||||||
class MenuBar(QMenuBar): # {{{
|
class MenuBar(QMenuBar): # {{{
|
||||||
|
|
||||||
|
@ -398,12 +398,24 @@ class IdentifyWidget(QWidget): # {{{
|
|||||||
self.abort.set()
|
self.abort.set()
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class FullFetch(QDialog): # {{{
|
class CoverWidget(QWidget): # {{{
|
||||||
|
|
||||||
def __init__(self, log, parent=None):
|
def __init__(self, log, parent=None):
|
||||||
QDialog.__init__(self, parent)
|
QWidget.__init__(self, parent)
|
||||||
self.log = log
|
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.setWindowTitle(_('Downloading metadata...'))
|
||||||
self.setWindowIcon(QIcon(I('metadata.png')))
|
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.results_found.connect(self.identify_results_found)
|
||||||
self.identify_widget.book_selected.connect(self.book_selected)
|
self.identify_widget.book_selected.connect(self.book_selected)
|
||||||
self.stack.addWidget(self.identify_widget)
|
self.stack.addWidget(self.identify_widget)
|
||||||
|
|
||||||
|
self.cover_widget = CoverWidget(self.log, parent=self)
|
||||||
|
self.stack.addWidget(self.cover_widget)
|
||||||
|
|
||||||
self.resize(850, 500)
|
self.resize(850, 500)
|
||||||
|
|
||||||
def book_selected(self, book):
|
def book_selected(self, book):
|
||||||
print (book)
|
|
||||||
self.next_button.setVisible(False)
|
self.next_button.setVisible(False)
|
||||||
self.ok_button.setVisible(True)
|
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):
|
def accept(self):
|
||||||
# Prevent the usual dialog accept mechanisms from working
|
# Prevent the usual dialog accept mechanisms from working
|
||||||
@ -453,6 +472,7 @@ class FullFetch(QDialog): # {{{
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def start(self, title=None, authors=None, identifiers={}):
|
def start(self, title=None, authors=None, identifiers={}):
|
||||||
|
self.title, self.authors = title, authors
|
||||||
self.identify_widget.start(title=title, authors=authors,
|
self.identify_widget.start(title=title, authors=authors,
|
||||||
identifiers=identifiers)
|
identifiers=identifiers)
|
||||||
self.exec_()
|
self.exec_()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user