Add Output Encoding option (present on command line) to GUI for TXT, PDB and PMLZ Output formats.

This commit is contained in:
John Schember 2010-12-29 20:25:15 -05:00
parent 24a4261378
commit c54b2f6776
8 changed files with 48 additions and 17 deletions

View File

@ -29,8 +29,7 @@ class TXTOutput(OutputFormatPlugin):
OptionRecommendation(name='output_encoding', recommended_value='utf-8', OptionRecommendation(name='output_encoding', recommended_value='utf-8',
level=OptionRecommendation.LOW, level=OptionRecommendation.LOW,
help=_('Specify the character encoding of the output document. ' \ help=_('Specify the character encoding of the output document. ' \
'The default is utf-8. Note: This option is not honored by all ' \ 'The default is utf-8.')),
'formats.')),
OptionRecommendation(name='inline_toc', OptionRecommendation(name='inline_toc',
recommended_value=False, level=OptionRecommendation.LOW, recommended_value=False, level=OptionRecommendation.LOW,
help=_('Add Table of Contents to beginning of the book.')), help=_('Add Table of Contents to beginning of the book.')),

View File

@ -19,7 +19,7 @@ class PluginWidget(Widget, Ui_Form):
ICON = I('mimetypes/unknown.png') ICON = I('mimetypes/unknown.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, ['format', 'inline_toc']) Widget.__init__(self, parent, ['format', 'inline_toc', 'output_encoding'])
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)

View File

@ -27,7 +27,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="opt_format"/> <widget class="QComboBox" name="opt_format"/>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -40,13 +40,23 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="opt_inline_toc"> <widget class="QCheckBox" name="opt_inline_toc">
<property name="text"> <property name="text">
<string>&amp;Inline TOC</string> <string>&amp;Inline TOC</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Output Encoding:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="opt_output_encoding"/>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -17,6 +17,7 @@ class PluginWidget(Widget, Ui_Form):
ICON = I('mimetypes/unknown.png') ICON = I('mimetypes/unknown.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, ['inline_toc', 'full_image_depth']) Widget.__init__(self, parent, ['inline_toc', 'full_image_depth',
'output_encoding'])
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)

View File

@ -14,7 +14,7 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="0"> <item row="3" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -27,20 +27,30 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="opt_inline_toc"> <widget class="QCheckBox" name="opt_inline_toc">
<property name="text"> <property name="text">
<string>&amp;Inline TOC</string> <string>&amp;Inline TOC</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="opt_full_image_depth"> <widget class="QCheckBox" name="opt_full_image_depth">
<property name="text"> <property name="text">
<string>Do not reduce image size and depth</string> <string>Do not reduce image size and depth</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Output Encoding:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="opt_output_encoding"/>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -21,7 +21,8 @@ class PluginWidget(Widget, Ui_Form):
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,
['newline', 'max_line_length', 'force_max_line_length', ['newline', 'max_line_length', 'force_max_line_length',
'inline_toc', 'markdown_format', 'keep_links', 'keep_image_references']) 'inline_toc', 'markdown_format', 'keep_links', 'keep_image_references',
'output_encoding'])
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)

View File

@ -27,7 +27,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="opt_newline"/> <widget class="QComboBox" name="opt_newline"/>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -40,7 +40,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="opt_inline_toc"> <widget class="QCheckBox" name="opt_inline_toc">
<property name="text"> <property name="text">
<string>&amp;Inline TOC</string> <string>&amp;Inline TOC</string>
@ -60,34 +60,44 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="opt_force_max_line_length"> <widget class="QCheckBox" name="opt_force_max_line_length">
<property name="text"> <property name="text">
<string>Force maximum line length</string> <string>Force maximum line length</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QCheckBox" name="opt_markdown_format"> <widget class="QCheckBox" name="opt_markdown_format">
<property name="text"> <property name="text">
<string>Apply Markdown formatting to text</string> <string>Apply Markdown formatting to text</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QCheckBox" name="opt_keep_links"> <widget class="QCheckBox" name="opt_keep_links">
<property name="text"> <property name="text">
<string>Do not remove links (&lt;a&gt; tags) before processing</string> <string>Do not remove links (&lt;a&gt; tags) before processing</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="7" column="0">
<widget class="QCheckBox" name="opt_keep_image_references"> <widget class="QCheckBox" name="opt_keep_image_references">
<property name="text"> <property name="text">
<string>Do not remove image references before processing</string> <string>Do not remove image references before processing</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Output Encoding:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="opt_output_encoding"/>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>