Changeset 2fda9e3a2d9ffb08f00f8e0a277399c9dabe8341


Ignore:
Timestamp:
07/11/11 09:55:23 (10 months ago)
Author:
Luper Rouch <luper.rouch@…>
Children:
7ee9df60ced387dbafb8cadf0ceed83631469427
Parents:
cedc35b817525d6b33be481ee17b2f735d8d5c1a
git-committer:
Luper Rouch <luper.rouch@…> (07/11/11 09:55:23)
Message:

added ValueComboBox?

Location:
pyflu/pyflu
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pyflu/pyflu/__init__.py

    r0e85b90 r2fda9e3  
    55 
    66def version(): 
    7     return "0.8.3" 
     7    return "0.8.4" 
    88 
  • pyflu/pyflu/qt/duck_widgets.py

    r0e85b90 r2fda9e3  
    44""" 
    55 
    6 from PyQt4.QtGui import QLineEdit, QSpinBox, QDoubleSpinBox, QCheckBox 
     6from PyQt4.QtGui import (QLineEdit, QSpinBox, QDoubleSpinBox, QCheckBox, 
     7        QComboBox) 
    78 
    89 
     
    4950    def value(self, value): 
    5051        self.setChecked(bool(value)) 
     52 
     53 
     54class ValueComboBox(QComboBox): 
     55 
     56    use_indices = True 
     57    """ 
     58    If :attr:`use_indices` is False, values are stored in the combo box's user 
     59    data rather than indices. 
     60    """ 
     61 
     62    @property 
     63    def value(self): 
     64        if self.use_indices: 
     65            return self.currentIndex() 
     66        return self.itemData(self.currentIndex()).toPyObject() 
     67 
     68    @value.setter 
     69    def value(self, value): 
     70        if self.use_indices: 
     71            self.setCurrentIndex(value) 
     72        else: 
     73            self.setCurrentIndex(self.findData(value)) 
Note: See TracChangeset for help on using the changeset viewer.