~ubuntu-branches/ubuntu/karmic/calibre/karmic

« back to all changes in this revision

Viewing changes to src/calibre/gui2/convert/pdf_output.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-30 12:49:41 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730124941-qjdsmri25zt8zocn
Tags: 0.6.3+dfsg-0ubuntu1
* New upstream release. Please see http://calibre.kovidgoyal.net/new_in_6/
  for the list of new features and changes.
* remove_postinstall.patch: Update for new version.
* build_debug.patch: Does not apply any more, disable for now. Might not be
  necessary any more.
* debian/copyright: Fix reference to versionless GPL.
* debian/rules: Drop obsolete dh_desktop call.
* debian/rules: Add workaround for weird Python 2.6 setuptools behaviour of
  putting compiled .so files into src/calibre/plugins/calibre/plugins
  instead of src/calibre/plugins.
* debian/rules: Drop hal fdi moving, new upstream version does not use hal
  any more. Drop hal dependency, too.
* debian/rules: Install udev rules into /lib/udev/rules.d.
* Add debian/calibre.preinst: Remove unmodified
  /etc/udev/rules.d/95-calibre.rules on upgrade.
* debian/control: Bump Python dependencies to 2.6, since upstream needs
  it now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
__license__ = 'GPL 3'
 
4
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
 
5
__docformat__ = 'restructuredtext en'
 
6
 
 
7
from calibre.gui2.convert.pdf_output_ui import Ui_Form
 
8
from calibre.gui2.convert import Widget
 
9
from calibre.ebooks.pdf.pageoptions import PAPER_SIZES, ORIENTATIONS
 
10
from calibre.gui2.widgets import BasicComboModel
 
11
 
 
12
paper_size_model = None
 
13
orientation_model = None
 
14
 
 
15
class PluginWidget(Widget, Ui_Form):
 
16
 
 
17
    TITLE = _('PDF Output')
 
18
    HELP = _('Options specific to')+' PDF '+_('output')
 
19
 
 
20
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
 
21
        Widget.__init__(self, parent, 'pdf_output', ['paper_size', 'orientation'])
 
22
        self.db, self.book_id = db, book_id
 
23
        self.initialize_options(get_option, get_help, db, book_id)
 
24
 
 
25
        default_paper_size = self.opt_paper_size.currentText()
 
26
        default_orientation = self.opt_orientation.currentText()
 
27
 
 
28
        global paper_size_model
 
29
        if paper_size_model is None:
 
30
            paper_size_model = BasicComboModel(PAPER_SIZES.keys())
 
31
        self.paper_size_model = paper_size_model
 
32
        self.opt_paper_size.setModel(self.paper_size_model)
 
33
 
 
34
        default_paper_size_index = self.opt_paper_size.findText(default_paper_size)
 
35
        letter_index = self.opt_paper_size.findText('letter')
 
36
        self.opt_paper_size.setCurrentIndex(default_paper_size_index if default_paper_size_index != -1 else letter_index if letter_index != -1 else 0)
 
37
 
 
38
        global orientation_model
 
39
        if orientation_model is None:
 
40
            orientation_model = BasicComboModel(ORIENTATIONS.keys())
 
41
        self.orientation_model = orientation_model
 
42
        self.opt_orientation.setModel(self.orientation_model)
 
43
 
 
44
        default_orientation_index = self.opt_orientation.findText(default_orientation)
 
45
        orientation_index = self.opt_orientation.findText('portrait')
 
46
        self.opt_orientation.setCurrentIndex(default_orientation_index if default_orientation_index != -1 else orientation_index if orientation_index != -1 else 0)
 
47