Home | Trees | Indices | Help |
|
---|
|
1 # ============================================================================ 2 # 3 # Copyright (C) 2007-2008 Conceptive Engineering bvba. All rights reserved. 4 # www.conceptive.be / project-camelot@conceptive.be 5 # 6 # This file is part of the Camelot Library. 7 # 8 # This file may be used under the terms of the GNU General Public 9 # License version 2.0 as published by the Free Software Foundation 10 # and appearing in the file LICENSE.GPL included in the packaging of 11 # this file. Please review the following information to ensure GNU 12 # General Public Licensing requirements will be met: 13 # http://www.trolltech.com/products/qt/opensource.html 14 # 15 # If you are unsure which license is appropriate for your use, please 16 # review the following information: 17 # http://www.trolltech.com/products/qt/licensing.html or contact 18 # project-camelot@conceptive.be. 19 # 20 # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 21 # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 22 # 23 # For use of this library in commercial applications, please contact 24 # project-camelot@conceptive.be 25 # 26 # ============================================================================ 27 28 from PyQt4 import QtGui, QtCore 29 from PyQt4.QtCore import Qt 30 31 from customeditor import AbstractCustomEditor 32 from camelot.core import constants 33 from camelot.core.utils import ugettext 3436 """Widget for editing a boolean field""" 377338 - def __init__(self, 39 parent=None, 40 minimum=constants.camelot_minint, 41 maximum=constants.camelot_maxint, 42 editable=True, 43 **kwargs):44 QtGui.QCheckBox.__init__(self, parent) 45 AbstractCustomEditor.__init__(self) 46 self.setEnabled(editable) 47 self.connect(self, 48 QtCore.SIGNAL('stateChanged(int)'), 49 self.editingFinished)5052 value = AbstractCustomEditor.set_value(self, value) 53 if value: 54 self.setCheckState(Qt.Checked) 55 else: 56 self.setCheckState(Qt.Unchecked)57 61 64 6975 """ 76 :Parameter: 77 color_yes: string 78 text-color of the True representation 79 color_no: string 80 text-color of the False representation 81 """11182 - def __init__(self, 83 parent=None, 84 yes="Yes", 85 no="No", 86 color_yes=None, 87 color_no=None, 88 **kwargs):89 QtGui.QLabel.__init__(self, parent) 90 AbstractCustomEditor.__init__(self) 91 self.setEnabled(False) 92 self.yes = ugettext(yes) 93 self.no = ugettext(no) 94 self.color_yes = color_yes 95 self.color_no = color_no9698 value = AbstractCustomEditor.set_value(self, value) 99 if value: 100 self.setText(self.yes) 101 if self.color_yes: 102 selfpalette = self.palette() 103 selfpalette.setColor(QtGui.QPalette.WindowText, self.color_yes) 104 self.setPalette(selfpalette) 105 else: 106 self.setText(self.no) 107 if self.color_no: 108 selfpalette = self.palette() 109 selfpalette.setColor(QtGui.QPalette.WindowText, self.color_no) 110 self.setPalette(selfpalette)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 12 15:42:10 2010 | http://epydoc.sourceforge.net |