After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 325453 - support for Python properties
support for Python properties
Status: RESOLVED DUPLICATE of bug 81879
Product: pygtk
Classification: Bindings
Component: gtk
2.6.x
Other All
: Normal enhancement
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-01 17:24 UTC by Sebastian Rittau
Modified: 2006-01-02 04:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Rittau 2006-01-01 17:24:43 UTC
Currently the way to access the properties of pygtk objects is to either use the get_property()/set_property() methods or the appropriate accessor methods. It would be nice if pygtk could support Python properties as introduced in Python 2.2. This way a more "natural" access of properties is possible. For example with gtk.SpinButton, properties could be implemented like this:

  class SpinButton(gtk.Entry):
      ...

      # Since SpinButton does not expose get_climb_rate() and set_climb_rate() methods,
      # define them as private:

      def __get_climb_rate(self):
          return self.adjustment.climb_rate

      def __set_climb_rate(self, climb_rate):
          self.adjustment.climb_rate = climb_rate

      ...

      # Properties

      adjustment = property(get_adjustment, set_adjustment, None, "Docstring ...")
      climb_rate = property(__get_climb_rate, __set_climb_rate, None, "Docstring ...")
      digits = property(get_digits, set_digits, None, "Docstring ...")
      ...

Long term, get_property()/set_property() as well as the getter/setter methods could be deprecated.
Comment 1 John Ehresman 2006-01-02 04:15:43 UTC
Properties are exposed via self.props in fairly recent pygtk releases

*** This bug has been marked as a duplicate of 81879 ***