1 from . import _use_pyqt
3 from PyQt4.QtGui import *
5 # Make QVariant invisible in PyQt4 since they don't exist in
7 __original_itemData = QComboBox.itemData
8 def new_itemData(*args, **kargs):
9 from PyQt4.QtCore import QVariant
10 variant = __original_itemData(*args, **kargs)
11 funcS = lambda : (str(variant.toString()), True)
12 dico = {QVariant.Int: variant.toInt, QVariant.String: funcS,
13 QVariant.Bool: variant.toBool, QVariant.Double: variant.toDouble}
14 conv = dico.get(variant.type(), None)
16 raise Exception("Unsupported variant type in pyqtside: '%s'!" % variant.typeName())
19 QComboBox.itemData = new_itemData
21 from PySide.QtGui import *
23 __original_ofn = QFileDialog.getOpenFileName
24 __original_sfn = QFileDialog.getSaveFileName
26 # In PySide, getOpenFileName and co returns 2 values, and only one in PyQt4 ...
27 def newOfn(cls,*args, **kargs):
28 tup = __original_ofn(*args, **kargs)
31 def newSfn(cls,*args, **kargs):
32 tup = __original_sfn(*args, **kargs)
35 QFileDialog.getOpenFileName = classmethod(newOfn)
36 QFileDialog.getSaveFileName = classmethod(newSfn)