diff --git a/etg/gdicmn.py b/etg/gdicmn.py index 58414a33..41befec1 100644 --- a/etg/gdicmn.py +++ b/etg/gdicmn.py @@ -306,10 +306,16 @@ def run(): c.addItem(etgtools.WigCode("""\ wxRealPoint operator+(const wxRealPoint& other); wxRealPoint operator-(const wxRealPoint& other); - wxRealPoint operator*(double d); wxRealPoint operator/(int i); """)) + # wxRealPoint::operator* truncates to int before assigning to the new point + # object, which seems dumb. So let's make our own implementation which + # preserves the floating point result. + c.addCppMethod('wxRealPoint*', '__mul__', '(double d)', isSlot=True, + body="""\ + return new wxRealPoint(self->x * d, self->y * d); + """) # wxRealPoint typemap c.convertFromPyObject = tools.convertTwoDoublesTemplate('wxRealPoint') diff --git a/etgtools/extractors.py b/etgtools/extractors.py index ffdffac7..86627bd7 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -1236,6 +1236,7 @@ class CppMethodDef(MethodDef): self.cppSignature = cppSignature self.virtualCatcherCode = virtualCatcherCode self.isCore = _globalIsCore + self.isSlot = False self.__dict__.update(kw) @staticmethod diff --git a/etgtools/sip_generator.py b/etgtools/sip_generator.py index 7c503ac0..be5e4aea 100644 --- a/etgtools/sip_generator.py +++ b/etgtools/sip_generator.py @@ -865,7 +865,11 @@ from .%s import * else: if pnames: pnames = ', ' + pnames - stream.write('%s(sipCpp%s);\n' % (fname, pnames)) + if method.isSlot: + argname = 'a0' + else: + argname = 'sipCpp' + stream.write('%s(%s%s);\n' % (fname, argname, pnames)) else: stream.write('%s(%s);\n' % (fname, pnames)) stream.write('%sPy_END_ALLOW_THREADS\n' % (indent+' '*4))