[PyQt] regression from 4.4.x to 4.5.x when passing enum arguments?

Phil Thompson phil at riverbankcomputing.com
Tue Jul 21 22:44:12 BST 2009


On Tue, 21 Jul 2009 22:09:09 +0200, Gerard Vermeulen <gav451 at gmail.com>
wrote:
> Phil,
> 
> I have the following SIP specification :
> 
> class QwtScaleTransformation
> {
> %TypeHeaderCode
> #include <qwt_scale_map.h>
> %End // %TypeHeaderCode
> 
> public:
>     enum Type {
>         Linear,
>         Log10,
>         Other
>     }; // enum Type
> 
>     QwtScaleTransformation(QwtScaleTransformation::Type);
>     virtual ~QwtScaleTransformation();
>     virtual double xForm(double, double, double, double, double) const;
>     virtual double invXForm(double, double, double, double, double)
const;
>     QwtScaleTransformation::Type type() const;
>     virtual QwtScaleTransformation* copy() const /Factory/;
> 
> private:
>     QwtScaleTransformation(const QwtScaleTransformation&);
> 
> }; // class QwtScaleTransformation
> 
> and when using the constructor in Python, I get the following traceback:
> 
> Traceback (most recent call last):
>   File "zarko.py", line 20, in transformation
>     y = LoadScaleTransformation()
>   File "zarko.py", line 30, in __init__
>    
Qwt.QwtScaleTransformation.__init__(Qwt.QwtScaleTransformation.Linear)
> TypeError: descriptor '__init__' requires a 'sip.simplewrapper' object
> but received a 'Type'
> 
> I suspect that this was working with PyQt-4.4.x and the corresponding
> version of SIP, because this statement comes from a bug report of a
> PyQwt user using Ubuntu Jaunty and the problem is somewhere else.

You aren't passing self...

Phil


More information about the PyQt mailing list