Hi PyQt community,<div><br></div><div>i can't understand why staticMetaObject isn't know in __new__ construction</div><div><br></div><div>first step, i think is because staticMetaObject is create for instance,</div>
<div>but in this code bellow, staticMetaObject is know before real instanciation</div><div><br></div><div>no way for work with in __new__ function ?</div><div><br></div><div>Thx for your help</div><div>Kermit</div><div><br>
</div><div>"""</div><div><div>from PyQt4 import QtCore</div><div><br></div><div>class MetaKlass(QtCore.pyqtWrapperType):</div><div> def __new__(meta_cls, name, bases, cls_dict):</div><div> cls = QtCore.pyqtWrapperType.__new__(meta_cls, name, bases, cls_dict)</div>
<div> try:</div><div> meta = cls.staticMetaObject</div><div> print "__new__", meta</div><div> except:</div><div> print "error for __new__"</div><div> return cls</div>
<div> </div><div> def __call__(cls, *args, **kwargs):</div><div> try:</div><div> meta = cls.staticMetaObject</div><div> print "__call__", meta</div><div> except:</div><div>
print "error for __call__"</div><div> </div><div> instance = cls.__new__(cls)</div><div> return instance</div><div> </div><div> </div><div>class Klass(QtCore.QObject):</div>
<div> __metaclass__ = MetaKlass</div><div> </div><div> </div><div><br></div><div>klass = Klass()</div><div>print klass</div></div><div><br></div>