[PyKDE] sip wrapping problem
Phil Thompson
phil at river-bank.demon.co.uk
Sat Dec 21 00:44:01 GMT 2002
On Friday 20 December 2002 10:47 pm, Hans-Peter Jansen wrote:
> Hi *,
>
> while trying to wrap a Qt TiffHandler class in order to be able
> to load and display facsimiles from PyQt, I stumbled across
> this problem: on import of the wrapped class, it blocks after
> loading this module:
> open("/usr/lib/python2.2/site-packages/qth/qth.py", O_RDONLY|O_LARGEFILE) =
> 3
>
> created by sip (a bit outdated, I know): << EOF
> # Python wrapper code.
> #
> # Generated by SIP snapshot-20021114 (build 50) on Fri Dec 20 21:58:32 2002
>
> import libsip
>
> from qt import QObject
>
> PYQTH_VERSION = "0.0.0"
> import types
> import libqthc
>
> libqthc.sipInitModule(__name__)
>
> class QTIFFHandler(QObject):
> def __init__(self,*args,**kwargs):
> libqthc.sipCallCtor(0,self,args)
> for key in kwargs.keys():
> method = getattr(self, key)
> if type(kwargs[key]) == types.TupleType:
> apply(method,kwargs[key])
> else:
> method(kwargs[key])
Where does the keyword code come from?
> # Register the classes with the C++ module.
>
> libqthc.sipRegisterClasses()
>
> EOF
>
> generated from this sip file: << EOF
>
> %Module qth
>
> %PrePythonCode
> PYQTH_VERSION = "0.0.0"
> %End
>
> %Import qtmod.sip
>
> class QTIFFHandler : QObject
> {
> %HeaderCode
> #include <qtiffhandler.h>
> #include <qobject.h>
> #include <qpixmap.h>
> #include <qptrlist.h>
> %End
>
> public:
> enum Resolution {
> Undefined,
> Fine,
> Normal
> };
>
> QTIFFHandler(QLabel *, QWidget */TransferThis/ = 0, const char * = 0);
>
> int load(const char *);
> void close();
> void setSmoothScale(bool);
> bool smoothScale();
> void setPage(int);
> void scale(float);
> void rotate(double);
> int page();
> int pages();
> float zoom();
> QString sender();
> QString time();
> Resolution resolution();
> const char *filename();
> QPixmap *currentPage();
> signals:
> void update();
> private:
> QTIFFHandler(const QTIFFHandler &);
> };
>
> EOF
>
> I managed to mangle PyQwts setup.py to properly generate this module,
> but maybe I failed in some mysterious ways... Archive with Makefile
> attached. (I know, this package suffers from a couple of flaws, but
> I'm trying to get _something_ to work before starting to refine this
> thing.)
The .sip file looks Ok. Have you tried debugging the generated code to see
where it is blocking?
Phil
More information about the PyQt
mailing list