[svn] Try to update the Last string dynamically... doesn't seem to work. immsview
authorfabien
Wed, 04 Feb 2004 17:21:47 -0500
branchimmsview
changeset 17 bef598558a5b
parent 16 894cac760e29
child 18 cce22ab553d1
[svn] Try to update the Last string dynamically... doesn't seem to work.
immsview
--- a/immsview	Wed Feb 04 16:31:45 2004 -0500
+++ b/immsview	Wed Feb 04 17:21:47 2004 -0500
@@ -20,9 +20,12 @@
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-_immsview_version = "$Id: immsview 1698 2004-02-04 21:31:45Z fabien $"
+_immsview_version = "$Id: immsview 1699 2004-02-04 22:21:47Z fabien $"
 
 # $Log$
+# Revision 1.18  2004/02/04 22:21:47  fabien
+# Try to update the Last string dynamically... doesn't seem to work.
+#
 # Revision 1.17  2004/02/04 21:31:45  fabien
 # Update the current song.  This slow down thing a bit (any querying
 # take one to 2 seconds... That's pity!) but it make sure that at least
@@ -237,33 +240,26 @@
         self.set_sort_column_id(-1, 0)
     def default_sort(self, a, b, dummy):
         return 0
-    def tune_to_giter(self, tune, giter = None, curtime = 0):
-        if not curtime:
-            curtime = time.time()
+    def tune_to_giter(self, tune, giter = None):
         if not giter:
             giter = self.append(None)
         self.set(giter,
                  IMMSStore.COL_UID, tune['uid'],
                  IMMSStore.COL_RATING, tune['rating'],
                  IMMSStore.COL_PATH, tune['path'],
-                 IMMSStore.COL_LAST_STR, strtime(curtime-tune['last']),
                  IMMSStore.COL_LAST, tune['last'],
+                 IMMSStore.COL_LAST_STR, strtime(time.time()-tune['last']),
                  IMMSStore.COL_SELECT, gtk.FALSE)
         return giter
     def refresh(self):
-        curtime = time.time()
         col, order = self.get_sort_column_id()
-        # This create a GTK-Critical in GTKListStore which,
-        # however, have no consequences AFAIK.
-        # The doc permit it normally, even without default sort,
-        # elsewhere 
 	if col:
         	self.set_sort_column_id(-1, 0)
         tunes = self.db.get_ratings_and_info()
         self.clear()
 	print time.ctime(time.time()) + ": inserting"
         for tune in tunes:
-            self.tune_to_giter(tune, curtime = curtime)
+            self.tune_to_giter(tune)
 	print time.ctime(time.time()) + ": end insert"
 	if col:
         	self.set_sort_column_id(col, order)
@@ -300,6 +296,13 @@
         if len(tunes) > 0:
             return self.tune_to_giter(tunes[0], giter)
         return giter
+##     def get_value(self, giter, col):
+##         # sniff!  doesn't seem to work! :(
+##         if col == IMMSStore.COL_LAST_STR:
+##             print "translate"
+##             return strtime(time.time() - self.get_value(giter, IMMSStore.COL_LAST))
+##         else:
+##             gtk.ListStore.get_value(self, giter, col)
 
 class IMMSView(gtk.TreeView):
 	def __init__(self, model, xmms):