On Fri, Aug 26, 2011 at 1:53 PM, Markus Hubig <mhu...@imko.de> wrote:
> Hi @all,
> in psep-0104 the use of the use of the decorator style @Property's is
> documented like this:
> class C(QObject):
>
>     def __init__(self):
>         self._x = None
>
>     xChanged = Signal()
>
>     @Property(float, doc="I'm the 'x' property.", notify=xChanged)
>     def x(self):
>         return self._x
>
>     @x.setter
>     def x(self, value):
>         self._x = value
>
> But in my tests I can't give the setter and getter the same name (x).
> So in this example I had to name the setter eg. _x(self, value) to got
> it Working ... got me a while to figure this out! Seems like a bug!?
>

@mydecorator
def method(self):
   pass

is equivalent to

def method(self):
   pass
method = mydecorator(method)

So, your code is reassigning the 'x' name, overwriting the first one.
Changing the second "x" to setX or another name should suffice.


-- 
Lauro Moura
INdT - Instituto Nokia de Tecnologia
_______________________________________________
PySide mailing list
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to