PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 900 - QtCore.Property as decorator
: QtCore.Property as decorator
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtCore
: 1.0.4
: All All
: P4 enhancement
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-06-26 19:13 EEST by Sebastian Wiesner
Modified: 2011-08-23 00:35 EEST (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Wiesner 2011-06-26 19:13:31 EEST
PySide.QtCore.Property should work as decorator, just like
PyQt.QtCore.pyqtProperty [1]

[1]
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qt_properties.html#defining-new-qt-properties
Comment 1 Hugo Parente Lima 2011-06-27 21:08:42 EEST
Would be a good enhancement IMO.
Comment 2 Hereldar 2011-07-20 20:29:50 EEST
If it helps, this is the pure Python implementation:

class Property(object):

    def __init__(self, fget=None, fset=None, fdel=None, doc=None):
        self.fget = fget
        self.fset = fset
        self.fdel = fdel
        self.__doc__ = doc

    ...

    @classmethod
    def getter(cls, funcobj):
        return cls(funcobj, doc=funcobj.__doc__)

    def setter(self, funcobj):
        self.fset = funcobj
        return self

    def deleter(self, funcobj):
        self.fdel = funcobj
        return self
Comment 3 renato filho 2011-07-25 17:26:54 EEST
fixed on pyside commit:

commit 5644a87c28c6e82346f057a5c8b524c40a7e94e4
Author: Renato Filho <renato.filho@openbossa.org>
Date:   Fri Jul 22 18:17:47 2011 -0300
Comment 4 renato filho 2011-08-23 00:35:28 EEST
Released on PySide 1.0.6