diff --git a/src/calibre/ebooks/djvu/input.py b/src/calibre/ebooks/djvu/input.py index 0bae302568..6f2f57f377 100644 --- a/src/calibre/ebooks/djvu/input.py +++ b/src/calibre/ebooks/djvu/input.py @@ -18,18 +18,24 @@ class DJVUInput(InputFormatPlugin): author = 'Anthon van der Neut' description = 'Convert OCR-ed DJVU files (.djvu) to HTML' file_types = set(['djvu']) - output_encoding = None + #output_encoding = None - recommendations = set( - # [('page_breaks_before', '/', OptionRecommendation.MED)] - ) + options = set([ + OptionRecommendation(name='use_djvutxt', recommended_value=True, + help=_('try to use the djvutxt program and fall back to pure python implementation if it fails or is not available')), + ]) + + #recommendations = set( + # [('try djvutxt', '/', OptionRecommendation.MED)] + #) def convert(self, stream, options, file_ext, log, accelerators): stdout = StringIO() ppdjvu = True + log.debug('options: %d' % (options.use_djvutxt)) # using djvutxt is MUCH faster, should make it an option - if False and os.path.exists('/usr/bin/djvutxt'): + if options.use_djvutxt and os.path.exists('/usr/bin/djvutxt'): from calibre.ptempfile import PersistentTemporaryFile try: fp = PersistentTemporaryFile(suffix='.djvu', prefix='calibre') diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index bdcf9ede05..98ddd37250 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -56,6 +56,7 @@ class Widget(QWidget): self._icon = QIcon(self.ICON) for name in self._options: if not hasattr(self, 'opt_'+name): + print dir(self) raise Exception('Option %s missing in %s'%(name, self.__class__.__name__)) self.connect_gui_obj(getattr(self, 'opt_'+name)) diff --git a/src/calibre/gui2/convert/djvu_input.py b/src/calibre/gui2/convert/djvu_input.py new file mode 100644 index 0000000000..c5e148e894 --- /dev/null +++ b/src/calibre/gui2/convert/djvu_input.py @@ -0,0 +1,22 @@ +# coding: utf-8 + +__license__ = 'GPL v3' +__copyright__ = '2011, Anthon van der Neut ' + + +from calibre.gui2.convert.djvu_input_ui import Ui_Form +from calibre.gui2.convert import Widget, QDoubleSpinBox + +class PluginWidget(Widget, Ui_Form): + + TITLE = _('DJVU Input') + HELP = _('Options specific to')+' DJVU '+_('input') + COMMIT_NAME = 'djvu_input' + ICON = I('mimetypes/djvu.png') + + def __init__(self, parent, get_option, get_help, db=None, book_id=None): + Widget.__init__(self, parent, + ['use_djvutxt', ]) + self.db, self.book_id = db, book_id + self.initialize_options(get_option, get_help, db, book_id) + diff --git a/src/calibre/gui2/convert/djvu_input.ui b/src/calibre/gui2/convert/djvu_input.ui new file mode 100644 index 0000000000..94d5851d4f --- /dev/null +++ b/src/calibre/gui2/convert/djvu_input.ui @@ -0,0 +1,28 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Use &djvutxt + + + + + + + +