[Pypersyst-cvs] pypersyst/pypersyst/ui/qt field.py,1.6,1.7
Brought to you by:
pobrien
From: Matthew R. S. <gld...@us...> - 2004-08-10 22:39:38
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17649/pypersyst/ui/qt Modified Files: field.py Log Message: More icon support. Index: field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/field.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** field.py 10 Aug 2004 21:49:33 -0000 1.6 --- field.py 10 Aug 2004 22:39:29 -0000 1.7 *************** *** 311,315 **** ! class EntityInstanceLink(qt.QLabel): """A link to an entity instance. --- 311,315 ---- ! class EntityInstanceLink(qt.QWidget): """A link to an entity instance. *************** *** 321,330 **** def __init__(self, domain, field, parent, name, *args, **kwargs): self._domain = domain self.field = field ! qt.QLabel.__init__(self, parent, name, *args) self._origCursor = self.cursor() ! self.setTextFormat(self.PlainText) ! self._origColor = self.paletteForegroundColor() self.reset() --- 321,337 ---- def __init__(self, domain, field, parent, name, *args, **kwargs): + qt.QWidget.__init__(self, parent, name, *args) self._domain = domain self.field = field ! # Set up child widgets. ! hbox = qt.QHBoxLayout(self, 0, 0) ! pixmapLabel = self.pixmapLabel = qt.QLabel(self) ! hbox.addWidget(pixmapLabel) ! textLabel = self.textLabel = qt.QLabel(self) ! hbox.addWidget(textLabel, 1) ! # Set up initial state. self._origCursor = self.cursor() ! textLabel.setTextFormat(self.PlainText) ! self._origColor = textLabel.paletteForegroundColor() self.reset() *************** *** 341,344 **** --- 348,353 ---- domain = self._domain field = self.field + pixmapLabel = self.pixmapLabel + textLabel = self.textLabel value = field.get() if value is field.UNASSIGNED or value is None: *************** *** 355,368 **** label = '(No Label)' self._isLink = True ! font = self.font() font.setUnderline(self._isLink) ! self.setFont(font) if self._isLink: ! self.setPaletteForegroundColor(qt.QColor('blue')) self.setCursor(qt.QCursor(self.PointingHandCursor)) else: ! self.setPaletteForegroundColor(self._origColor) self.setCursor(self._origCursor) ! self.setText(label) --- 364,384 ---- label = '(No Label)' self._isLink = True ! # Set text. ! font = textLabel.font() font.setUnderline(self._isLink) ! textLabel.setFont(font) if self._isLink: ! textLabel.setPaletteForegroundColor(qt.QColor('blue')) self.setCursor(qt.QCursor(self.PointingHandCursor)) else: ! textLabel.setPaletteForegroundColor(self._origColor) self.setCursor(self._origCursor) ! textLabel.setText(label) ! # Set pixmap. ! if self._isLink: ! pixmap = iconcache.smallPixmap(domain, display.collection) ! pixmapLabel.setPixmap(pixmap) ! else: ! pixmapLabel.setPixmap(qt.QPixmap()) |