just recalc length of visible entries in movie selection
[enigma2.git] / lib / python / Components / MovieList.py
index dcd99feacc8fd4f698f35dc42256994af1794310..45a34fb967f0c22b42461916004acc3ed97f7ee1 100644 (file)
@@ -17,6 +17,7 @@ class MovieList(GUIComponent):
                self.l.setFont(1, gFont("Regular", 18))
                self.l.setFont(2, gFont("Regular", 16))
                self.l.setBuildFunc(self.buildMovieListEntry)
+               self.l.setItemHeight(75)
 
        #
        # | name of movie              |
@@ -25,6 +26,12 @@ class MovieList(GUIComponent):
                if serviceref.flags & eServiceReference.mustDescent:
                        return None
 
+               if len <= 0: #recalc len when not already done
+                       cur_idx = self.l.getCurrentSelectionIndex()
+                       x = self.list[cur_idx]
+                       len = x[1].getLength(x[0]) #recalc the movie length...
+                       self.list[cur_idx] = (x[0], x[1], x[2], len) #update entry in list... so next time we don't need to recalc
+
                if len > 0:
                        len = "%d:%02d" % (len / 60, len % 60)
                else:
@@ -68,7 +75,6 @@ class MovieList(GUIComponent):
        
        def postWidgetCreate(self, instance):
                instance.setContent(self.l)
-               instance.setItemHeight(75)
        
        def reload(self, root = None, filter_tags = None):
                if root is not None:
@@ -86,12 +92,6 @@ class MovieList(GUIComponent):
        def __len__(self):
                return len(self.list)
 
-       def updateLengthOfIndex(self, index):
-               if len(self.list) > index:
-                       x = self.list[index]
-                       self.list[index] = (x[0], x[1], x[2], x[1].getLength(x[0]))
-                       self.l.invalidateEntry(index)
-
        def load(self, root, filter_tags):
                # this lists our root service, then building a 
                # nice list