...this looks like critical error, and we should fix it ASAP, until then i don't recommend to use pyside 1.1.2 with python 3.2. Both windows and linux versions are affected
2012/9/12 Roman Lacko <[email protected]>: > here is more better example, see comments: > > from PySide import QtCore > class MyObject(QtCore.QObject): > Instance = "default value" > > # This will print "new value" > MyObject.Instance = "new value" > print(MyObject.Instance) > > # This will print "default value" > MyObject.Instance > MyObject.Instance = "new value" > print(MyObject.Instance) > > When I access the MyObject.Instance, than the value of > MyObject.Instance is allways "default value" ! > > R. > > 2012/9/12 Thomas Pietrowski <[email protected]>: >> Hey, >> >> I'm not familiar to Python3, but what happens, when you replace: >> >> def instance(cls): >> >> with: >> >> def instance(self, cls): >> >> For me it seems that it uses cls as self in that function, if self is not >> set in the function of your class. >> But, as I said, I'm not sure if that could be your solution ;-) >> >> Am 12.09.2012 12:20 schrieb "Roman Lacko" <[email protected]>: >>> >>> Hi, >>> >>> I have discovered strange bahaviour while testing qtdemo.py under Python >>> 3.2. >>> Plase look at sample code and the comment prefixed XXX: >>> >>> >>> >>> from PySide import QtCore >>> >>> class MenuManager(QtCore.QObject): >>> >>> pInstance = None >>> >>> @classmethod >>> def instance(cls): >>> if cls.pInstance is None: >>> cls_inst = cls() >>> cls.pInstance = cls_inst >>> # XXX: the cls.pInstance is None but cls_inst is NOT None !!! >>> >>> return cls.pInstance >>> >>> # This will allways return None under Python 3.2 >>> menuManagerInstance = MenuManager.instance() >>> print(menuManagerInstance) >>> <<< >>> >>> Under Python 2.6 and 2.7 the code work as expected (cls.pInstance is NOT >>> None) >>> If MenuManager inherits from object it will work (class >>> MenuManager(object)), so there is something wrong with QObject >>> wrapper... >>> Under PyQt4 it works fine. >>> >>> I have absolutely no idea what is going on here. >>> >>> Regards >>> Roman >>> _______________________________________________ >>> PySide mailing list >>> [email protected] >>> http://lists.qt-project.org/mailman/listinfo/pyside _______________________________________________ PySide mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/pyside
