bigboard r7259 - in trunk/bigboard: . stocks/people
- From: otaylor svn gnome org
- To: svn-commits-list gnome org
- Subject: bigboard r7259 - in trunk/bigboard: . stocks/people
- Date: Tue, 19 Feb 2008 22:10:57 +0000 (GMT)
Author: otaylor
Date: Tue Feb 19 22:10:57 2008
New Revision: 7259
URL: http://svn.gnome.org/viewvc/bigboard?rev=7259&view=rev
Log:
people_tracker.py: Remove workaround for custom hashing of Resource
now that Resource is fixed to not do that. The removal of the
custom hash also fixes another bug in this code: we were getting
stuck buddy objects from previous connection generations.
peoplewidgets.py: Add sort-changed signal to People tracker,
disconnect connections when an item is destroyed.
PeopleStock.py peoplebrowser.py: Use sort-changed signal, instead
of manual connections (lack of proper disconnection was causing
warnings and misbehavior.)
Modified:
trunk/bigboard/people_tracker.py
trunk/bigboard/stocks/people/PeopleStock.py
trunk/bigboard/stocks/people/peoplebrowser.py
trunk/bigboard/stocks/people/peoplewidgets.py
Modified: trunk/bigboard/people_tracker.py
==============================================================================
--- trunk/bigboard/people_tracker.py (original)
+++ trunk/bigboard/people_tracker.py Tue Feb 19 22:10:57 2008
@@ -460,19 +460,14 @@
self.status = status
self.emit('status-changed')
- # Resource is defined to hash/equal based on the ID, but we actually
- # want to treat Person objects on reconnection to the server as different
- # from Person objects from the previous connection, so we use id()
- # 'is', rather than hash() and and '=='
- #
def __hash__(self):
- return id(self.resource)
+ return hash(self.resource)
def __eq__(self, other):
if isinstance(other, Person):
- return self.resource is other.resource
+ return self.resource == other.resource
else:
- return self.resource is other
+ return self.resource == other
class PersonSet(gobject.GObject):
"""A list of Person objects with change notification
Modified: trunk/bigboard/stocks/people/PeopleStock.py
==============================================================================
--- trunk/bigboard/stocks/people/PeopleStock.py (original)
+++ trunk/bigboard/stocks/people/PeopleStock.py Tue Feb 19 22:10:57 2008
@@ -75,13 +75,11 @@
box.remove(item)
box.insert_sorted(item, hippo.PACK_IF_FITS, lambda a,b: sort_people(a.person, b.person))
- person.connect('status-changed', resort)
- person.connect('online-changed', resort)
- person.connect('display-name-changed', resort)
+ item.connect('sort-changed', resort)
+ item.connect('activated', self.__handle_item_pressed)
map[person] = item
self.__set_item_size(item, self.get_size())
- item.connect('activated', self.__handle_item_pressed)
def __remove_person(self, person, box, map):
_logger.debug("person removed from people stock %s", person.display_name)
Modified: trunk/bigboard/stocks/people/peoplebrowser.py
==============================================================================
--- trunk/bigboard/stocks/people/peoplebrowser.py (original)
+++ trunk/bigboard/stocks/people/peoplebrowser.py Tue Feb 19 22:10:57 2008
@@ -63,9 +63,7 @@
self.remove(item)
self.add_column_item(section, item, lambda a,b: sort_people(a.person, b.person))
- person.connect('status-changed', resort)
- person.connect('online-changed', resort)
- person.connect('display-name-changed', resort)
+ item.connect('sort-changed', resort)
self.__update_visibility(section, item)
Modified: trunk/bigboard/stocks/people/peoplewidgets.py
==============================================================================
--- trunk/bigboard/stocks/people/peoplewidgets.py (original)
+++ trunk/bigboard/stocks/people/peoplewidgets.py Tue Feb 19 22:10:57 2008
@@ -76,6 +76,11 @@
self.set_property('text', message)
class PersonItem(PhotoContentItem):
+ __gsignals__ = {
+ 'sort-changed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
+ 'destroy': 'override',
+ }
+
def __init__(self, person, themed=False, **kwargs):
PhotoContentItem.__init__(self, **kwargs)
self.person = person
@@ -128,17 +133,27 @@
user.connect(self.__update_current_track, 'currentTrack')
user.connect(self.__update_current_track, 'currentTrackPlayTime')
self.__update_current_track(user)
+
+ self.__handlers = []
+
+ self.__handlers.append(self.person.connect('status-changed', self.__emit_sort_changed))
+ self.__handlers.append(self.person.connect('online-changed', self.__emit_sort_changed))
+ self.__handlers.append(self.person.connect('display-name-changed', self.__emit_sort_changed))
- self.person.connect('display-name-changed', self.__update)
- self.person.connect('icon-url-changed', self.__update)
+ self.__handlers.append(self.person.connect('display-name-changed', self.__update))
+ self.__handlers.append(self.person.connect('icon-url-changed', self.__update))
- self.person.connect('aim-buddies-changed', self.__update_aim_buddy)
- self.person.connect('xmpp-buddies-changed', self.__update_xmpp_buddy)
+ self.__handlers.append(self.person.connect('aim-buddies-changed', self.__update_aim_buddy))
+ self.__handlers.append(self.person.connect('xmpp-buddies-changed', self.__update_xmpp_buddy))
self.__update(self.person)
self.__update_aim_buddy(self.person)
self.__update_xmpp_buddy(self.person)
+ def do_destroy(self):
+ for handler_id in self.__handlers:
+ self.person.disconnect(handler_id)
+
def __update_color(self):
if self.__pressed:
self.set_property('background-color', 0x00000088)
@@ -227,8 +242,6 @@
current_track = None
current_track_play_time = -1
- _logger.debug("current track %s" % str(current_track))
-
# current_track_play_time < 0, current_track != None might indicate stale
# current_track data
if current_track_play_time < 0:
@@ -285,6 +298,9 @@
new_contents = self.__statuses[0][1]
new_contents.set_visible(True)
+ def __emit_sort_changed(self):
+ self.emit('sort-changed')
+
def get_screen_coords(self):
return self.get_context().translate_to_screen(self)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]