Browse Source

Python 2.5 don't have 'setter' decoration, so we change this to property()

master
Julio Biason 15 years ago
parent
commit
618086eb3d
  1. 7
      mitterlib/ui/helpers/gtk_messagegrid.py
  2. 8
      mitterlib/ui/helpers/gtk_updatebox.py

7
mitterlib/ui/helpers/gtk_messagegrid.py

@ -74,17 +74,16 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject):
gobject.TYPE_NONE, gobject.TYPE_NONE,
(gobject.TYPE_PYOBJECT, ))} (gobject.TYPE_PYOBJECT, ))}
@property def _get_count(self):
def count(self):
"""Number of unread messages.""" """Number of unread messages."""
return self._message_count return self._message_count
@count.setter def _set_count(self, messages):
def count(self, messages):
"""Update the number of unread messages.""" """Update the number of unread messages."""
self._message_count = messages self._message_count = messages
self.emit('count-changed', messages) self.emit('count-changed', messages)
return return
count = property(_get_count, _set_count)
@property @property
def selected(self): def selected(self):

8
mitterlib/ui/helpers/gtk_updatebox.py

@ -130,8 +130,7 @@ class UpdateBox(gtk.VBox):
self._update_status.set_text(text) self._update_status.set_text(text)
return True return True
@property def _get_text(self):
def text(self):
"""Return the text in the update box.""" """Return the text in the update box."""
text_buffer = self._text.get_buffer() text_buffer = self._text.get_buffer()
@ -140,14 +139,15 @@ class UpdateBox(gtk.VBox):
return text_buffer.get_text(start, end, include_hidden_chars=False) return text_buffer.get_text(start, end, include_hidden_chars=False)
@text.setter def _set_text(self, text):
def text(self, text):
"""Set the textarea text.""" """Set the textarea text."""
self._text.get_buffer().set_text(text) self._text.get_buffer().set_text(text)
return return
text = property(_get_text, _set_text)
def _set_pixbuf(self, pixbuf): def _set_pixbuf(self, pixbuf):
"""Update the avatar pixbuf.""" """Update the avatar pixbuf."""
_log.debug('Avatar set')
self.avatar.set_from_pixbuf(pixbuf) self.avatar.set_from_pixbuf(pixbuf)
# pixbuf can only be set, not get. # pixbuf can only be set, not get.
pixbuf = property(None, _set_pixbuf) pixbuf = property(None, _set_pixbuf)

Loading…
Cancel
Save