diff --git a/src/calibre/ebooks/pdf/output.py b/src/calibre/ebooks/pdf/output.py index 0ea1c52e2e..14dd27368c 100644 --- a/src/calibre/ebooks/pdf/output.py +++ b/src/calibre/ebooks/pdf/output.py @@ -25,31 +25,30 @@ class PDFOutput(OutputFormatPlugin): file_type = 'pdf' options = set([ - OptionRecommendation(name='unit', recommended_value='inch', - level=OptionRecommendation.LOW, short_switch='u', choices=UNITS.keys(), - help=_('The unit of measure. Default is inch. Choices ' - 'are %s ' - 'Note: This does not override the unit for margins!') % UNITS.keys()), - OptionRecommendation(name='paper_size', recommended_value='letter', - level=OptionRecommendation.LOW, choices=PAPER_SIZES.keys(), - help=_('The size of the paper. This size will be overridden when an ' - 'output profile is used. Default is letter. Choices ' - 'are %s') % PAPER_SIZES.keys()), - OptionRecommendation(name='custom_size', recommended_value=None, - help=_('Custom size of the document. Use the form widthxheight ' - 'EG. `123x321` to specify the width and height. ' - 'This overrides any specified paper-size.')), - OptionRecommendation(name='orientation', recommended_value='portrait', - level=OptionRecommendation.LOW, choices=ORIENTATIONS.keys(), - help=_('The orientation of the page. Default is portrait. Choices ' - 'are %s') % ORIENTATIONS.keys()), - OptionRecommendation(name='preserve_cover_aspect_ratio', - recommended_value=False, - help=_('Preserve the aspect ratio of the cover, instead' - ' of stretching it to fill the full first page of the' - ' generated pdf.') - ), - ]) + OptionRecommendation(name='unit', recommended_value='inch', + level=OptionRecommendation.LOW, short_switch='u', choices=UNITS.keys(), + help=_('The unit of measure. Default is inch. Choices ' + 'are %s ' + 'Note: This does not override the unit for margins!') % UNITS.keys()), + OptionRecommendation(name='paper_size', recommended_value='letter', + level=OptionRecommendation.LOW, choices=PAPER_SIZES.keys(), + help=_('The size of the paper. This size will be overridden when a ' + 'non default output profile is used. Default is letter. Choices ' + 'are %s') % PAPER_SIZES.keys()), + OptionRecommendation(name='custom_size', recommended_value=None, + help=_('Custom size of the document. Use the form widthxheight ' + 'EG. `123x321` to specify the width and height. ' + 'This overrides any specified paper-size.')), + OptionRecommendation(name='orientation', recommended_value='portrait', + level=OptionRecommendation.LOW, choices=ORIENTATIONS.keys(), + help=_('The orientation of the page. Default is portrait. Choices ' + 'are %s') % ORIENTATIONS.keys()), + OptionRecommendation(name='preserve_cover_aspect_ratio', + recommended_value=False, + help=_('Preserve the aspect ratio of the cover, instead' + ' of stretching it to fill the full first page of the' + ' generated pdf.')), + ]) def convert(self, oeb_book, output_path, input_plugin, opts, log): self.oeb = oeb_book diff --git a/src/calibre/ebooks/pdf/writer.py b/src/calibre/ebooks/pdf/writer.py index 632ccf230a..c02f972274 100644 --- a/src/calibre/ebooks/pdf/writer.py +++ b/src/calibre/ebooks/pdf/writer.py @@ -48,7 +48,7 @@ def get_pdf_printer(opts, for_comic=False): custom_size = get_custom_size(opts) if opts.output_profile.short_name == 'default' or \ - opts.output_profile.width > 10000: + opts.output_profile.width > 9999: if custom_size is None: printer.setPaperSize(paper_size(opts.paper_size)) else: diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index bdcf9ede05..6cd6f8872d 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -77,7 +77,6 @@ class Widget(QWidget): self._options, only_existing=True) defaults.update(specifics) - self.apply_recommendations(defaults) self.setup_help(get_help) diff --git a/src/calibre/gui2/convert/pdf_output.py b/src/calibre/gui2/convert/pdf_output.py index 1c526939c2..940d6b68f8 100644 --- a/src/calibre/gui2/convert/pdf_output.py +++ b/src/calibre/gui2/convert/pdf_output.py @@ -18,14 +18,14 @@ class PluginWidget(Widget, Ui_Form): ICON = I('mimetypes/pdf.png') def __init__(self, parent, get_option, get_help, db=None, book_id=None): - Widget.__init__(self, parent, ['paper_size', + Widget.__init__(self, parent, ['paper_size', 'custom_size', 'orientation', 'preserve_cover_aspect_ratio']) self.db, self.book_id = db, book_id - + for x in get_option('paper_size').option.choices: self.opt_paper_size.addItem(x) for x in get_option('orientation').option.choices: self.opt_orientation.addItem(x) - + self.initialize_options(get_option, get_help, db, book_id) - \ No newline at end of file + diff --git a/src/calibre/gui2/convert/pdf_output.ui b/src/calibre/gui2/convert/pdf_output.ui index 0adb8df495..738e75aff5 100644 --- a/src/calibre/gui2/convert/pdf_output.ui +++ b/src/calibre/gui2/convert/pdf_output.ui @@ -40,7 +40,7 @@ - + Qt::Vertical @@ -53,13 +53,26 @@ - + Preserve &aspect ratio of cover + + + + &Custom size: + + + opt_custom_size + + + + + + diff --git a/src/calibre/gui2/preferences/conversion.py b/src/calibre/gui2/preferences/conversion.py index b5240227d3..a15ee0a750 100644 --- a/src/calibre/gui2/preferences/conversion.py +++ b/src/calibre/gui2/preferences/conversion.py @@ -117,6 +117,6 @@ if __name__ == '__main__': from PyQt4.Qt import QApplication app = QApplication([]) #test_widget('Conversion', 'Input Options') - test_widget('Conversion', 'Common Options') - #test_widget('Conversion', 'Output Options') + #test_widget('Conversion', 'Common Options') + test_widget('Conversion', 'Output Options')