Adjust options for SNB output. Fixed a but which doesn't allow to disable indent on command line. Added a new option to enable full screnn

This commit is contained in:
Li Fanxi 2010-11-21 20:58:02 +08:00
parent ca81072e72
commit c33593c43b
4 changed files with 23 additions and 10 deletions

View File

@ -35,14 +35,17 @@ class SNBOutput(OutputFormatPlugin):
recommended_value=False, level=OptionRecommendation.LOW, recommended_value=False, level=OptionRecommendation.LOW,
help=_('Specify whether or not to insert an empty line between ' help=_('Specify whether or not to insert an empty line between '
'two paragraphs.')), 'two paragraphs.')),
OptionRecommendation(name='snb_indent_first_line', OptionRecommendation(name='snb_dont_indent_first_line',
recommended_value=True, level=OptionRecommendation.LOW, recommended_value=False, level=OptionRecommendation.LOW,
help=_('Specify whether or not to insert two space characters ' help=_('Specify whether or not to insert two space characters '
'to indent the first line of each paragraph.')), 'to indent the first line of each paragraph.')),
OptionRecommendation(name='snb_hide_chapter_name', OptionRecommendation(name='snb_hide_chapter_name',
recommended_value=False, level=OptionRecommendation.LOW, recommended_value=False, level=OptionRecommendation.LOW,
help=_('Specify whether or not to hide the chapter title for each ' help=_('Specify whether or not to hide the chapter title for each '
'chapter. Useful for image-only output (eg. comics).')), 'chapter. Useful for image-only output (eg. comics).')),
OptionRecommendation(name='snb_full_screen',
recommended_value=False, level=OptionRecommendation.LOW,
help=_('Resize all the images for full screen view. ')),
]) ])
def convert(self, oeb_book, output_path, input_plugin, opts, log): def convert(self, oeb_book, output_path, input_plugin, opts, log):
@ -228,7 +231,10 @@ class SNBOutput(OutputFormatPlugin):
img.load(imageData) img.load(imageData)
(x,y) = img.size (x,y) = img.size
if self.opts: if self.opts:
SCREEN_X, SCREEN_Y = self.opts.output_profile.comic_screen_size if self.opts.snb_full_screen:
SCREEN_X, SCREEN_Y = self.opts.output_profile.screen_size
else:
SCREEN_X, SCREEN_Y = self.opts.output_profile.comic_screen_size
else: else:
SCREEN_X = 540 SCREEN_X = 540
SCREEN_Y = 700 SCREEN_Y = 700

View File

@ -121,7 +121,7 @@ class SNBMLizer(object):
subitem = line[len(CALIBRE_SNB_BM_TAG):] subitem = line[len(CALIBRE_SNB_BM_TAG):]
bodyTree = trees[subitem].find(".//body") bodyTree = trees[subitem].find(".//body")
else: else:
if self.opts and self.opts.snb_indent_first_line: if self.opts and not self.opts.snb_dont_indent_first_line:
prefix = u'\u3000\u3000' prefix = u'\u3000\u3000'
else: else:
prefix = u'' prefix = u''

View File

@ -18,8 +18,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,
['snb_insert_empty_line', 'snb_indent_first_line', ['snb_insert_empty_line', 'snb_dont_indent_first_line',
'snb_hide_chapter_name',]) 'snb_hide_chapter_name','snb_full_screen'])
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

@ -13,8 +13,8 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0"> <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0" rowminimumheight="0,0,0,0,0,0">
<item row="4" column="0"> <item row="5" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -35,9 +35,9 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="opt_snb_indent_first_line"> <widget class="QCheckBox" name="opt_snb_dont_indent_first_line">
<property name="text"> <property name="text">
<string>Insert space before the first line for each paragraph</string> <string>Don't indent the first line for each paragraph</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -48,6 +48,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QCheckBox" name="opt_snb_full_screen">
<property name="text">
<string>Optimize for full-sceen view </string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>