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',
'margin_top', 'margin_left', 'margin_right',
'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',
'remove_footer', 'footer_regex',
]

View File

@ -309,6 +309,11 @@ OptionRecommendation(name='remove_paragraph_spacing',
'paragraphs of 1.5em. Spacing removal will not work '
'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',
recommended_value=False, level=OptionRecommendation.LOW,

View File

@ -278,7 +278,7 @@ class CSSFlattener(object):
if self.context.insert_blank_line:
cssdict['margin-top'] = cssdict['margin-bottom'] = '0.5em'
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:
items = cssdict.items()
items.sort()

View File

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

View File

@ -127,20 +127,39 @@
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<item row="5" column="0" >
<widget class="QCheckBox" name="opt_remove_paragraph_spacing">
<property name="text">
<string>Remove &amp;spacing between paragraphs</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="opt_insert_blank_line">
</item> <item row="5" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Insert &amp;blank line</string>
<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 row="6" column="0">
<widget class="QCheckBox" name="opt_insert_blank_line">
<property name="text">
<string>Insert &amp;blank line</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="opt_dont_justify">
<property name="text">
@ -216,5 +235,17 @@
</hint>
</hints>
</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>
</ui>