On Saturday 08 January 2011 10:21:25 Evan Patterson wrote:
> Hello all,
> 
> I've encountered what I suspect is a Shiboken bug, which the
> following script demonstrates. I am hardly a metaclass
> wizard, but I think this should work (at any rate, it does
> under PyQt4). Strangely, creating a C does work, but
> creating a D gives "RuntimeError: You can't initialize an
> object twice!". Does anyone know what the problem is?
> 
> Thanks,
> Evan
> 
> -------------------------------------------------
> from PySide import QtGui
> 
> class MetaA(type):
>     pass
> class A(object):
>     __metaclass__ = MetaA
> 
> MetaB = type(QtGui.QWidget)
> B = QtGui.QWidget
> 
> class MetaC(MetaA, MetaB):
>     pass
> class C(A, B):
>     __metaclass__ = MetaC
> 
> class D(C):
>     pass
> 
> app = QtGui.QApplication([])
> #w = C() # works
> w = D() # broken
> w.show()
> app.exec_()
> -------------------------------------------------

I do not know if any one really cares at this stage, but any 
QApplication can not be run twice in Idle. The second time Idle 
responds the QApplication is already running...  To compound the 
problem, sometimes Idle takes the app several times and 
invariably fails. 

Mind you, PyQt just kills Idle, at least in some version 
combinations.

I have no idea if this is related to your findings, but it may 
well be.  My "work around" is not to use Idle and use Eric4; 
that is now possible since  QApplication now accepts unicode 
arguments  :)

I want to reiterate that I am not an expert in any matters 
relating to PySide.  I am not even a programmer, though I 
learned to program before Computer Science was "invented"...

Good luck to you!

OldAl.
 
-- 
Algis
http://akabaila.pcug.org.au
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to