~stub/ubuntu/precise/calibre/devel

« back to all changes in this revision

Viewing changes to src/calibre/gui2/preferences/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-04-12 11:29:25 UTC
  • mfrom: (42.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110412112925-c7171kt2bb5rmft4
Tags: 0.7.50+dfsg-2
* debian/control: Build with libpodofo-dev to enable PDF metadata.
  (Closes: #619632)
* debian/control: Add libboost1.42-dev build dependency. Apparently it is
  needed in some setups. (Closes: #619807)
* debian/rules: Call dh_sip to generate a proper sip API dependency, to
  prevent crashes like #616372 for partial upgrades.
* debian/control: Bump python-qt4 dependency to >= 4.8.3-2, which reportedly
  fixes crashes on startup. (Closes: #619701, #620125)

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
import textwrap
9
9
 
10
10
from PyQt4.Qt import QWidget, pyqtSignal, QCheckBox, QAbstractSpinBox, \
11
 
    QLineEdit, QComboBox, QVariant
 
11
    QLineEdit, QComboBox, QVariant, Qt
12
12
 
13
13
from calibre.customize.ui import preferences_plugins
14
14
from calibre.utils.config import ConfigProxy
82
82
 
83
83
class Setting(object):
84
84
 
 
85
    CHOICES_SEARCH_FLAGS = Qt.MatchExactly | Qt.MatchCaseSensitive
 
86
 
85
87
    def __init__(self, name, config_obj, widget, gui_name=None,
86
88
            empty_string_is_None=True, choices=None, restart_required=False):
87
89
        self.name, self.gui_name = name, gui_name
168
170
        elif self.datatype == 'string':
169
171
            self.gui_obj.setText(val if val else '')
170
172
        elif self.datatype == 'choice':
171
 
            idx = self.gui_obj.findData(QVariant(val))
 
173
            idx = self.gui_obj.findData(QVariant(val), role=Qt.UserRole,
 
174
                    flags=self.CHOICES_SEARCH_FLAGS)
172
175
            if idx == -1:
173
176
                idx = 0
174
177
            self.gui_obj.setCurrentIndex(idx)