Hi PyQt community,

i can't understand why staticMetaObject isn't know in __new__ construction

first step, i think is because staticMetaObject is create for instance,
but in this code bellow, staticMetaObject is know before real instanciation

no way for work with in __new__ function ?

Thx for your help
Kermit

"""
from PyQt4 import QtCore

class MetaKlass(QtCore.pyqtWrapperType):
    def __new__(meta_cls, name, bases, cls_dict):
        cls = QtCore.pyqtWrapperType.__new__(meta_cls, name, bases,
cls_dict)
        try:
            meta = cls.staticMetaObject
            print "__new__", meta
        except:
            print "error for __new__"
        return cls

    def __call__(cls, *args, **kwargs):
        try:
            meta = cls.staticMetaObject
            print "__call__", meta
        except:
            print "error for __call__"

        instance = cls.__new__(cls)
        return instance


class Klass(QtCore.QObject):
    __metaclass__ = MetaKlass



klass = Klass()
print klass
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to