+ def disconnectSelChanged(self, fnc):
+ if fnc in self.onSelectionChanged:
+ self.onSelectionChanged.remove(fnc)
+
+ def selectionChanged(self):
+ for x in self.onSelectionChanged:
+ x()
+
+ def setListType(self, type):
+ self.list_type = type
+
+ def setDescriptionState(self, val):
+ self.descr_state = val
+
+ def setSortType(self, type):
+ self.sort_type = type
+
+ def redrawList(self):
+ if self.list_type == MovieList.LISTTYPE_ORIGINAL:
+ self.l.setFont(0, gFont("Regular", 22))
+ self.l.setFont(1, gFont("Regular", 18))
+ self.l.setFont(2, gFont("Regular", 16))
+ self.l.setItemHeight(75)
+ elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION or self.list_type == MovieList.LISTTYPE_COMPACT:
+ self.l.setFont(0, gFont("Regular", 20))
+ self.l.setFont(1, gFont("Regular", 14))
+ self.l.setItemHeight(37)
+ else:
+ self.l.setFont(0, gFont("Regular", 20))
+ self.l.setFont(1, gFont("Regular", 16))
+ self.l.setItemHeight(25)
+
+ #
+ # | name of movie |
+ #
+ def buildMovieListEntry(self, serviceref, info, begin, len):
+ if serviceref.flags & eServiceReference.mustDescent:
+ return None
+
+ width = self.l.getItemSize().width()
+
+ if len <= 0: #recalc len when not already done
+ cur_idx = self.l.getCurrentSelectionIndex()
+ x = self.list[cur_idx]
+ if config.usage.load_length_of_movies_in_moviellist.value:
+ len = x[1].getLength(x[0]) #recalc the movie length...
+ else:
+ len = 0 #dont recalc movielist to speedup loading the list
+ 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:
+ len = ""
+
+ res = [ None ]
+
+ txt = info.getName(serviceref)
+ service = ServiceReference(info.getInfoString(serviceref, iServiceInformation.sServiceref))
+ description = info.getInfoString(serviceref, iServiceInformation.sDescription)
+ tags = info.getInfoString(serviceref, iServiceInformation.sTags)
+
+ begin_string = ""
+ if begin > 0:
+ t = FuzzyTime(begin)
+ begin_string = t[0] + ", " + t[1]
+
+ if self.list_type == MovieList.LISTTYPE_ORIGINAL:
+ res.append(MultiContentEntryText(pos=(0, 0), size=(width-182, 30), font = 0, flags = RT_HALIGN_LEFT, text=txt))
+ if self.tags:
+ res.append(MultiContentEntryText(pos=(width-180, 0), size=(180, 30), font = 2, flags = RT_HALIGN_RIGHT, text = tags))
+ if service is not None:
+ res.append(MultiContentEntryText(pos=(200, 50), size=(200, 20), font = 1, flags = RT_HALIGN_LEFT, text = service.getServiceName()))
+ else:
+ if service is not None:
+ res.append(MultiContentEntryText(pos=(width-180, 0), size=(180, 30), font = 2, flags = RT_HALIGN_RIGHT, text = service.getServiceName()))
+ res.append(MultiContentEntryText(pos=(0, 30), size=(width, 20), font=1, flags=RT_HALIGN_LEFT, text=description))
+ res.append(MultiContentEntryText(pos=(0, 50), size=(200, 20), font=1, flags=RT_HALIGN_LEFT, text=begin_string))
+ res.append(MultiContentEntryText(pos=(width-200, 50), size=(198, 20), font=1, flags=RT_HALIGN_RIGHT, text=len))
+ elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
+ res.append(MultiContentEntryText(pos=(0, 0), size=(width-120, 20), font = 0, flags = RT_HALIGN_LEFT, text = txt))
+ res.append(MultiContentEntryText(pos=(0, 20), size=(width-212, 17), font=1, flags=RT_HALIGN_LEFT, text=description))
+ res.append(MultiContentEntryText(pos=(width-120, 6), size=(120, 20), font=1, flags=RT_HALIGN_RIGHT, text=begin_string))
+ if service is not None:
+ res.append(MultiContentEntryText(pos=(width-212, 20), size=(154, 17), font = 1, flags = RT_HALIGN_RIGHT, text = service.getServiceName()))
+ res.append(MultiContentEntryText(pos=(width-58, 20), size=(58, 20), font=1, flags=RT_HALIGN_RIGHT, text=len))
+ elif self.list_type == MovieList.LISTTYPE_COMPACT:
+ res.append(MultiContentEntryText(pos=(0, 0), size=(width-77, 20), font = 0, flags = RT_HALIGN_LEFT, text = txt))
+ if self.tags:
+ res.append(MultiContentEntryText(pos=(width-200, 20), size=(200, 17), font = 1, flags = RT_HALIGN_RIGHT, text = tags))
+ if service is not None:
+ res.append(MultiContentEntryText(pos=(200, 20), size=(200, 17), font = 1, flags = RT_HALIGN_LEFT, text = service.getServiceName()))
+ else:
+ if service is not None:
+ res.append(MultiContentEntryText(pos=(width-200, 20), size=(200, 17), font = 1, flags = RT_HALIGN_RIGHT, text = service.getServiceName()))
+ res.append(MultiContentEntryText(pos=(0, 20), size=(200, 17), font=1, flags=RT_HALIGN_LEFT, text=begin_string))
+ res.append(MultiContentEntryText(pos=(width-75, 0), size=(75, 20), font=0, flags=RT_HALIGN_RIGHT, text=len))
+ else:
+ assert(self.list_type == MovieList.LISTTYPE_MINIMAL)
+ if self.descr_state == MovieList.SHOW_DESCRIPTION:
+ res.append(MultiContentEntryText(pos=(0, 0), size=(width-146, 20), font = 0, flags = RT_HALIGN_LEFT, text = txt))
+ res.append(MultiContentEntryText(pos=(width-145, 4), size=(145, 20), font=1, flags=RT_HALIGN_RIGHT, text=begin_string))
+ else:
+ res.append(MultiContentEntryText(pos=(0, 0), size=(width-77, 20), font = 0, flags = RT_HALIGN_LEFT, text = txt))
+ res.append(MultiContentEntryText(pos=(width-75, 0), size=(75, 20), font=0, flags=RT_HALIGN_RIGHT, text=len))
+
+ return res
+
+ def moveToIndex(self, index):
+ self.instance.moveSelectionTo(index)
+
+ def getCurrentIndex(self):
+ return self.instance.getCurrentIndex()
+
+ def getCurrentEvent(self):
+ l = self.l.getCurrentSelection()
+ return l and l[0] and l[1] and l[1].getEvent(l[0])