From eb98c55bb7302454b9041555ff92a110aaecfa2a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 18 Jan 2011 15:10:14 -0700 Subject: [PATCH] ... --- src/calibre/ebooks/conversion/utils.py | 3 +-- src/calibre/ebooks/txt/input.py | 3 ++- src/calibre/gui2/convert/heuristics.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index 6cdb688dff..aabb1b8bc4 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -102,8 +102,7 @@ class HeuristicProcessor(object): min_lns = tot_ln_fds * percent #self.log.debug("There must be fewer than " + unicode(min_lns) + " unmarked lines to add markup") - if min_lns > tot_htm_ends: - return True + return min_lns > tot_htm_ends def dump(self, raw, where): import os diff --git a/src/calibre/ebooks/txt/input.py b/src/calibre/ebooks/txt/input.py index dd14de2d20..5b99b19e74 100644 --- a/src/calibre/ebooks/txt/input.py +++ b/src/calibre/ebooks/txt/input.py @@ -53,6 +53,7 @@ class TXTInput(InputFormatPlugin): def convert(self, stream, options, file_ext, log, accelerators): + self.log = log log.debug('Reading text from file...') txt = stream.read() @@ -106,7 +107,7 @@ class TXTInput(InputFormatPlugin): log.debug('Auto detected paragraph type as %s' % options.paragraph_type) # Dehyphenate - dehyphenator = Dehyphenator(options.verbose, log=getattr(self, 'log', None)) + dehyphenator = Dehyphenator(options.verbose, log=self.log) txt = dehyphenator(txt,'txt', length) # We don't check for block because the processor assumes block. diff --git a/src/calibre/gui2/convert/heuristics.py b/src/calibre/gui2/convert/heuristics.py index 6739c199b7..0655d7400f 100644 --- a/src/calibre/gui2/convert/heuristics.py +++ b/src/calibre/gui2/convert/heuristics.py @@ -25,21 +25,21 @@ class HeuristicsWidget(Widget, Ui_Form): ) self.db, self.book_id = db, book_id self.initialize_options(get_option, get_help, db, book_id) - + self.opt_enable_heuristics.stateChanged.connect(self.enable_heuristics) self.opt_unwrap_lines.stateChanged.connect(self.enable_unwrap) - + self.enable_heuristics(self.opt_enable_heuristics.checkState()) def break_cycles(self): Widget.break_cycles(self) - + try: self.opt_enable_heuristics.stateChanged.disconnect() self.opt_unwrap_lines.stateChanged.disconnect() except: pass - + def set_value_handler(self, g, val): if val is None and g is self.opt_html_unwrap_factor: g.setValue(0.0) @@ -57,7 +57,7 @@ class HeuristicsWidget(Widget, Ui_Form): self.opt_format_scene_breaks.setEnabled(state) self.opt_dehyphenate.setEnabled(state) self.opt_renumber_headings.setEnabled(state) - + self.opt_unwrap_lines.setEnabled(state) if state and self.opt_unwrap_lines.checkState() == Qt.Checked: self.opt_html_unwrap_factor.setEnabled(True)