Fix #3458 (error when first click on 'Preference')

This commit is contained in:
Kovid Goyal 2009-09-11 19:45:37 -06:00
parent 7f09917600
commit 3cb06a21c2
3 changed files with 10 additions and 4 deletions

View File

@ -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(

View File

@ -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.')),
])

View File

@ -5,7 +5,7 @@ __copyright__ = '2009, John Schember <john@nachtimwald.com>'
__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