Changeset 6981:f1d8df39ddb4 in orange


Ignore:
Timestamp:
09/21/10 12:39:33 (4 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
d5aa21f21bd45537b1b9f69d154bcd9fa73b7c78
Message:
  • added pyqtConfigure method to QObject for PyQt versions 4.5 and lower
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWBaseWidget.py

    r6897 r6981  
    77from PyQt4.QtCore import * 
    88from PyQt4.QtGui import * 
     9 
     10# Define  pyqtConfigure not available in PyQt4 versions prior to 4.6 
     11if not hasattr(QObject, "pyqtConfigure"): 
     12    def pyqtConfigure(obj, **kwargs): 
     13        meta = obj.metaObject() 
     14        for name, val in kwargs.items(): 
     15            if meta.indexOfProperty(name) >= 0: 
     16                obj.setProperty(name, QVariant(val)) 
     17            elif meta.indexOfSignal(meta.normalizedSignature(name)): 
     18                obj.connect(obj, SIGNAL(name), val) 
     19    QObject.pyqtConfigure = pyqtConfigure 
    920 
    1021from OWContexts import * 
Note: See TracChangeset for help on using the changeset viewer.