[PyKDE] sip wrapping problem

Hans-Peter Jansen hpj at urpla.net
Fri Dec 20 23:48:01 GMT 2002


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])


# 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.)

TIA,
Hans-Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtiffhandler-0.0.0.tar.gz
Type: application/x-tgz
Size: 10149 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20021220/fb998654/qtiffhandler-0.0.0.tar.bin


More information about the PyQt mailing list