[PyKDE] Re: embedding python widgets in C++ app

Patrick Stinson patrickkidd.lists at gmail.com
Sat Jan 27 18:38:02 GMT 2007


Well, at the moment everything works (with the exception of the #undef
slots problem) with the python framework that ships with OS X Tiger,
and applying a patch means *moving to* building a custom interpreter
for us. Personally I was very excited about how nailed down and easy
deployment of sip and pyqt became with the qt-4 releases - which was
anything but a selling point before that.

As Miguel says, it would also be a shame that the import name would
change between versions. I know the code is not in the beta stage that
it was when I brought this up before, but I personally think that the
PyQt4 package serves no purpose and should be removed entirely.
Elementtree is becoming (already?) part of the stdlib, and uic and
pyqtconfig should also live at the top level.

BTW, what ever became of the #undef slots problem, Phil? Did you ever
add something for that?

On 1/27/07, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> On Saturday 27 January 2007 10:33 am, Miguel Lobo wrote:
> > > > ok, removing all instances of "PyQt4." from the cpp, and without
> > > > modifying the sip files, I get this error for
> > > > PyRun_SimpleString("import QtCore; print QtCore"):
> > > >
> > > > SystemError: _PyImport_FixupExtension: module QtCore not loaded
> > > >
> > > > and this error for PyRun_SimpleString("import QtGui; print QtGui"):
> > > >
> > > > ImportError: No module named PyQt4.QtCore
> > > >
> > > > After changing the module names in the sip files and recompiling the
> > > > PyQt4 static libs it seems to work. I That means that the PyQt4
> > > > package definately gets in the way.
> > > >
> > > > So this looks fine except everyone on our team has to do this
> > > > everytime they download a new version. Ideas?
> > >
> > > So if I added a command line flag to SIP to ignore all but the last part
> > > of a %Module directive, and tied that flag to the -k flag of PyQt's
> > > configure.py, then it should work Ok?
> >
> > I run into the exact same problem as Patrick a couple of days ago.  I have
> > submitted a patch to the Python team that allows "import PyQt4.QtCore" to
> > work.  You can find the patch here:
> > http://sourceforge.net/tracker/?func=detail&aid=1644818&group_id=5470&atid=
> >305470
> >
> > I would vote against renaming PyQt4.QtCore to QtCore for the statically
> > linked PyQt because then it would mean that you need "from PyQt4 import
> > QtCore" if you have linked PyQt4 dynamically and "import QtCore" if you
> > have linked it statically.  I use static PyQt4 in Windows (for ease of
> > deployment), but in Linux I use the dynamic version, so this solution would
> > be inconvenient for me.
>
> That's a good point - I was only thinking of the embedded case where you often
> do the imports separately.
>
> If your patch doesn't get accepted then I'm happy to host it. As you are
> building a bespoke interpreter anyway it's no great problem to have to apply
> a patch as well.
>
> Phil
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>


-- 
Patrick Kidd Stinson
http://www.patrickkidd.com/
http://pkaudio.sourceforge.net/
http://pksampler.sourceforge.net/




More information about the PyQt mailing list