mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
...
This commit is contained in:
parent
37ee06549e
commit
eb98c55bb7
@ -102,8 +102,7 @@ class HeuristicProcessor(object):
|
|||||||
|
|
||||||
min_lns = tot_ln_fds * percent
|
min_lns = tot_ln_fds * percent
|
||||||
#self.log.debug("There must be fewer than " + unicode(min_lns) + " unmarked lines to add markup")
|
#self.log.debug("There must be fewer than " + unicode(min_lns) + " unmarked lines to add markup")
|
||||||
if min_lns > tot_htm_ends:
|
return min_lns > tot_htm_ends
|
||||||
return True
|
|
||||||
|
|
||||||
def dump(self, raw, where):
|
def dump(self, raw, where):
|
||||||
import os
|
import os
|
||||||
|
@ -53,6 +53,7 @@ class TXTInput(InputFormatPlugin):
|
|||||||
|
|
||||||
def convert(self, stream, options, file_ext, log,
|
def convert(self, stream, options, file_ext, log,
|
||||||
accelerators):
|
accelerators):
|
||||||
|
self.log = log
|
||||||
log.debug('Reading text from file...')
|
log.debug('Reading text from file...')
|
||||||
|
|
||||||
txt = stream.read()
|
txt = stream.read()
|
||||||
@ -106,7 +107,7 @@ class TXTInput(InputFormatPlugin):
|
|||||||
log.debug('Auto detected paragraph type as %s' % options.paragraph_type)
|
log.debug('Auto detected paragraph type as %s' % options.paragraph_type)
|
||||||
|
|
||||||
# Dehyphenate
|
# Dehyphenate
|
||||||
dehyphenator = Dehyphenator(options.verbose, log=getattr(self, 'log', None))
|
dehyphenator = Dehyphenator(options.verbose, log=self.log)
|
||||||
txt = dehyphenator(txt,'txt', length)
|
txt = dehyphenator(txt,'txt', length)
|
||||||
|
|
||||||
# We don't check for block because the processor assumes block.
|
# We don't check for block because the processor assumes block.
|
||||||
|
@ -25,21 +25,21 @@ class HeuristicsWidget(Widget, Ui_Form):
|
|||||||
)
|
)
|
||||||
self.db, self.book_id = db, book_id
|
self.db, self.book_id = db, book_id
|
||||||
self.initialize_options(get_option, get_help, db, book_id)
|
self.initialize_options(get_option, get_help, db, book_id)
|
||||||
|
|
||||||
self.opt_enable_heuristics.stateChanged.connect(self.enable_heuristics)
|
self.opt_enable_heuristics.stateChanged.connect(self.enable_heuristics)
|
||||||
self.opt_unwrap_lines.stateChanged.connect(self.enable_unwrap)
|
self.opt_unwrap_lines.stateChanged.connect(self.enable_unwrap)
|
||||||
|
|
||||||
self.enable_heuristics(self.opt_enable_heuristics.checkState())
|
self.enable_heuristics(self.opt_enable_heuristics.checkState())
|
||||||
|
|
||||||
def break_cycles(self):
|
def break_cycles(self):
|
||||||
Widget.break_cycles(self)
|
Widget.break_cycles(self)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.opt_enable_heuristics.stateChanged.disconnect()
|
self.opt_enable_heuristics.stateChanged.disconnect()
|
||||||
self.opt_unwrap_lines.stateChanged.disconnect()
|
self.opt_unwrap_lines.stateChanged.disconnect()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_value_handler(self, g, val):
|
def set_value_handler(self, g, val):
|
||||||
if val is None and g is self.opt_html_unwrap_factor:
|
if val is None and g is self.opt_html_unwrap_factor:
|
||||||
g.setValue(0.0)
|
g.setValue(0.0)
|
||||||
@ -57,7 +57,7 @@ class HeuristicsWidget(Widget, Ui_Form):
|
|||||||
self.opt_format_scene_breaks.setEnabled(state)
|
self.opt_format_scene_breaks.setEnabled(state)
|
||||||
self.opt_dehyphenate.setEnabled(state)
|
self.opt_dehyphenate.setEnabled(state)
|
||||||
self.opt_renumber_headings.setEnabled(state)
|
self.opt_renumber_headings.setEnabled(state)
|
||||||
|
|
||||||
self.opt_unwrap_lines.setEnabled(state)
|
self.opt_unwrap_lines.setEnabled(state)
|
||||||
if state and self.opt_unwrap_lines.checkState() == Qt.Checked:
|
if state and self.opt_unwrap_lines.checkState() == Qt.Checked:
|
||||||
self.opt_html_unwrap_factor.setEnabled(True)
|
self.opt_html_unwrap_factor.setEnabled(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user