r6956 - in bigboard/trunk/bigboard: . stocks/people



Author: hp
Date: 2007-12-04 15:49:38 -0600 (Tue, 04 Dec 2007)
New Revision: 6956

Modified:
   bigboard/trunk/bigboard/people_tracker.py
   bigboard/trunk/bigboard/stocks/people/peoplewidgets.py
Log:
try to fix current track display, though it seems nobody on dogfood is playing anything, so not sure. Fix the Mugshot home url link.

Modified: bigboard/trunk/bigboard/people_tracker.py
===================================================================
--- bigboard/trunk/bigboard/people_tracker.py	2007-12-04 21:25:01 UTC (rev 6955)
+++ bigboard/trunk/bigboard/people_tracker.py	2007-12-04 21:49:38 UTC (rev 6956)
@@ -40,6 +40,8 @@
         self.resource = resource
         self.is_contact = self.resource.class_id == "http://online.gnome.org/p/o/contact";
 
+        # self._debug_rank = -100
+
         if self.is_contact:
             self.resource.connect(self.__contact_name_changed, "name")
             self.resource.connect(self.__contact_aims_changed, "aims")
@@ -498,6 +500,21 @@
     else:
         return RANK_BUDDY_OFFLINE
 
+# import libbig.gutil
+# rank_changed_list = []
+# def rank_changed_idle():
+#     global rank_changed_list
+#     for person in rank_changed_list:
+#         person.emit("display-name-changed")
+#     rank_changed_list = []
+
+# def debug_change_rank(person, rank):
+#     global rank_changed_list
+#     if rank != person._debug_rank:
+#         person._debug_rank = rank
+#         rank_changed_list.append(person)
+#         libbig.gutil.call_idle_once(rank_changed_idle)
+
 def sort_people(a, b):
 
     rankA = 0
@@ -513,6 +530,9 @@
     else:
         rankB = __get_buddy_rank(b)
 
+    #debug_change_rank(a, rankA)
+    #debug_change_rank(b, rankB)
+
     if rankA != rankB:
         return rankB - rankA
 

Modified: bigboard/trunk/bigboard/stocks/people/peoplewidgets.py
===================================================================
--- bigboard/trunk/bigboard/stocks/people/peoplewidgets.py	2007-12-04 21:25:01 UTC (rev 6955)
+++ bigboard/trunk/bigboard/stocks/people/peoplewidgets.py	2007-12-04 21:49:38 UTC (rev 6956)
@@ -1,6 +1,7 @@
 import cgi
 import os
 import time
+import logging
 
 import gobject
 import gtk
@@ -13,6 +14,8 @@
 
 from ddm import DataModel
 
+_logger = logging.getLogger("bigboard.stocks.PeopleStock")
+
 STATUS_MUSIC = 0
 
 def _open_aim(aim):
@@ -81,7 +84,6 @@
 
             if user:
                 query = model.query_resource(user, "currentTrack +;currentTrackPlayTime")
-                query.add_handler(self.__update_current_track)
                 query.execute()
 
                 user.connect(self.__update_current_track, 'currentTrack')
@@ -161,17 +163,19 @@
 
     def __timeout_track(self):
         self.__current_track_timeout = None
-        self.__update_current_track(self.person.resource)
+        self.__update_current_track(self.person.resource.user)
         return False
 
-    def __update_current_track(self, person):
+    def __update_current_track(self, user):
         try:
-            current_track = self.person.resource.currentTrack
-            current_track_play_time = self.person.resource.currentTrackPlayTime / 1000.
+            current_track = user.currentTrack
+            current_track_play_time = user.currentTrackPlayTime / 1000.
         except AttributeError:
             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:
@@ -185,7 +189,7 @@
                 endTime = current_track_play_time + current_track.duration / 1000. # msec => sec
 
             if now >= endTime:
-                current_track = None
+               current_track = None
 
         if current_track != self.__current_track:
             self.__current_track = current_track
@@ -630,7 +634,7 @@
 
     def __on_activate_web(self, canvas_item):
         self.emit("close")
-        libbig.show_url(self.person.resource.homeUrl)
+        libbig.show_url(self.person.resource.user.homeUrl)
 
     def __on_activate_email(self, canvas_item):
         self.emit("close")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]