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

« back to all changes in this revision

Viewing changes to src/calibre/gui2/convert/lrf_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
#!/usr/bin/env python
 
2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
 
3
from __future__ import with_statement
 
4
 
 
5
__license__   = 'GPL v3'
 
6
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
 
7
__docformat__ = 'restructuredtext en'
 
8
 
 
9
from PyQt4.Qt import Qt
 
10
 
 
11
from calibre.gui2.convert.lrf_output_ui import Ui_Form
 
12
from calibre.gui2.convert import Widget
 
13
from calibre.gui2.widgets import FontFamilyModel
 
14
 
 
15
font_family_model = None
 
16
 
 
17
class PluginWidget(Widget, Ui_Form):
 
18
 
 
19
    TITLE = _('LRF Output')
 
20
    HELP = _('Options specific to')+' LRF '+_('output')
 
21
 
 
22
    def __init__(self, parent, get_option, get_help, db=None, book_id=None):
 
23
        Widget.__init__(self, parent, 'lrf_output',
 
24
                ['wordspace', 'header', 'header_format',
 
25
                'minimum_indent', 'serif_family',
 
26
                'render_tables_as_images', 'sans_family', 'mono_family',
 
27
                'text_size_multiplier_for_rendered_tables', 'autorotation',
 
28
                'header_separation', 'minimum_indent']
 
29
                )
 
30
        self.db, self.book_id = db, book_id
 
31
        global font_family_model
 
32
        if font_family_model is None:
 
33
            font_family_model = FontFamilyModel()
 
34
        self.font_family_model = font_family_model
 
35
        self.opt_serif_family.setModel(self.font_family_model)
 
36
        self.opt_sans_family.setModel(self.font_family_model)
 
37
        self.opt_mono_family.setModel(self.font_family_model)
 
38
 
 
39
        self.initialize_options(get_option, get_help, db, book_id)
 
40
        self.opt_header.toggle(), self.opt_header.toggle()
 
41
        self.opt_render_tables_as_images.toggle()
 
42
        self.opt_render_tables_as_images.toggle()
 
43
 
 
44
 
 
45
    def set_value_handler(self, g, val):
 
46
        if unicode(g.objectName()) in ('opt_serif_family',
 
47
                'opt_sans_family', 'opt_mono_family'):
 
48
            idx = -1
 
49
            if val:
 
50
                idx = g.findText(val, Qt.MatchFixedString)
 
51
            if idx < 0:
 
52
                idx = 0
 
53
            g.setCurrentIndex(idx)
 
54
            return True
 
55
        return False