mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix Heuristics preference widget
This commit is contained in:
parent
a5c35c3b93
commit
4b25d9ef0d
BIN
resources/images/heuristics.png
Normal file
BIN
resources/images/heuristics.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
@ -11,9 +11,10 @@ from calibre.gui2.convert import Widget
|
|||||||
|
|
||||||
class HeuristicsWidget(Widget, Ui_Form):
|
class HeuristicsWidget(Widget, Ui_Form):
|
||||||
|
|
||||||
TITLE = _('Heuristic Processing')
|
TITLE = _('Heuristic\nProcessing')
|
||||||
HELP = _('Modify the document text and structure using common patterns.')
|
HELP = _('Modify the document text and structure using common patterns.')
|
||||||
COMMIT_NAME = 'heuristics'
|
COMMIT_NAME = 'heuristics'
|
||||||
|
ICON = I('heuristics.png')
|
||||||
|
|
||||||
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
|
def __init__(self, parent, get_option, get_help, db=None, book_id=None):
|
||||||
Widget.__init__(self, parent,
|
Widget.__init__(self, parent,
|
||||||
@ -46,23 +47,8 @@ class HeuristicsWidget(Widget, Ui_Form):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def enable_heuristics(self, state):
|
def enable_heuristics(self, state):
|
||||||
if state == Qt.Checked:
|
state = state == Qt.Checked
|
||||||
state = True
|
self.heuristic_options.setEnabled(state)
|
||||||
else:
|
|
||||||
state = False
|
|
||||||
self.opt_markup_chapter_headings.setEnabled(state)
|
|
||||||
self.opt_italicize_common_cases.setEnabled(state)
|
|
||||||
self.opt_fix_indents.setEnabled(state)
|
|
||||||
self.opt_delete_blank_paragraphs.setEnabled(state)
|
|
||||||
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)
|
|
||||||
else:
|
|
||||||
self.opt_html_unwrap_factor.setEnabled(False)
|
|
||||||
|
|
||||||
def enable_unwrap(self, state):
|
def enable_unwrap(self, state):
|
||||||
if state == Qt.Checked:
|
if state == Qt.Checked:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>938</width>
|
<width>724</width>
|
||||||
<height>470</height>
|
<height>470</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -15,36 +15,80 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_enable_heuristics">
|
<widget class="QLabel" name="label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Preprocess input file to possibly improve structure detection</string>
|
<string><b>Heuristic processing</b> means that calibre will scan your book for common patterns and fix them. As the name implies, this involves guesswork, which means that it could end up worsening the result of a conversion, if calibre guesses wrong. Therefore, it is disabled by default. Often, if a conversion does not turn out as you expect, turning on heuristics can improve matters.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>15</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="opt_enable_heuristics">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable &heuristic processing</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="heuristic_options">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Heuristic Processing</string>
|
<string>Heuristic Processing</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item row="0" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_unwrap_lines">
|
<widget class="QCheckBox" name="opt_unwrap_lines">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Unwrap lines</string>
|
<string>Unwrap lines</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QLabel" name="huf_label">
|
<widget class="QLabel" name="huf_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Line &un-wrap factor during preprocess:</string>
|
<string>Line &un-wrap factor :</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>opt_html_unwrap_factor</cstring>
|
<cstring>opt_html_unwrap_factor</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item>
|
||||||
<widget class="QDoubleSpinBox" name="opt_html_unwrap_factor">
|
<widget class="QDoubleSpinBox" name="opt_html_unwrap_factor">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string/>
|
||||||
@ -60,7 +104,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -73,56 +117,58 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="4">
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_markup_chapter_headings">
|
<widget class="QCheckBox" name="opt_markup_chapter_headings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Detect and markup unformatted chapter headings and sub headings</string>
|
<string>Detect and markup unformatted chapter headings and sub headings</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="4">
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_renumber_headings">
|
<widget class="QCheckBox" name="opt_renumber_headings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Renumber sequences of <h1> or <h2> tags to prevent splitting</string>
|
<string>Renumber sequences of <h1> or <h2> tags to prevent splitting</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_delete_blank_paragraphs">
|
<widget class="QCheckBox" name="opt_delete_blank_paragraphs">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete blank lines between paragraphs</string>
|
<string>Delete blank lines between paragraphs</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="3">
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_format_scene_breaks">
|
<widget class="QCheckBox" name="opt_format_scene_breaks">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Ensure scene breaks are consistently formatted</string>
|
<string>Ensure scene breaks are consistently formatted</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_dehyphenate">
|
<widget class="QCheckBox" name="opt_dehyphenate">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove unnecessary hyphens</string>
|
<string>Remove unnecessary hyphens</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_italicize_common_cases">
|
<widget class="QCheckBox" name="opt_italicize_common_cases">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Italicize common words and patterns</string>
|
<string>Italicize common words and patterns</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_fix_indents">
|
<widget class="QCheckBox" name="opt_fix_indents">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Replace entity indents with CSS indents</string>
|
<string>Replace entity indents with CSS indents</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0" colspan="2">
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user