Re: [PyQt] PyQt4 question

2007-05-28 Thread Detlev Offenbach
On Montag, 28. Mai 2007, David Boddie wrote:
> On Sun May 27 22:57:23 BST 2007, Andreas Pakulat wrote:
> > On 27.05.07 14:53:08, Detlev Offenbach wrote:
> > > On Sonntag, 27. Mai 2007, Giovanni Bajo wrote:
> > > > Uh? Does QDesignerFormEditorPluginInterface inherit from QObject?
> > > > Otherwise, I can't see how the qobject_cast can work.
> > >
> > > I have no idea. I had a look into edyuk, and they do it that way and it
> > > works there (unless there is some magic somewhere else in their code).
> >
> > One reason could be that the QDesignerFormEditorPluginInterface is a
> > Q_INTERFACE and the real QObject-derived implementation declares its
> > inheritance from that interface. I guess qobject_cast<> takes that into
> > account.
>
> That makes sense. Those classes are supposed to be subclassed (mixed in)
> with QObject in C++ in order to declare interfaces. You would never
> subclass them alone.
>

So, how can I check, if a QObject is of the interface type? How can stuff like 
this be wrapped? See my other post about the "qt_extension" function of 
QExtensionManager not being wrapped? All that stuff need to be available in 
order to tightly integrate designer into eric4.

Detlev
-- 
Detlev Offenbach
[EMAIL PROTECTED]
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt4 question

2007-05-28 Thread Detlev Offenbach
On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> On Sunday 27 May 2007 1:10 pm, Detlev Offenbach wrote:
> > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > On Sunday 27 May 2007 12:37 pm, Detlev Offenbach wrote:
> > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > On Sunday 27 May 2007 11:50 am, Detlev Offenbach wrote:
> > > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > > On Saturday 26 May 2007 9:07 pm, Detlev Offenbach wrote:
> > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > On Saturday 26 May 2007 7:58 pm, Detlev Offenbach wrote:
> > > > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > > On Saturday 26 May 2007 4:52 pm, Detlev Offenbach wrote:
> > > > > > > > > > > > Hi,
> > > > > > > > > > > >
> > > > > > > > > > > > is there a PyQt equivalent to
> > > > > > > > > > > > "qobject_cast(object)"?
> > > > > > > > > > >
> > > > > > > > > > > sip.cast()?
> > > > > > > > > > >
> > > > > > > > > > > But it shouldn't be necessary if the sub-class
> > > > > > > > > > > conversion code has been properly implemented.
> > > > > > > > > >
> > > > > > > > > > How do I do that. I haven't wrapped complicated stuff
> > > > > > > > > > like this so far. The situation is as follows. I have the
> > > > > > > > > > following code:
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > self.plugins.extend(self.designer.pluginManager().instanc
> > > > > > > > > >es () ) for plugin in self.plugins:
> > > > > > > > > > if isinstance(plugin,
> > > > > > > > > > QDesignerFormEditorPluginInterface): if not
> > > > > > > > > > plugin.isInitialized(): plugin.initialze(self.designer)
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > "self.designer.pluginManager().instances()" returns a
> > > > > > > > > > list of QObject. The first if statement shall check,
> > > > > > > > > > wether the returned QObject is of type
> > > > > > > > > > QDesignerFormEditorPluginInterface. In C++ you would do
> > > > > > > > > > it with code like
> > > > > > > > > >
> > > > > > > > > > if (
> > > > > > > > > > (qobject_cast(plugin
> > > > > > > > > >)) )
> > > > > > > > > >
> > > > > > > > > > How can the problem be solved with PyQt4 and Python?
> > > > > > > > > >
> > > > > > > > > > Note: self.designer.pluginManager() returns an object of
> > > > > > > > > > type QDesignerPluginManager.
> > > > > > > > >
> > > > > > > > > The wrapper for QDesignerFormEditorPluginInterface must
> > > > > > > > > define some %ConvertToSubClassCode which will use RTTI
> > > > > > > > > provided by the instance to identify the right Python type
> > > > > > > > > object. See how PyQt does it for QObject and QEvent. If the
> > > > > > > > > instance doesn't provide any RTTI then you're stuck.
> > > > > > > >
> > > > > > > > Mustn't the %ConvertToSubClassCode go into the more general
> > > > > > > > class (e.g. QObject)?
> > > > > > >
> > > > > > > No - just in a QObject sub-class in the module.
> > > > > > >
> > > > > > > > Is there a way to extend the QObject wrapper?
> > > > > > >
> > > > > > > That's what sip does under the covers.
> > > > > >
> > > > > > I am stuck at the moment due to my lack of sip know how. Below is
> > > > > > the wrapper code in question. How does the %ConvertToSubClassCode
> > > > > > have to be?
> > > > > >
> > > > > > -
> > > > > >-- -- -- -- -- - class QDesignerFormEditorPluginInterface
> > > > > > {
> > > > > >
> > > > > > %TypeHeaderCode
> > > > > > #include 
> > > > > > %End
> > > > > >
> > > > > > public:
> > > > > > virtual ~QDesignerFormEditorPluginInterface();
> > > > > >
> > > > > > virtual bool isInitialized() const = 0;
> > > > > > virtual void initialize(QDesignerFormEditorInterface *core) =
> > > > > > 0; virtual QAction *action() const = 0;
> > > > > >
> > > > > > virtual QDesignerFormEditorInterface *core() const = 0;
> > > > > > };
> > > > > > -
> > > > > >-- -- -- -- --
> > > > >
> > > > > What RTTI is available for the code to determine what the class
> > > > > really is? I can't see anything that is obviously suitable - in
> > > > > which case you are stuck.
> > > >
> > > > In a C++ program one would do it with this statement
> > > >
> > > > qobject_cast(object)
> > > >
> > > > where object is a pointer to a QObject. If the conversion code would
> > > > be in QObject.sip, one could probably use the inherits() method of
> > > > QObject.
> > >
> > > So that's what you put in your conversion code in your
> > > QDesignerFormEditorPluginInterface class.
> >
> > I tried that before I posted to this list, but it didn't work. Phil, can
> > you give a little help?
>
> Post what you tried.

I tried it with the following code:

%ModuleHeaderCode
#include 
%End

class QDesignerFormEditorPluginInterface
{

%TypeHeaderCode
#include 
%End

%ConvertToSubClassCode
if ( (qobjec

Re: [PyQt] PyQt4 question (follow on)

2007-05-28 Thread Detlev Offenbach
On Montag, 28. Mai 2007, Detlev Offenbach wrote:
> On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > On Sunday 27 May 2007 1:10 pm, Detlev Offenbach wrote:
> > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > On Sunday 27 May 2007 12:37 pm, Detlev Offenbach wrote:
> > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > On Sunday 27 May 2007 11:50 am, Detlev Offenbach wrote:
> > > > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > > > On Saturday 26 May 2007 9:07 pm, Detlev Offenbach wrote:
> > > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > On Saturday 26 May 2007 7:58 pm, Detlev Offenbach wrote:
> > > > > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > > > On Saturday 26 May 2007 4:52 pm, Detlev Offenbach 
wrote:
> > > > > > > > > > > > > Hi,
> > > > > > > > > > > > >
> > > > > > > > > > > > > is there a PyQt equivalent to
> > > > > > > > > > > > > "qobject_cast(object)"?
> > > > > > > > > > > >
> > > > > > > > > > > > sip.cast()?
> > > > > > > > > > > >
> > > > > > > > > > > > But it shouldn't be necessary if the sub-class
> > > > > > > > > > > > conversion code has been properly implemented.
> > > > > > > > > > >
> > > > > > > > > > > How do I do that. I haven't wrapped complicated stuff
> > > > > > > > > > > like this so far. The situation is as follows. I have
> > > > > > > > > > > the following code:
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > self.plugins.extend(self.designer.pluginManager().insta
> > > > > > > > > > >nc es () ) for plugin in self.plugins:
> > > > > > > > > > > if isinstance(plugin,
> > > > > > > > > > > QDesignerFormEditorPluginInterface): if not
> > > > > > > > > > > plugin.isInitialized(): plugin.initialze(self.designer)
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > "self.designer.pluginManager().instances()" returns a
> > > > > > > > > > > list of QObject. The first if statement shall check,
> > > > > > > > > > > wether the returned QObject is of type
> > > > > > > > > > > QDesignerFormEditorPluginInterface. In C++ you would do
> > > > > > > > > > > it with code like
> > > > > > > > > > >
> > > > > > > > > > > if (
> > > > > > > > > > > (qobject_cast(plug
> > > > > > > > > > >in )) )
> > > > > > > > > > >
> > > > > > > > > > > How can the problem be solved with PyQt4 and Python?
> > > > > > > > > > >
> > > > > > > > > > > Note: self.designer.pluginManager() returns an object
> > > > > > > > > > > of type QDesignerPluginManager.
> > > > > > > > > >
> > > > > > > > > > The wrapper for QDesignerFormEditorPluginInterface must
> > > > > > > > > > define some %ConvertToSubClassCode which will use RTTI
> > > > > > > > > > provided by the instance to identify the right Python
> > > > > > > > > > type object. See how PyQt does it for QObject and QEvent.
> > > > > > > > > > If the instance doesn't provide any RTTI then you're
> > > > > > > > > > stuck.
> > > > > > > > >
> > > > > > > > > Mustn't the %ConvertToSubClassCode go into the more general
> > > > > > > > > class (e.g. QObject)?
> > > > > > > >
> > > > > > > > No - just in a QObject sub-class in the module.
> > > > > > > >
> > > > > > > > > Is there a way to extend the QObject wrapper?
> > > > > > > >
> > > > > > > > That's what sip does under the covers.
> > > > > > >
> > > > > > > I am stuck at the moment due to my lack of sip know how. Below
> > > > > > > is the wrapper code in question. How does the
> > > > > > > %ConvertToSubClassCode have to be?
> > > > > > >
> > > > > > > ---
> > > > > > >-- -- -- -- -- -- - class QDesignerFormEditorPluginInterface {
> > > > > > >
> > > > > > > %TypeHeaderCode
> > > > > > > #include 
> > > > > > > %End
> > > > > > >
> > > > > > > public:
> > > > > > > virtual ~QDesignerFormEditorPluginInterface();
> > > > > > >
> > > > > > > virtual bool isInitialized() const = 0;
> > > > > > > virtual void initialize(QDesignerFormEditorInterface *core)
> > > > > > > = 0; virtual QAction *action() const = 0;
> > > > > > >
> > > > > > > virtual QDesignerFormEditorInterface *core() const = 0;
> > > > > > > };
> > > > > > > ---
> > > > > > >-- -- -- -- -- --
> > > > > >
> > > > > > What RTTI is available for the code to determine what the class
> > > > > > really is? I can't see anything that is obviously suitable - in
> > > > > > which case you are stuck.
> > > > >
> > > > > In a C++ program one would do it with this statement
> > > > >
> > > > > qobject_cast(object)
> > > > >
> > > > > where object is a pointer to a QObject. If the conversion code
> > > > > would be in QObject.sip, one could probably use the inherits()
> > > > > method of QObject.
> > > >
> > > > So that's what you put in your conversion code in your
> > > > QDesignerFormEditorPluginInterface class.
> > >
> > > I tried that before I posted to this list, bu

Re: [PyQt] PyQt4 question (follow on)

2007-05-28 Thread Phil Thompson
On Monday 28 May 2007 9:53 am, Detlev Offenbach wrote:
> On Montag, 28. Mai 2007, Detlev Offenbach wrote:
> > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > On Sunday 27 May 2007 1:10 pm, Detlev Offenbach wrote:
> > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > On Sunday 27 May 2007 12:37 pm, Detlev Offenbach wrote:
> > > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > > On Sunday 27 May 2007 11:50 am, Detlev Offenbach wrote:
> > > > > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > > > > On Saturday 26 May 2007 9:07 pm, Detlev Offenbach wrote:
> > > > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > > On Saturday 26 May 2007 7:58 pm, Detlev Offenbach wrote:
> > > > > > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > > > > On Saturday 26 May 2007 4:52 pm, Detlev Offenbach
>
> wrote:
> > > > > > > > > > > > > > Hi,
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > is there a PyQt equivalent to
> > > > > > > > > > > > > > "qobject_cast(object)"?
> > > > > > > > > > > > >
> > > > > > > > > > > > > sip.cast()?
> > > > > > > > > > > > >
> > > > > > > > > > > > > But it shouldn't be necessary if the sub-class
> > > > > > > > > > > > > conversion code has been properly implemented.
> > > > > > > > > > > >
> > > > > > > > > > > > How do I do that. I haven't wrapped complicated stuff
> > > > > > > > > > > > like this so far. The situation is as follows. I have
> > > > > > > > > > > > the following code:
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > self.plugins.extend(self.designer.pluginManager().ins
> > > > > > > > > > > >ta nc es () ) for plugin in self.plugins:
> > > > > > > > > > > > if isinstance(plugin,
> > > > > > > > > > > > QDesignerFormEditorPluginInterface): if not
> > > > > > > > > > > > plugin.isInitialized():
> > > > > > > > > > > > plugin.initialze(self.designer)
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > "self.designer.pluginManager().instances()" returns a
> > > > > > > > > > > > list of QObject. The first if statement shall check,
> > > > > > > > > > > > wether the returned QObject is of type
> > > > > > > > > > > > QDesignerFormEditorPluginInterface. In C++ you would
> > > > > > > > > > > > do it with code like
> > > > > > > > > > > >
> > > > > > > > > > > > if (
> > > > > > > > > > > > (qobject_cast(pl
> > > > > > > > > > > >ug in )) )
> > > > > > > > > > > >
> > > > > > > > > > > > How can the problem be solved with PyQt4 and Python?
> > > > > > > > > > > >
> > > > > > > > > > > > Note: self.designer.pluginManager() returns an object
> > > > > > > > > > > > of type QDesignerPluginManager.
> > > > > > > > > > >
> > > > > > > > > > > The wrapper for QDesignerFormEditorPluginInterface must
> > > > > > > > > > > define some %ConvertToSubClassCode which will use RTTI
> > > > > > > > > > > provided by the instance to identify the right Python
> > > > > > > > > > > type object. See how PyQt does it for QObject and
> > > > > > > > > > > QEvent. If the instance doesn't provide any RTTI then
> > > > > > > > > > > you're stuck.
> > > > > > > > > >
> > > > > > > > > > Mustn't the %ConvertToSubClassCode go into the more
> > > > > > > > > > general class (e.g. QObject)?
> > > > > > > > >
> > > > > > > > > No - just in a QObject sub-class in the module.
> > > > > > > > >
> > > > > > > > > > Is there a way to extend the QObject wrapper?
> > > > > > > > >
> > > > > > > > > That's what sip does under the covers.
> > > > > > > >
> > > > > > > > I am stuck at the moment due to my lack of sip know how.
> > > > > > > > Below is the wrapper code in question. How does the
> > > > > > > > %ConvertToSubClassCode have to be?
> > > > > > > >
> > > > > > > > -
> > > > > > > >-- -- -- -- -- -- -- - class
> > > > > > > > QDesignerFormEditorPluginInterface {
> > > > > > > >
> > > > > > > > %TypeHeaderCode
> > > > > > > > #include 
> > > > > > > > %End
> > > > > > > >
> > > > > > > > public:
> > > > > > > > virtual ~QDesignerFormEditorPluginInterface();
> > > > > > > >
> > > > > > > > virtual bool isInitialized() const = 0;
> > > > > > > > virtual void initialize(QDesignerFormEditorInterface
> > > > > > > > *core) = 0; virtual QAction *action() const = 0;
> > > > > > > >
> > > > > > > > virtual QDesignerFormEditorInterface *core() const = 0;
> > > > > > > > };
> > > > > > > > -
> > > > > > > >-- -- -- -- -- -- --
> > > > > > >
> > > > > > > What RTTI is available for the code to determine what the class
> > > > > > > really is? I can't see anything that is obviously suitable - in
> > > > > > > which case you are stuck.
> > > > > >
> > > > > > In a C++ program one would do it with this statement
> > > > > >
> > > > > > qobject_cast(object)
> > > > > >
> > > > > > where object is a pointer to a QObject. If th

Re: [PyQt] C++ and embedded python, how to share gui thread?

2007-05-28 Thread Michael Olberg
recap: I have python embedded in a C++ Qt application. Running non-gui
python scripts works fine, but using qt from within python hangs the
program. 

I have run my code through strace and it appears that the program hangs
of a futex call which never returns. I have to send a SIGKILL to make it
abort.

I also have to correct my previous statement concerning Ubuntu Feisty. I
get the same problem there as with Debian Etch, it was an old binary
that I could make to work on Feisty.

/Michael

On Fri, 2007-05-25 at 08:30 +0200, Michael Olberg wrote:
> Just a follow-up: on a recently installed Debian etch my old problem is
> back, i.e. a python script trying to open a Qt dialog hangs the C++ Qt
> application where python is embedded. 
> 
> The exactly same program works fine in Ubuntu feisty as reported
> earlier. The application was originally developed under Debian sarge,
> where it also worked, but I had to stick to a particular version of
> python-qt.
> 
> /Michael
> 
> On Thu, 2007-05-17 at 12:19 +0200, Michael Olberg wrote:
> > I have just installed Ubuntu Feisty on my laptop and everything appears to 
> > work 
> > fine again. So consider the problem solved for the moment ;-).
> > 
> > thanks for all advice I received,
> > Michael
> > 
> > Patrick Stinson wrote:
> > > there is only one QApplication. Even in apps where you are writing a
> > > graphical plugin that will be used in a native event loop, you have to
> > > manage one QApplication instance. So, if your C++ app created a
> > > QApplication then you don't have to worry about it just create the
> > > PyQt widgets at will. This will all work the best if the qt lib you
> > > are using is a shared library or dll, because you don't want to link
> > > it in twice; once with the C++ app and once with the PyQt4 module.
> > > 
> > > I Hope that helps a little. I have more info on how I did the same thing 
> > > here:
> > > 
> > > http://www.patrickkidd.com/pk/trac/wiki/EmbeddedPythonWidgets
> > > 
> > > On 5/16/07, Michael Olberg <[EMAIL PROTECTED]> wrote:
> > >> Dear all,
> > >>
> > >> I have a scientific application programmed in C++ with the Qt widget 
> > >> set. I have
> > >> embedded a Python interpreter to allow me to control the application via
> > >> scripts. I can even import the python-qt bindings in those scripts and 
> > >> create
> > >> graphical dialogs. So at present everything works(!) as expected.
> > >>
> > >> However, this works with an old setup of Debian sarge and the
> > >> python2.3-qt3_3.11-4_i386.deb package. A number of upgrades have 
> > >> happened since
> > >> then, with python, with qt, and even with Debian. With newer versions
> > >> non-graphical scripts still work, but any attempt to open Qt dialogs 
> > >> from the
> > >> embedded python interpreter hangs the application.
> > >>
> > >> It appears to me that this has to do with how later versions of the 
> > >> python-qt
> > >> package access the main Qt GUI thread, which in my case is already 
> > >> started by
> > >> the underlying C++ application.
> > >>
> > >> I wonder if this is documented somewhere, with an example on how to 
> > >> start the
> > >> python interpreter so that the C++ and python can share the same Qt 
> > >> GUI? I'd
> > >> very much like to upgrade my system without breaking this application, 
> > >> which I
> > >> use for daily work.
> > >>
> > >> any info appreciated,
> > >> Michael
> > >> ___
> > >> PyQt mailing listPyQt@riverbankcomputing.com
> > >> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> > >>
> > > 
> > > 
> > 

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] PyQt4 question (follow on)

2007-05-28 Thread Detlev Offenbach
On Montag, 28. Mai 2007, Phil Thompson wrote:
> On Monday 28 May 2007 9:53 am, Detlev Offenbach wrote:
> > On Montag, 28. Mai 2007, Detlev Offenbach wrote:
> > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > On Sunday 27 May 2007 1:10 pm, Detlev Offenbach wrote:
> > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > On Sunday 27 May 2007 12:37 pm, Detlev Offenbach wrote:
> > > > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > > > On Sunday 27 May 2007 11:50 am, Detlev Offenbach wrote:
> > > > > > > > > On Sonntag, 27. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > On Saturday 26 May 2007 9:07 pm, Detlev Offenbach wrote:
> > > > > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > > > On Saturday 26 May 2007 7:58 pm, Detlev Offenbach 
wrote:
> > > > > > > > > > > > > On Samstag, 26. Mai 2007, Phil Thompson wrote:
> > > > > > > > > > > > > > On Saturday 26 May 2007 4:52 pm, Detlev Offenbach
> >
> > wrote:
> > > > > > > > > > > > > > > Hi,
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > is there a PyQt equivalent to
> > > > > > > > > > > > > > > "qobject_cast(object)"?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > sip.cast()?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > But it shouldn't be necessary if the sub-class
> > > > > > > > > > > > > > conversion code has been properly implemented.
> > > > > > > > > > > > >
> > > > > > > > > > > > > How do I do that. I haven't wrapped complicated
> > > > > > > > > > > > > stuff like this so far. The situation is as
> > > > > > > > > > > > > follows. I have the following code:
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > self.plugins.extend(self.designer.pluginManager().i
> > > > > > > > > > > > >ns ta nc es () ) for plugin in self.plugins:
> > > > > > > > > > > > > if isinstance(plugin,
> > > > > > > > > > > > > QDesignerFormEditorPluginInterface): if not
> > > > > > > > > > > > > plugin.isInitialized():
> > > > > > > > > > > > > plugin.initialze(self.designer)
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > "self.designer.pluginManager().instances()" returns
> > > > > > > > > > > > > a list of QObject. The first if statement shall
> > > > > > > > > > > > > check, wether the returned QObject is of type
> > > > > > > > > > > > > QDesignerFormEditorPluginInterface. In C++ you
> > > > > > > > > > > > > would do it with code like
> > > > > > > > > > > > >
> > > > > > > > > > > > > if (
> > > > > > > > > > > > > (qobject_cast(
> > > > > > > > > > > > >pl ug in )) )
> > > > > > > > > > > > >
> > > > > > > > > > > > > How can the problem be solved with PyQt4 and
> > > > > > > > > > > > > Python?
> > > > > > > > > > > > >
> > > > > > > > > > > > > Note: self.designer.pluginManager() returns an
> > > > > > > > > > > > > object of type QDesignerPluginManager.
> > > > > > > > > > > >
> > > > > > > > > > > > The wrapper for QDesignerFormEditorPluginInterface
> > > > > > > > > > > > must define some %ConvertToSubClassCode which will
> > > > > > > > > > > > use RTTI provided by the instance to identify the
> > > > > > > > > > > > right Python type object. See how PyQt does it for
> > > > > > > > > > > > QObject and QEvent. If the instance doesn't provide
> > > > > > > > > > > > any RTTI then you're stuck.
> > > > > > > > > > >
> > > > > > > > > > > Mustn't the %ConvertToSubClassCode go into the more
> > > > > > > > > > > general class (e.g. QObject)?
> > > > > > > > > >
> > > > > > > > > > No - just in a QObject sub-class in the module.
> > > > > > > > > >
> > > > > > > > > > > Is there a way to extend the QObject wrapper?
> > > > > > > > > >
> > > > > > > > > > That's what sip does under the covers.
> > > > > > > > >
> > > > > > > > > I am stuck at the moment due to my lack of sip know how.
> > > > > > > > > Below is the wrapper code in question. How does the
> > > > > > > > > %ConvertToSubClassCode have to be?
> > > > > > > > >
> > > > > > > > > ---
> > > > > > > > >-- -- -- -- -- -- -- -- - class
> > > > > > > > > QDesignerFormEditorPluginInterface {
> > > > > > > > >
> > > > > > > > > %TypeHeaderCode
> > > > > > > > > #include 
> > > > > > > > > %End
> > > > > > > > >
> > > > > > > > > public:
> > > > > > > > > virtual ~QDesignerFormEditorPluginInterface();
> > > > > > > > >
> > > > > > > > > virtual bool isInitialized() const = 0;
> > > > > > > > > virtual void initialize(QDesignerFormEditorInterface
> > > > > > > > > *core) = 0; virtual QAction *action() const = 0;
> > > > > > > > >
> > > > > > > > > virtual QDesignerFormEditorInterface *core() const = 0;
> > > > > > > > > };
> > > > > > > > > ---
> > > > > > > > >-- -- -- -- -- -- -- --
> > > > > > > >
> > > > > > > > What RTTI is available for the code to determine what the
> > > > > > > > class really is? I can't see any

[PyQt] [Errno 4] Interrupted system call

2007-05-28 Thread Jeremy Moskovich

Hi,
I'm having consistent problems using the python subprocess module in 
PyQT applications.


os.read() & os.wait() calls seem to be interrupted intermittently, in a 
manner similar to the following stack trace:


File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py", 
line 593, in __init__

errread, errwrite)
File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py", 
line 1046, in _execute_child

data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
OSError: [Errno 4] Interrupted system call

The only mention I could find about this online is at: 
http://mail.python.org/pipermail/python-list/2007-February/427031.html 
which just recommends retrying the operation.


Does anyone know what the root of this problem is? How can it be solved 
effectively?


Thanks and best regards,
Jeremy


smime.p7s
Description: S/MIME Cryptographic Signature
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] [Errno 4] Interrupted system call

2007-05-28 Thread Arve Knudsen

Hi Jeremy

On 5/28/07, Jeremy Moskovich <[EMAIL PROTECTED]> wrote:


Hi,
I'm having consistent problems using the python subprocess module in
PyQT applications.

os.read() & os.wait() calls seem to be interrupted intermittently, in a
manner similar to the following stack trace:

File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py",
line 593, in __init__
errread, errwrite)
File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py",
line 1046, in _execute_child
data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
OSError: [Errno 4] Interrupted system call

The only mention I could find about this online is at:
http://mail.python.org/pipermail/python-list/2007-February/427031.html
which just recommends retrying the operation.



I've never experienced an interruption during the construction of a Popen
object, which seems to be the case here. Calls to Popen.wait, on the
other hand,
did get interrupted all the time on OS X (no idea why), so I had to catch
EINTR and retry. Are you using the very latest Python though? I have version
2.5.1 on Ubuntu, and from browsing subprocess.py I see that os.read is now
wrapped, so that the operation is always retried upon EINTR.

Hope this helps,
Arve
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] [Errno 4] Interrupted system call

2007-05-28 Thread Ismail Dönmez
On Monday 28 May 2007 18:54:47 Jeremy Moskovich wrote:
> Hi,
> I'm having consistent problems using the python subprocess module in
> PyQT applications.
>
> os.read() & os.wait() calls seem to be interrupted intermittently, in a
> manner similar to the following stack trace:
>
> File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py",
> line 593, in __init__
> errread, errwrite)
> File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py",
> line 1046, in _execute_child
> data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
> OSError: [Errno 4] Interrupted system call
>
> The only mention I could find about this online is at:
> http://mail.python.org/pipermail/python-list/2007-February/427031.html
> which just recommends retrying the operation.
>
> Does anyone know what the root of this problem is? How can it be solved
> effectively

You might want to try the following patch  
http://librarian.launchpad.net/6820347/subprocess-eintr-safety.patch . The 
bug report is @ 
http://sourceforge.net/tracker/index.php?func=detail&aid=1068268&group_id=5470&atid=105470


/ismail

-- 
Perfect is the enemy of good


signature.asc
Description: This is a digitally signed message part.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] [Errno 4] Interrupted system call

2007-05-28 Thread Arve Knudsen

Aha, so Ubuntu's version _is_ patched :)

Arve

On 5/28/07, Ismail Dönmez <[EMAIL PROTECTED]> wrote:


On Monday 28 May 2007 18:54:47 Jeremy Moskovich wrote:
> Hi,
> I'm having consistent problems using the python subprocess module in
> PyQT applications.
>
> os.read() & os.wait() calls seem to be interrupted intermittently, in a
> manner similar to the following stack trace:
>
> File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py",
> line 593, in __init__
> errread, errwrite)
> File "/homes/jeremym/programs/python2.5/lib/python2.5/subprocess.py",
> line 1046, in _execute_child
> data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
> OSError: [Errno 4] Interrupted system call
>
> The only mention I could find about this online is at:
> http://mail.python.org/pipermail/python-list/2007-February/427031.html
> which just recommends retrying the operation.
>
> Does anyone know what the root of this problem is? How can it be solved
> effectively

You might want to try the following patch
http://librarian.launchpad.net/6820347/subprocess-eintr-safety.patch . The
bug report is @

http://sourceforge.net/tracker/index.php?func=detail&aid=1068268&group_id=5470&atid=105470


/ismail

--
Perfect is the enemy of good

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt