diff --git a/src/calibre/ebooks/lrf/output.py b/src/calibre/ebooks/lrf/output.py index 40e99256e9..52c2a22ccd 100644 --- a/src/calibre/ebooks/lrf/output.py +++ b/src/calibre/ebooks/lrf/output.py @@ -53,6 +53,7 @@ class LRFOptions(object): self.lrs = False self.minimize_memory_usage = False self.autorotation = opts.enable_autorotation + self.header_separation = (self.profile.dpi/72.) * opts.header_separation for x in ('top', 'bottom', 'left', 'right'): @@ -60,7 +61,7 @@ class LRFOptions(object): 'margin_'+x)) for x in ('wordspace', 'header', 'header_format', - 'header_separation', 'minimum_indent', 'serif_family', + 'minimum_indent', 'serif_family', 'render_tables_as_images', 'sans_family', 'mono_family', 'text_size_multiplier_for_rendered_tables'): setattr(self, x, getattr(opts, x)) @@ -87,7 +88,7 @@ class LRFOutput(OutputFormatPlugin): 'and %t by the title. Default is %default') ), OptionRecommendation(name='header_separation', recommended_value=0, - help=_('Add extra spacing below the header. Default is %default px.') + help=_('Add extra spacing below the header. Default is %default pt.') ), OptionRecommendation(name='minimum_indent', recommended_value=0, help=_('Minimum paragraph indent (the indent of the first line ' @@ -99,7 +100,7 @@ class LRFOutput(OutputFormatPlugin): 'document has large or complex tables)') ), OptionRecommendation(name='text_size_multiplier_for_rendered_tables', - recommended_value=1, + recommended_value=1.0, help=_('Multiply the size of text in rendered tables by this ' 'factor. Default is %default') ), diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index 8ecf7f97ab..dddb6b0c00 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -190,7 +190,7 @@ class Widget(QWidget): elif isinstance(g, QCheckBox): g.setCheckState(Qt.Checked if bool(val) else Qt.Unchecked) else: - raise Exception('Can\'t set value in %s'%type(g)) + raise Exception('Can\'t set value %s in %s'%(repr(val), type(g))) self.post_set_value(g, val) def set_help(self, msg): diff --git a/src/calibre/gui2/convert/lrf_output.py b/src/calibre/gui2/convert/lrf_output.py new file mode 100644 index 0000000000..1a64b0689f --- /dev/null +++ b/src/calibre/gui2/convert/lrf_output.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +from __future__ import with_statement + +__license__ = 'GPL v3' +__copyright__ = '2009, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + +from calibre.gui2.convert.lrf_output_ui import Ui_Form +from calibre.gui2.convert import Widget +from calibre.gui2.widgets import FontFamilyModel + +font_family_model = None + +class PluginWidget(Widget, Ui_Form): + + TITLE = _('LRF Output') + + def __init__(self, parent, get_option, get_help, db=None, book_id=None): + Widget.__init__(self, parent, 'lrf_output', + ['wordspace', 'header', 'header_format', + 'minimum_indent', 'serif_family', + 'render_tables_as_images', 'sans_family', 'mono_family', + 'text_size_multiplier_for_rendered_tables', 'autorotation', + 'header_separation', 'minimum_indent'] + ) + self.db, self.book_id = db, book_id + global font_family_model + if font_family_model is None: + font_family_model = FontFamilyModel() + self.font_family_model = font_family_model + self.opt_serif_family.setModel(self.font_family_model) + self.opt_sans_family.setModel(self.font_family_model) + self.opt_mono_family.setModel(self.font_family_model) + + self.initialize_options(get_option, get_help, db, book_id) + + def set_value_handler(self, g, val): + if val is None and unicode(g.objectName()) in ('opt_serif_family', + 'opt_sans_family', 'opt_mono_family'): + g.setCurrentIndex(0) + return True + return False diff --git a/src/calibre/gui2/convert/lrf_output.ui b/src/calibre/gui2/convert/lrf_output.ui new file mode 100644 index 0000000000..7c58fd02fb --- /dev/null +++ b/src/calibre/gui2/convert/lrf_output.ui @@ -0,0 +1,256 @@ + + + Form + + + + 0 + 0 + 588 + 481 + + + + Form + + + + + + Enable &autorotation of wide images + + + + + + + + + &Wordspace: + + + opt_wordspace + + + + + + + pt + + + 1 + + + 1.000000000000000 + + + 20.000000000000000 + + + 2.500000000000000 + + + + + + + Minimum para. &indent: + + + opt_minimum_indent + + + + + + + pt + + + 1 + + + + + + + + + Render &tables as images + + + + + + + + + Text size multiplier for text in rendered tables: + + + + + + + + + + + + + + Add &header + + + + + + + Header &separation: + + + opt_header_separation + + + + + + + pt + + + 1 + + + + + + + Header &format: + + + opt_header_format + + + + + + + + + + + + &Embed fonts + + + + + + &Serif font family: + + + opt_serif_family + + + + + + + S&ans-serif font family: + + + opt_sans_family + + + + + + + &Monospaced font family: + + + opt_mono_family + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + opt_render_tables_as_images + toggled(bool) + opt_text_size_multiplier_for_rendered_tables + setEnabled(bool) + + + 76 + 80 + + + 418 + 105 + + + + + opt_header + toggled(bool) + opt_header_separation + setEnabled(bool) + + + 346 + 144 + + + 408 + 167 + + + + + opt_header + toggled(bool) + opt_header_format + setEnabled(bool) + + + 124 + 138 + + + 230 + 208 + + + + + diff --git a/src/calibre/gui2/convert/mobi_output.py b/src/calibre/gui2/convert/mobi_output.py new file mode 100644 index 0000000000..32cb74ba47 --- /dev/null +++ b/src/calibre/gui2/convert/mobi_output.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +from __future__ import with_statement + +__license__ = 'GPL v3' +__copyright__ = '2009, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + +from calibre.gui2.convert.mobi_output_ui import Ui_Form +from calibre.gui2.convert import Widget + +class PluginWidget(Widget, Ui_Form): + + TITLE = _('MOBI Output') + + def __init__(self, parent, get_option, get_help, db=None, book_id=None): + Widget.__init__(self, parent, 'mobi_output', + ['prefer_author_sort', 'rescale_images', 'toc_title'] + ) + self.db, self.book_id = db, book_id + self.initialize_options(get_option, get_help, db, book_id) + diff --git a/src/calibre/gui2/convert/mobi_output.ui b/src/calibre/gui2/convert/mobi_output.ui new file mode 100644 index 0000000000..a91f48d592 --- /dev/null +++ b/src/calibre/gui2/convert/mobi_output.ui @@ -0,0 +1,61 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + &Title for Table of Contents: + + + opt_toc_title + + + + + + + + + + Rescale images for &Palm devices + + + + + + + Use author &sort for author + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index 886320aedb..7f3487f035 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -285,7 +285,7 @@ class FontFamilyModel(QAbstractListModel): print 'WARNING: Could not load fonts' traceback.print_exc() self.families.sort() - self.families[:0] = ['None'] + self.families[:0] = [_('None')] def rowCount(self, *args): return len(self.families)