diff --git a/src/calibre/ebooks/conversion/preprocess.py b/src/calibre/ebooks/conversion/preprocess.py index 1aae939a06..33205ce4b2 100644 --- a/src/calibre/ebooks/conversion/preprocess.py +++ b/src/calibre/ebooks/conversion/preprocess.py @@ -238,7 +238,7 @@ class HTMLPreProcessor(object): ) end_rules = [] - if getattr(self.extra_opts, 'unwrap_factor', None): + if getattr(self.extra_opts, 'unwrap_factor', 0.0) > 0.01: length = line_length(html, getattr(self.extra_opts, 'unwrap_factor')) if length: end_rules.append( diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py index 008a7d104b..cf9b087295 100644 --- a/src/calibre/ebooks/html/input.py +++ b/src/calibre/ebooks/html/input.py @@ -262,9 +262,10 @@ class HTMLInput(InputFormatPlugin): ) ), - OptionRecommendation(name='unwrap_factor', recommended_value=None, + OptionRecommendation(name='unwrap_factor', recommended_value=0.0, help=_('Average line length for line breaking if the HTML is from a ' - 'previous partial conversion of a PDF file. Default is %default.')), + 'previous partial conversion of a PDF file. Default is %default ' + 'which disables this.')), ]) diff --git a/src/calibre/gui2/convert/pdf_input.py b/src/calibre/gui2/convert/pdf_input.py index e4a9541823..a8cacaa5d9 100644 --- a/src/calibre/gui2/convert/pdf_input.py +++ b/src/calibre/gui2/convert/pdf_input.py @@ -5,7 +5,7 @@ __copyright__ = '2009, John Schember ' __docformat__ = 'restructuredtext en' from calibre.gui2.convert.pdf_input_ui import Ui_Form -from calibre.gui2.convert import Widget +from calibre.gui2.convert import Widget, QDoubleSpinBox class PluginWidget(Widget, Ui_Form): @@ -17,3 +17,8 @@ class PluginWidget(Widget, Ui_Form): ['no_images', 'unwrap_factor']) self.db, self.book_id = db, book_id self.initialize_options(get_option, get_help, db, book_id) + + def set_value_handler(self, g, val): + if val is None and isinstance(g, QDoubleSpinBox): + g.setValue(0.0) + return True