[PyQt] noob woes (but still making progress)

Jason Hihn jason at eyemaginations.com
Tue May 15 22:37:09 BST 2007


Well my question is because %TypeHeaderCode is only usable in a class
definition. So, I can't do a global %TypeHeaderCode, and have it apply to
all classes in the file. So I do not know that using the same
%TypeHeaderCode multiple times for the same .h file is legal.

Also, I am not clear on %Import vs %Include. What is the difference between
%importing a sip and %Including it?


-----Original Message-----
From: Phil Thompson [mailto:phil at riverbankcomputing.co.uk] 
Sent: Tuesday, May 15, 2007 5:16 PM
To: pyqt at riverbankcomputing.com; jason at eyemaginations.com
Subject: Re: [PyQt] noob woes (but still making progress)

On Tuesday 15 May 2007 7:50 pm, Jason Hihn wrote:
> Ok, I have several questions.
>
>
>
> I probably have a sub-optimal set of headers. Is there a limitation of one
> class per header? How do we generate .sip files for .h that contain
several
> classes? i.e.:
>
> aaa.h:
>
> class aaa{};
>
> class bbb{};
>
> aaa.sip
>
> class aaa:
>
> %TypeHeaderCode
>
> #include aaa.h
>
> %End
>
> class bbb:
>
> %TypeHeaderCode
>
> #include aaa.h //<- is this ok?
>
> %End

SIP doesn't place any restrictions on how many classes are defined in a .sip

file. Normal practice is to have one .sip file for each .h file.

> Secondly, how do we generate a package say, File.pyd, that contains all
the
> classes that class A relies on?
>
> aaa.h includes ccc.h, so class CCC needs to be wrapped, which includes
> ddd.h, which also needs to be wrapped. Which is ok, and I get aaa to be
> wrapped, but in the python interpreter it fails on import saying that ccc
> module is missing.

You run SIP on a .sip file. If your classes are split across multiple .sip 
files then make sure they are %Include'd by the .sip file you pass to SIP - 
see the docs.

Phil



More information about the PyQt mailing list