[PyKDE] SIP & standard X11 includes

Gary Coulbourne GCoulbourne at Immunicon.com
Mon Mar 15 16:32:01 GMT 2004


I'm having trouble that I've been wrestling with for the last couple of days.  I've poured over documentation, wrote and rewrote code, jumped up and down, and reached wits end :).  I'm hoping that some kind soul on the list might be able to offer a suggestion...

I'm using sip version 4.0 (snapshot-20040310-SIP4-182) with PyQt-x11-gpl-snapshot-20040311, and have been having no troubles at all with the included code.  I've written my own library, however, for interfacing with a capture card and displaying the resulting images / converting them to numarrays.  In any case, I decided that the display was too slow and that I should use the Xvideo/XShm extensions to improve the speed.  I've discovered that including the X11 libraries directly in my .h files works fine when I compile the library, but when I compile the generated SIP code, the compile falls apart in an #include nightmare.  Basically pages and pages of this sort of thing scroll by:

In file included from /usr/share/sip/qt/qvariant.sip:201,
                 from sipDVCFormattedImageDisplay.h:57,
                 from sipDVCcmodule.cpp:10:
/usr/lib/qt3/include/qvariant.h:104: error: parse error before `int'
/usr/lib/qt3/include/qvariant.h:121: error: missing ';' before right brace
/usr/lib/qt3/include/qvariant.h:123: error: parse error before `)' token
/usr/lib/qt3/include/qvariant.h:124: error: destructors must be member

Since the library compiles fine, I don't think there's anything wrong with my includes.

Here's the #includes header of the FormattedImageDisplay.h

#include <Python.h>
#include <qframe.h>
#include <qstring.h>
#include <qimage.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xvlib.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/XvMC.h>
#include <X11/extensions/XvMClib.h>

And, the relevant part of the sip config file:

%Module DVC

%Import qt/qtmod.sip

#include <numarray/numarray.h>

class FormattedImageDisplay : QFrame {
#include <FormattedImageDisplay.h>

    FormattedImageDisplay( QWidget * /TransferThis/ = 0, const char * = 0 );

    void setSize(unsigned int,unsigned int);

    int setImageByNumarray( SIP_PYOBJECT );

    QString getXvExtentionVersion();

    public slots:
    void paintEvent( QPaintEvent * );


As you can see, right now, I'm not doing much :).  If I put all of the X11 includes in the .cpp file, everything copiles just keen.  That won't do in the long term, though, because some of the X11 data structures need to be part of the class.

Does anyone have any ideas or suggestions?  They would be /greatly/ appreaciated.



This e-mail message is intended only for the personal use of the recipient(s) named above. This message should be considered a confidential communication, and as such is not subject to disclosure to anyone who is not an intended recipient.  If you are not an intended recipient, you may not legally review, copy or distribute this message. If you have received this communication in error, please notify the sender(s) immediately by e-mail and delete the original message from your computer system.

More information about the PyQt mailing list