Add item to UI to config para indent

This commit is contained in:
jason 2009-11-22 13:00:45 +00:00
parent 2ce5dec5ee
commit 379c3b3465
5 changed files with 46 additions and 8 deletions

View File

@ -125,7 +125,7 @@ def add_pipeline_options(parser, plumber):
'extra_css', 'extra_css',
'margin_top', 'margin_left', 'margin_right', 'margin_top', 'margin_left', 'margin_right',
'margin_bottom', 'dont_justify', 'margin_bottom', 'dont_justify',
'insert_blank_line', 'remove_paragraph_spacing', 'insert_blank_line', 'remove_paragraph_spacing','remove_paragraph_spacing_indent_size',
'asciiize', 'remove_header', 'header_regex', 'asciiize', 'remove_header', 'header_regex',
'remove_footer', 'footer_regex', 'remove_footer', 'footer_regex',
] ]

View File

@ -310,6 +310,11 @@ OptionRecommendation(name='remove_paragraph_spacing',
'if the source file does not use paragraphs (<p> or <div> tags).') 'if the source file does not use paragraphs (<p> or <div> tags).')
), ),
OptionRecommendation(name='remove_paragraph_spacing_indent_size',
recommended_value=1.5, level=OptionRecommendation.LOW,
help=_('Width of the indent used with Remove spacing between paragraphs option')
),
OptionRecommendation(name='prefer_metadata_cover', OptionRecommendation(name='prefer_metadata_cover',
recommended_value=False, level=OptionRecommendation.LOW, recommended_value=False, level=OptionRecommendation.LOW,
help=_('Use the cover detected from the source file in preference ' help=_('Use the cover detected from the source file in preference '

View File

@ -278,7 +278,7 @@ class CSSFlattener(object):
if self.context.insert_blank_line: if self.context.insert_blank_line:
cssdict['margin-top'] = cssdict['margin-bottom'] = '0.5em' cssdict['margin-top'] = cssdict['margin-bottom'] = '0.5em'
if self.context.remove_paragraph_spacing: if self.context.remove_paragraph_spacing:
cssdict['text-indent'] = '1.5em' cssdict['text-indent'] = "%1.1f em" % self.context.remove_paragraph_spacing_indent_size
if cssdict: if cssdict:
items = cssdict.items() items = cssdict.items()
items.sort() items.sort()

View File

@ -23,7 +23,7 @@ class LookAndFeelWidget(Widget, Ui_Form):
'font_size_mapping', 'line_height', 'font_size_mapping', 'line_height',
'linearize_tables', 'linearize_tables',
'disable_font_rescaling', 'insert_blank_line', 'disable_font_rescaling', 'insert_blank_line',
'remove_paragraph_spacing', 'input_encoding', 'remove_paragraph_spacing', 'remove_paragraph_spacing_indent_size','input_encoding',
'asciiize'] 'asciiize']
) )
self.db, self.book_id = db, book_id self.db, self.book_id = db, book_id
@ -32,6 +32,8 @@ class LookAndFeelWidget(Widget, Ui_Form):
self.opt_disable_font_rescaling.toggle() self.opt_disable_font_rescaling.toggle()
self.connect(self.button_font_key, SIGNAL('clicked()'), self.connect(self.button_font_key, SIGNAL('clicked()'),
self.font_key_wizard) self.font_key_wizard)
self.opt_remove_paragraph_spacing.toggle()
self.opt_remove_paragraph_spacing.toggle()
def font_key_wizard(self): def font_key_wizard(self):
from calibre.gui2.convert.font_key import FontKeyChooser from calibre.gui2.convert.font_key import FontKeyChooser

View File

@ -127,12 +127,31 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="3"> <item row="5" column="0" >
<widget class="QCheckBox" name="opt_remove_paragraph_spacing"> <widget class="QCheckBox" name="opt_remove_paragraph_spacing">
<property name="text"> <property name="text">
<string>Remove &amp;spacing between paragraphs</string> <string>Remove &amp;spacing between paragraphs</string>
</property> </property>
</widget> </widget>
</item> <item row="5" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Indent size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QDoubleSpinBox" name="opt_remove_paragraph_spacing_indent_size">
<property name="suffix">
<string> em</string>
</property>
<property name="decimals">
<number>1</number>
</property>
</widget>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
<widget class="QCheckBox" name="opt_insert_blank_line"> <widget class="QCheckBox" name="opt_insert_blank_line">
@ -216,5 +235,17 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>opt_remove_paragraph_spacing</sender>
<signal>toggled(bool)</signal>
<receiver>label_4</receiver>
<slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>opt_remove_paragraph_spacing</sender>
<signal>toggled(bool)</signal>
<receiver>opt_remove_paragraph_spacing_indent_size</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections> </connections>
</ui> </ui>