[PyKDE] Re: Static compilation of PyQt

Christophe Cavalaria chris.cavalaria at free.fr
Fri Mar 3 11:22:42 GMT 2006


Giovanni Bajo wrote:

> Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> 
>> 1. Changing the API isn't acceptable, "import qttable" must continue
>> to work.
> 
> I tried adding qttable.py which simply contained "from qt import *". I
> found out that the main breakage still happens because, since qt contains
> all the symbols, people just import qt and forget about importing the
> other modules. This is something which can't be "manually" cured. Surely
> SIP could create a "qt.py" wrapper around qt.pyd which imports only the
> symbols originally contained in qtmod, but you can see that I couldn't do
> this manually :)

There's one possible solution for that. There will be some breakage but in a
controlled way. Instead of generating a file called qt.pyd, generate a file
qtstatic.pyd and import it like that in the main script :

import qtstatic
qtstatic.initialize()

The function initialize can either create all the qt top modules, or maybe
it can add an import hook which will then override all the qt imports and
make them work as expected.

Well, you get the idea I bet :) Once the static qt version is initialized,
all the standard qt code should work.




More information about the PyQt mailing list