class ListBase(GUIListComponent, object): def __init__(self): GUIListComponent.__init__(self) self.picloader = PicLoader() self.picloader.setSize(95, 138) def destroy(self): self.picloader.destroy() GUIListComponent.destroy(self) def setList(self, _list): self.list = _list self.l.setList(_list) def getLength(self): return len(self.list) def moveSelectionTo(self, index): if index > -1: self.instance.moveSelectionTo(index)
class TMDbList(GUIListComponent, TMDbSkinParam, object): def __init__(self): GUIListComponent.__init__(self) TMDbSkinParam.__init__(self) self.l.setBuildFunc(self.buildMovieSelectionListEntry) self.picloader = PicLoader() self.picloader.setSize(self.picSize.width(), self.picSize.height()) self.build_update_callback = [] self.list = [] def destroy(self): self.picloader.destroy() GUIListComponent.destroy(self) def buildMovieSelectionListEntry(self, movie, movie_base=None): width = self.l.getItemSize().width() height = self.l.getItemSize().height() res = [None] try: for callback in self.build_update_callback: callback(movie) name = movie.Title if movie_base: name = movie_base + " - " + movie.Title if isinstance(movie.ReleaseDate, datetime.date): released = str(movie.ReleaseDate.year) else: released = str(movie.ReleaseDate) cover_url = movie.poster_url if not cover_url: png = self.picloader.load(getNocover()) else: parts = cover_url.split("/") filename = os_path.join(IMAGE_TEMPFILE, str(movie.ID) + str(parts[-1])) print filename if downloadCover(cover_url, filename): png = self.picloader.load(filename) else: png = self.picloader.load(getNocover()) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, self.picPos.x(), self.picPos.y(), self.picSize.width(), self.picSize.height(), png)) res.append( (eListboxPythonMultiContent.TYPE_TEXT, self.line1Pos.x(), self.line1Pos.y(), width - self.line1Pos.x(), self.f0h, 0, RT_HALIGN_LEFT, name)) res.append((eListboxPythonMultiContent.TYPE_TEXT, width - 255, self.line1Pos.y(), 250, self.f0h, 0, RT_HALIGN_RIGHT, released)) res.append( (eListboxPythonMultiContent.TYPE_TEXT, self.line2Pos.x(), self.line2Pos.y(), width - self.line2Pos.x(), height - self.line2Pos.y(), 1, RT_WRAP, movie.Overview)) except: from Source.Globals import printStackTrace printStackTrace() return res def setList(self, l): self.list = l self.l.setList(l) def getCurrent(self): return self.l.getCurrentSelection() def getLength(self): return len(self.list)