From 379c3b3465b74b8b44aed196ca4ffe050dd6d74c Mon Sep 17 00:00:00 2001 From: jason Date: Sun, 22 Nov 2009 13:00:45 +0000 Subject: [PATCH] Add item to UI to config para indent --- src/calibre/ebooks/conversion/cli.py | 2 +- src/calibre/ebooks/conversion/plumber.py | 5 +++ src/calibre/ebooks/oeb/transforms/flatcss.py | 2 +- src/calibre/gui2/convert/look_and_feel.py | 4 +- src/calibre/gui2/convert/look_and_feel.ui | 41 +++++++++++++++++--- 5 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index 75c545f8b5..178561fcb5 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -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', ] diff --git a/src/calibre/ebooks/conversion/plumber.py b/src/calibre/ebooks/conversion/plumber.py index 2a3dfedd65..262f64a9cc 100644 --- a/src/calibre/ebooks/conversion/plumber.py +++ b/src/calibre/ebooks/conversion/plumber.py @@ -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 (

or

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, diff --git a/src/calibre/ebooks/oeb/transforms/flatcss.py b/src/calibre/ebooks/oeb/transforms/flatcss.py index 464acbe0e0..ffb5364750 100644 --- a/src/calibre/ebooks/oeb/transforms/flatcss.py +++ b/src/calibre/ebooks/oeb/transforms/flatcss.py @@ -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() diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index a10a410b67..4d43f64910 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -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 diff --git a/src/calibre/gui2/convert/look_and_feel.ui b/src/calibre/gui2/convert/look_and_feel.ui index d451cd9af0..0161dfcea6 100644 --- a/src/calibre/gui2/convert/look_and_feel.ui +++ b/src/calibre/gui2/convert/look_and_feel.ui @@ -127,20 +127,39 @@ - + Remove &spacing between paragraphs - - - + + - Insert &blank line + Indent size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + em + + + 1 + + + + + + + Insert &blank line + + + @@ -216,5 +235,17 @@ + + opt_remove_paragraph_spacing + toggled(bool) + label_4 + setEnabled(bool) + + + opt_remove_paragraph_spacing + toggled(bool) + opt_remove_paragraph_spacing_indent_size + setEnabled(bool) +