def editLine(self): try: self.findtab = -1 length = 95 self.selLine = self["filedata"].getSelectionIndex() self.oldLine = self.list[self.selLine] my_editableText = self.list[self.selLine][:-1] editableText = my_editableText.partition(": ")[2] # os.system('echo %s %s >> /tmp/test.log' % ("oldline_a :", str(len(editableText)))) if len(editableText) == 0: editableText = "" # self.list[self.selLine][:-1] self.findtab = editableText.find("\t", 0, len(editableText)) if self.findtab != -1: editableText = editableText.replace("\t", " ") firstpos_end = config.plugins.filecommander.editposition_lineend.value if 'MetrixHD/' in config.skin.primary_skin.value: # screen: ... size="1140,30" font="screen_text; 20" # font: ... <alias name="FileList" font="screen_text" size="20" height="30" /> font = skin.fonts.get("FileList", ("Regular", 20, 30)) fieldwidth = int(1140 * skin.getSkinFactor()) #fhd? length = 1 if firstpos_end: while getTextBoundarySize( self.instance, gFont(font[0], font[1]), eSize(fieldwidth, font[2]), editableText[len(editableText) - length:], True).width() <= fieldwidth: length += 1 if length > len(editableText): break else: while getTextBoundarySize( self.instance, gFont(font[0], font[1]), eSize(fieldwidth, font[2]), editableText.replace(' ', '')[:length], True).width() <= fieldwidth: length += 1 if length > len(editableText): break length -= 1 self.session.openWithCallback( self.callbackEditLine, InputBoxWide, title=_(_("original") + ": " + editableText), visible_width=length, overwrite=False, firstpos_end=firstpos_end, allmarked=False, windowTitle=_("Edit line ") + str(self.selLine + 1), text=editableText) except: msg = self.session.open(MessageBox, _("This line is not editable!"), MessageBox.TYPE_ERROR) msg.setTitle(_("Error..."))
def layoutFinished(self): font = gFont("Console", applySkinFactor(16)) if not int(fontRenderClass.getInstance().getLineHeight(font)): font = gFont("Regular", applySkinFactor(16)) self["list"].instance.setFont(font) fontwidth = getTextBoundarySize(self.instance, font, self["list"].instance.size(), _(" ")).width() listwidth = int(self["list"].instance.size().width() / fontwidth) - 2 if path.exists(self.logfile): for line in open(self.logfile).readlines(): line = line.replace("\t", " " * 9) if len(line) > listwidth: pos = 0 offset = 0 readyline = True while readyline: a = " " * offset + line[pos:pos + listwidth - offset] self.log.append(a) if len(line[pos + listwidth - offset:]): pos += listwidth - offset offset = 19 else: readyline = False else: self.log.append(line) else: self.log = [_("file can not displayed - file not found")] self["list"].setList(self.log)
def layoutFinished(self): screenwidth = getDesktop(0).size().width() if screenwidth and screenwidth < 1920: f = 1 elif screenwidth and screenwidth < 3840: f = 1.5 else: f = 3 font = gFont("Console", int(16*f)) if not int(fontRenderClass.getInstance().getLineHeight(font)): font = gFont("Regular", int(16*f)) self["list"].instance.setFont(font) fontwidth = getTextBoundarySize(self.instance, font, self["list"].instance.size(), _(" ")).width() listwidth = int(self["list"].instance.size().width() / fontwidth) - 2 if path.exists(self.logfile): for line in file(self.logfile ).readlines(): line = line.replace('\t',' '*9) if len(line) > listwidth: pos = 0 offset = 0 readyline = True while readyline: a = " " * offset + line[pos:pos+listwidth-offset] self.log.append(a) if len(line[pos+listwidth-offset:]): pos += listwidth-offset offset = 19 else: readyline = False else: self.log.append(line) else: self.log = [_("file can not displayed - file not found")] self["list"].setList(self.log)
def setMode(self, mode): show_two_lines = config.usage.servicelist_twolines.value and mode == self.MODE_FAVOURITES if config.usage.servicelist_number_of_services.value == "by skin": ItemHeight = self.ItemHeight * (2 if show_two_lines else 1) ServiceNameFont = self.ServiceNameFont ServiceNumberFont = self.ServiceNumberFont ServiceInfoFont = self.ServiceInfoFont else: ItemHeight = int(self.instance.size().height() / int(config.usage.servicelist_number_of_services.value)) * (2 if show_two_lines else 1) FontFactor = ItemHeight * 100 / self.ItemHeight ServiceNameFont = gFont(self.ServiceNameFont.family, int(self.ServiceNameFont.pointSize * FontFactor/(200 if show_two_lines else 100))) ServiceNumberFont = gFont(self.ServiceNumberFont.family, int(self.ServiceNumberFont.pointSize * FontFactor/(200 if show_two_lines else 100))) ServiceInfoFont = gFont(self.ServiceInfoFont.family, int(self.ServiceInfoFont.pointSize * FontFactor/(200 if show_two_lines else 100))) self.mode = mode self.l.setItemHeight(ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - 30 #scrollbar is fixed 20 + 10 Extra marge if mode is self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = 0 else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, ServiceNumberFont, self.instance.size(), "0000").width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "00000").width() channelNumberSpace = self.fieldMargins self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, channelNumberWidth, ItemHeight)) progressWidth = self.progressBarWidth if "perc" in config.usage.show_event_progress_in_servicelist.value: progressWidth = self.progressPercentWidth or self.progressBarWidth if "left" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth+channelNumberSpace, 0, progressWidth , ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins), ItemHeight)) elif "right" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins), ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace), ItemHeight)) self.l.setElementFont(self.l.celServiceName, ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, ServiceInfoFont) if "perc" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, ServiceInfoFont) self.l.setShowTwoLines(show_two_lines) self.l.setHideNumberMarker(config.usage.hide_number_markers.value) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setColumnWidth(-1 if show_two_lines else int(config.usage.servicelist_column.value))
def setMode(self, mode): if config.usage.servicelist_number_of_services.value == "by skin": ItemHeight = self.ItemHeight ServiceNameFont = self.ServiceNameFont ServiceNumberFont = self.ServiceNumberFont ServiceInfoFont = self.ServiceInfoFont else: ItemHeight = int(self.instance.size().height() / int(config.usage.servicelist_number_of_services.value)) FontFactor = ItemHeight * 100 / self.ItemHeight ServiceNameFont = gFont(self.ServiceNameFont.family, int(self.ServiceNameFont.pointSize * FontFactor/100)) ServiceNumberFont = gFont(self.ServiceNumberFont.family, int(self.ServiceNumberFont.pointSize * FontFactor/100)) ServiceInfoFont = gFont(self.ServiceInfoFont.family, int(self.ServiceInfoFont.pointSize * FontFactor/100)) self.mode = mode self.l.setItemHeight(ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - 30 #scrollbar is fixed 20 + 10 Extra marge if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = 0 else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, ServiceNumberFont, self.instance.size(), "0000").width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "00000").width() channelNumberSpace = self.fieldMargins self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, channelNumberWidth, ItemHeight)) progressWidth = self.progressBarWidth if "perc" in config.usage.show_event_progress_in_servicelist.value: progressWidth = self.progressPercentWidth or self.progressBarWidth if "left" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth+channelNumberSpace, 0, progressWidth , ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins), ItemHeight)) elif "right" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins), ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace), ItemHeight)) self.l.setElementFont(self.l.celServiceName, ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, ServiceInfoFont) if "perc" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, ServiceInfoFont) self.l.setHideNumberMarker(config.usage.hide_number_markers.value) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setColumnWidth(int(config.usage.servicelist_column.value))
def setMode(self, mode): self.mode = mode self.setItemsPerPage() two_lines_val = int(config.usage.servicelist_twolines.value) show_two_lines = two_lines_val and mode == self.MODE_FAVOURITES self.ItemHeight *= (2 if show_two_lines else 1) self.l.setItemHeight(self.ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - 30 #scrollbar is fixed 20 + 10 Extra marge if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = 0 else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "0000").width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "00000").width() channelNumberSpace = self.fieldMargins self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, channelNumberWidth, self.ItemHeight)) progressWidth = self.progressBarWidth if "perc" in config.usage.show_event_progress_in_servicelist.value: progressWidth = self.progressPercentWidth or self.progressBarWidth if "left" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, 0, progressWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) elif "right" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace), self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) if show_two_lines and two_lines_val == 2: self.l.setElementFont(self.l.celServiceNextInfo, self.ServiceNextInfoFont) nextTitle = _("NEXT") + ": " self.l.setNextTitle(nextTitle) if "perc" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, self.ServiceInfoFont) self.l.setShowTwoLines(two_lines_val) self.l.setHideNumberMarker(config.usage.hide_number_markers.value) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setColumnWidth(-1 if show_two_lines else int(config.usage.servicelist_column.value))
def setMode(self, mode): self.mode = mode self.setItemsPerPage() self.l.setItemHeight(self.ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) self.l.setServicePiconDownsize(int(config.usage.servicelist_picon_downsize.value)) if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - 30 #scrollbar is fixed 20 + 10 Extra marge if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = 0 else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "0000").width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "00000").width() channelNumberSpace = self.fieldMargins self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, channelNumberWidth, self.ItemHeight)) progressWidth = self.progressBarWidth if "perc" in config.usage.show_event_progress_in_servicelist.value: progressWidth = self.progressPercentWidth or self.progressBarWidth if "left" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth+channelNumberSpace, 0, progressWidth , self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) elif "right" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace), self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) if "perc" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, self.ServiceInfoFont) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setColumnWidth(int(config.usage.servicelist_column.value))
def setMode(self, mode): screenwidth = getDesktop(0).size().width() self.mode = mode self.setItemsPerPage() self.l.setItemHeight(self.ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) self.l.setServicePiconRatio(int(config.usage.servicelist_picon_ratio.value)) if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - 30 #scrollbar is fixed 20 + 10 Extra marge if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = 0 else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "0000").width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "00000").width() channelNumberSpace = self.fieldMargins self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, channelNumberWidth, self.ItemHeight)) if "left" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth+channelNumberSpace, 0, self.progressBarWidth , self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace + self.progressBarWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth+channelNumberSpace + self.progressBarWidth + self.fieldMargins), self.ItemHeight)) elif "right" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - self.progressBarWidth, 0, self.progressBarWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace + self.progressBarWidth + self.fieldMargins), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth+channelNumberSpace, 0, rowWidth - (channelNumberWidth+channelNumberSpace), self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) if "perc" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, self.ServiceInfoFont) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setColumnWidth(int(config.usage.servicelist_column.value))
def setMode(self, mode): self.mode = mode self.setItemsPerPage() self.l.setItemHeight(self.ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) self.l.setServicePiconDownsize(int(config.usage.servicelist_picon_downsize.value)) self.l.setServicePiconRatio(int(config.usage.servicelist_picon_ratio.value)) twoLines = config.usage.servicelist_twolines.value self.l.setShowTwoLines(twoLines) if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - self.listMarginRight if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = self.listMarginLeft else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), '0' * int(config.usage.maxchannelnumlen.value)).width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), '00000').width() channelNumberSpace = self.fieldMargins + self.listMarginLeft numberHeight = self.ItemHeight / 2 if twoLines and config.usage.servicelist_servicenumber_valign.value == '1' else self.ItemHeight self.l.setElementPosition(self.l.celServiceNumber, eRect(self.listMarginLeft, 0, channelNumberWidth, numberHeight)) if twoLines: viewMode, viewType = (config.usage.servicelist_eventprogress_valign.value + config.usage.servicelist_eventprogress_view_mode.value).split('_') viewMode = int(viewMode) else: viewType = config.usage.show_event_progress_in_servicelist.value viewMode = 0 self.l.setProgressViewMode(viewMode) minuteUnit = _('min') self.l.setProgressUnit(minuteUnit if 'mins' in viewType else '%') progressHeight = self.ItemHeight / 2 if viewMode else self.ItemHeight progressTextWidth = getTextBoundarySize(self.instance, self.ProgressInfoFont, self.instance.size(), '+000 %s' % minuteUnit).width() if 'mins' in viewType else getTextBoundarySize(self.instance, self.ProgressInfoFont, self.instance.size(), '100 %').width() self.l.setProgressTextWidth(progressTextWidth) if 'bar' in viewType: if viewMode and viewMode < 10: progressWidth = max(self.progressBarWidth, progressTextWidth) elif viewMode > 10: progressWidth = self.progressBarWidth + progressTextWidth + self.itemsDistances else: progressWidth = self.progressBarWidth else: progressWidth = progressTextWidth if 'left' in viewType: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, 0, progressWidth, progressHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) elif 'right' in viewType: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, progressHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace), self.ItemHeight)) if 'perc' in viewType or 'mins' in viewType: self.l.setElementFont(self.l.celServiceEventProgressbar, self.ProgressInfoFont) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) self.l.setHideNumberMarker(config.usage.hide_number_markers.value) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setServiceQualityIconMode(int(config.usage.quality_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setColumnWidth(-1 if twoLines else int(config.usage.servicelist_column.value))
def buildTimerEntry(self, timer, processed): height = self.l.getItemSize().height() width = self.l.getItemSize().width() res = [None] serviceName = " " + timer.service_ref.getServiceName() serviceNameWidth = getTextBoundarySize(self.instance, self.serviceNameFont, self.l.getItemSize(), serviceName).width() if 200 > width - serviceNameWidth - self.iconWidth - self.iconMargin: serviceNameWidth = width - 200 - self.iconWidth - self.iconMargin res.append((eListboxPythonMultiContent.TYPE_TEXT, width - serviceNameWidth, 0, serviceNameWidth, self.rowSplit, 0, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, serviceName)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, 0, width - serviceNameWidth - self.iconWidth - self.iconMargin, self.rowSplit, 2, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timer.name)) begin = FuzzyTime(timer.begin) if timer.repeated: days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")) repeatedtext = [] flags = timer.repeated for x in (0, 1, 2, 3, 4, 5, 6): if flags & 1 == 1: repeatedtext.append(days[x]) flags >>= 1 if repeatedtext == [_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")]: repeatedtext = _('Everyday') elif repeatedtext == [_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri")]: repeatedtext = _('Weekday') elif repeatedtext == [_("Sat"), _("Sun")]: repeatedtext = _('Weekend') else: repeatedtext = ", ".join(repeatedtext) if self.iconRepeat: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, self.rowSplit + (self.itemHeight - self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, self.iconRepeat)) else: repeatedtext = begin[0] # date if timer.justplay: if timer.end > timer.begin + 3: text = repeatedtext + ((" %s ... %s (" + _("ZAP") + ", %d " + _("mins") + ")") % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) else: text = repeatedtext + ((" %s (" + _("ZAP") + ")") % (begin[1])) else: text = repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _("waiting") if timer.isAutoTimer: icon = self.iconAutoTimer elif timer.ice_timer_id is not None: icon = self.iconIceTVTimer else: icon = self.iconWait elif timer.state == TimerEntry.StatePrepared: state = _("about to start") icon = self.iconPrepared elif timer.state == TimerEntry.StateRunning: if timer.justplay: state = _("zapped") icon = self.iconZapped else: state = _("recording...") icon = self.iconRecording elif timer.state == TimerEntry.StateEnded: state = _("done!") icon = self.iconDone else: state = _("<unknown>") icon = None elif timer.disabled: state = _("disabled") icon = self.iconDisabled elif timer.failed: state = _("failed") icon = self.iconFailed else: state = _("done!") icon = self.iconDone icon and res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, icon)) orbpos = self.getOrbitalPos(timer.service_ref) orbposWidth = getTextBoundarySize(self.instance, self.font, self.l.getItemSize(), orbpos).width() res.append((eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft, self.rowSplit, orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, orbpos)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, self.rowSplit, self.satPosLeft - self.iconWidth - self.iconMargin, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, state)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft + orbposWidth, self.rowSplit, width - self.satPosLeft - orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_RIGHT | RT_VALIGN_TOP, text)) line = LoadPixmap(resolveFilename(SCOPE_GUISKIN, "div-h.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height - 2, width, 2, line)) return res
def buildListboxEntry(self, timer): if not timer.enabled: icon = self.iconDisabled else: icon = self.iconEnabled if timer.justplay: rectypeicon = self.iconZapped else: rectypeicon = self.iconRecording height = self.l.getItemSize().height() width = self.l.getItemSize().width() iconMargin = self.iconMargin statusIconHeight = self.statusIconHeight statusIconWidth = self.statusIconWidth typeIconHeight = self.typeIconHeight typeIconWidth = self.typeIconWidth rowHeight = self.rowHeight rowSplit1 = self.rowSplit1 rowSplit2 = self.rowSplit2 channels = [] bouquets = [] for t in timer.services: channels.append(ServiceReference(t).getServiceName()) for t in timer.bouquets: bouquets.append(ServiceReference(t).getServiceName()) if len(channels) >0 : channel = _("[S] ") channel += ", ".join(channels) elif len(bouquets) >0 : channel = _("[B] ") channel += ", ".join(bouquets) else: channel = _('All channels') res = [ None ] if icon: if skinparms: x, y, w, h = parameters.get("AutotimerEnabledIcon",(iconMargin, 0, statusIconHeight, statusIconWidth)) else: x, y, w, h = (iconMargin, 0, statusIconHeight, statusIconWidth) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, icon)) if rectypeicon: if skinparms: x, y, w, h = parameters.get("AutotimerRecordIcon",(iconMargin+statusIconWidth+iconMargin, 3, statusIconHeight, typeIconWidth)) else: x, y, w, h = (iconMargin+statusIconWidth+iconMargin, 3, statusIconHeight, typeIconWidth) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, rectypeicon)) if timer.hasTimespan(): nowt = time() now = localtime(nowt) begintime = int(mktime((now.tm_year, now.tm_mon, now.tm_mday, timer.timespan[0][0], timer.timespan[0][1], 0, now.tm_wday, now.tm_yday, now.tm_isdst))) endtime = int(mktime((now.tm_year, now.tm_mon, now.tm_mday, timer.timespan[1][0], timer.timespan[1][1], 0, now.tm_wday, now.tm_yday, now.tm_isdst))) timespan = ((" %s ... %s") % (FuzzyTime(begintime)[1], FuzzyTime(endtime)[1])) else: timespan = _(" Any time") res.append((eListboxPythonMultiContent.TYPE_TEXT, float(width)/10*4.5, 2, width-float(width)/10*4.5, rowHeight, 1, RT_HALIGN_RIGHT|RT_VALIGN_BOTTOM, timespan)) if TextBoundary: timespanWidth = getTextBoundarySize(self.instance, self.EventNameFont, self.l.getItemSize(), timespan).width() else: timespanWidth = float(width)/10*2 res.append((eListboxPythonMultiContent.TYPE_TEXT, statusIconWidth+typeIconWidth+iconMargin*3, 2, width-statusIconWidth-typeIconWidth-iconMargin*3- timespanWidth, rowHeight, 1, RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, timer.name)) if timer.hasTimeframe(): begin = strftime("%a, %d %b", localtime(timer.getTimeframeBegin())) end = strftime("%a, %d %b", localtime(timer.getTimeframeEnd())) timeframe = (("%s ... %s") % (begin, end)) res.append((eListboxPythonMultiContent.TYPE_TEXT, iconMargin, rowSplit1, float(width)/10*4.5, rowHeight, 2, RT_HALIGN_LEFT|RT_VALIGN_TOP, timeframe)) if timer.include[3]: total = len(timer.include[3]) count = 0 days = [] while count+1 <= total: day = timer.include[3][count] day = { '0': _("Mon"), '1': _("Tue"), '2': _("Wed"), '3': _("Thur"), '4': _("Fri"), '5': _("Sat"), '6': _("Sun"), "weekend": _("Weekend"), "weekday": _("Weekday") }[day] days.append(day) count += 1 days = ', '.join(days) else: days = _("Everyday") res.append((eListboxPythonMultiContent.TYPE_TEXT, float(width)/10*5.5, rowSplit1, width-float(width)/10*5.5, rowHeight, 2, RT_HALIGN_RIGHT|RT_VALIGN_TOP, days)) res.append((eListboxPythonMultiContent.TYPE_TEXT, iconMargin, rowSplit2, width-(iconMargin*2), rowHeight, 0, RT_HALIGN_LEFT|RT_VALIGN_TOP, channel)) try: devide = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "div-h.png")) except: devide = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "div-h.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height-2, width, 2, devide)) return res
def setMode(self, mode): self.mode = mode self.setItemsPerPage() self.l.setItemHeight(self.ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) self.l.setServicePiconDownsize( int(config.usage.servicelist_picon_downsize.value)) self.l.setServicePiconRatio( int(config.usage.servicelist_picon_ratio.value)) self.l.setShowTwoLines(config.usage.servicelist_twolines.value) self.l.setServiceInfoAddWidth( config.usage.servicelist_eventprogress_valign.value == "1" and "right" in config.usage.show_event_progress_in_servicelist.value) minuteUnit = _("min") self.l.setProgressUnit( minuteUnit if "mins" in config.usage.show_event_progress_in_servicelist.value else "%") if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - self.listMarginRight if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = self.listMarginLeft else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize( self.instance, self.ServiceNumberFont, self.instance.size(), "0" * int(config.usage.maxchannelnumlen.value)).width( ) or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), "00000").width() channelNumberSpace = self.fieldMargins + self.listMarginLeft numberHeight = self.ItemHeight / 2 if config.usage.servicelist_twolines.value and config.usage.servicelist_servicenumber_valign.value == "1" else self.ItemHeight self.l.setElementPosition( self.l.celServiceNumber, eRect(self.listMarginLeft, 0, channelNumberWidth, numberHeight)) progressFont = gFont( self.ServiceInfoFontName, self.ServiceInfoFontSize + config.usage.serviceinfo_fontsize.value + self.progressFontOffset) progressHeight = self.ItemHeight / 2 if config.usage.servicelist_twolines.value and config.usage.servicelist_eventprogress_valign.value == "1" else self.ItemHeight progressWidth = getTextBoundarySize( self.instance, progressFont, self.instance.size(), "+000 %s" % minuteUnit ).width( ) if "mins" in config.usage.show_event_progress_in_servicelist.value else getTextBoundarySize( self.instance, self.ServiceInfoFont, self.instance.size(), "100 %").width() if "bar" in config.usage.show_event_progress_in_servicelist.value: progressWidth = self.progressBarWidth if "left" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition( self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, 0, progressWidth, progressHeight)) self.l.setElementPosition( self.l.celServiceName, eRect( channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) elif "right" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition( self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, progressHeight)) self.l.setElementPosition( self.l.celServiceName, eRect( channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition( self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace), self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) if "perc" in config.usage.show_event_progress_in_servicelist.value or "mins" in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, progressFont) self.l.setHideNumberMarker(config.usage.hide_number_markers.value) self.l.setServiceTypeIconMode( int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode( int(config.usage.record_indicator_mode.value)) self.l.setColumnWidth(-1 if config.usage.servicelist_twolines.value else int(config.usage.servicelist_column.value))
def buildTimerEntry(self, timer, processed): height = self.l.getItemSize().height() width = self.l.getItemSize().width() res = [None] serviceName = timer.service_ref.getServiceName() serviceNameWidth = getTextBoundarySize(self.instance, self.serviceNameFont, self.l.getItemSize(), serviceName).width() if 200 > width - serviceNameWidth - self.iconWidth - self.iconMargin: serviceNameWidth = width - 200 - self.iconWidth - self.iconMargin res.append((eListboxPythonMultiContent.TYPE_TEXT, width - serviceNameWidth, 0, serviceNameWidth, self.rowSplit, 0, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, serviceName)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, 0, width - serviceNameWidth - self.iconWidth - self.iconMargin, self.rowSplit, 2, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timer.name)) begin = FuzzyTime(timer.begin) if timer.repeated: days = (_('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'), _('Sat'), _('Sun')) repeatedtext = [] flags = timer.repeated for x in (0, 1, 2, 3, 4, 5, 6): if flags & 1 == 1: repeatedtext.append(days[x]) flags >>= 1 if repeatedtext == [_('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'), _('Sat'), _('Sun')]: repeatedtext = _('Everyday') elif repeatedtext == [_('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri')]: repeatedtext = _('Weekday') elif repeatedtext == [_('Sat'), _('Sun')]: repeatedtext = _('Weekend') else: repeatedtext = ', '.join(repeatedtext) if self.iconRepeat: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, self.rowSplit + (self.itemHeight - self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, self.iconRepeat)) else: repeatedtext = begin[0] if timer.justplay: if timer.end > timer.begin + 3: text = repeatedtext + (' %s ... %s (' + _('ZAP') + ', %d ' + _('mins') + ')') % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60) else: text = repeatedtext + (' %s (' + _('ZAP') + ')') % begin[1] else: text = repeatedtext + (' %s ... %s (%d ' + _('mins') + ')') % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _('waiting') if timer.isAutoTimer: icon = self.iconAutoTimer else: icon = self.iconWait elif timer.state == TimerEntry.StatePrepared: state = _('about to start') icon = self.iconPrepared elif timer.state == TimerEntry.StateRunning: if timer.justplay: state = _('zapped') icon = self.iconZapped else: state = _('recording...') icon = self.iconRecording elif timer.state == TimerEntry.StateEnded: state = _('done!') icon = self.iconDone else: state = _('<unknown>') icon = None elif timer.disabled: state = _('disabled') icon = self.iconDisabled elif timer.failed: state = _('failed') icon = self.iconFailed else: state = _('done!') icon = self.iconDone icon and res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, icon)) orbpos = self.getOrbitalPos(timer.service_ref) orbposWidth = getTextBoundarySize(self.instance, self.font, self.l.getItemSize(), orbpos).width() res.append((eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft, self.rowSplit, orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, orbpos)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, self.rowSplit, self.satPosLeft - self.iconWidth - self.iconMargin, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, state)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft + orbposWidth, self.rowSplit, width - self.satPosLeft - orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_RIGHT | RT_VALIGN_TOP, text)) line = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, 'div-h.png')) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height - 2, width, 2, line)) return res
def buildListboxEntry(self, timer): if not timer.enabled: icon = self.iconDisabled else: icon = self.iconEnabled if timer.justplay: rectypeicon = self.iconZapped else: rectypeicon = self.iconRecording height = self.l.getItemSize().height() width = self.l.getItemSize().width() iconMargin = self.iconMargin statusIconHeight = self.statusIconHeight statusIconWidth = self.statusIconWidth typeIconHeight = self.typeIconHeight typeIconWidth = self.typeIconWidth rowHeight = self.rowHeight rowSplit1 = self.rowSplit1 rowSplit2 = self.rowSplit2 channel = [] for t in timer.services: channel.append(ServiceReference(t).getServiceName()) if len(channel) >0 : channel = ", ".join(channel) else: channel = _('All channels') res = [ None ] if icon: if skinparms: x, y, w, h = parameters.get("AutotimerEnabledIcon",(iconMargin, 0, statusIconHeight, statusIconWidth)) else: x, y, w, h = (iconMargin, 0, statusIconHeight, statusIconWidth) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, icon)) if rectypeicon: if skinparms: x, y, w, h = parameters.get("AutotimerRecordIcon",(iconMargin+statusIconWidth+iconMargin, 3, statusIconHeight, typeIconWidth)) else: x, y, w, h = (iconMargin+statusIconWidth+iconMargin, 3, statusIconHeight, typeIconWidth) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, x, y, w, h, rectypeicon)) if timer.hasTimespan(): nowt = time() now = localtime(nowt) begintime = int(mktime((now.tm_year, now.tm_mon, now.tm_mday, timer.timespan[0][0], timer.timespan[0][1], 0, now.tm_wday, now.tm_yday, now.tm_isdst))) endtime = int(mktime((now.tm_year, now.tm_mon, now.tm_mday, timer.timespan[1][0], timer.timespan[1][1], 0, now.tm_wday, now.tm_yday, now.tm_isdst))) timespan = ((" %s ... %s") % (FuzzyTime(begintime)[1], FuzzyTime(endtime)[1])) else: timespan = _(" Any time") res.append((eListboxPythonMultiContent.TYPE_TEXT, float(width)/10*4.5, 2, width-float(width)/10*4.5, rowHeight, 1, RT_HALIGN_RIGHT|RT_VALIGN_BOTTOM, timespan)) if TextBoundary: timespanWidth = getTextBoundarySize(self.instance, self.EventNameFont, self.l.getItemSize(), timespan).width() else: timespanWidth = float(width)/10*2 res.append((eListboxPythonMultiContent.TYPE_TEXT, statusIconWidth+typeIconWidth+iconMargin*3, 2, width-statusIconWidth-typeIconWidth-iconMargin*3- timespanWidth, rowHeight, 1, RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, timer.name)) if timer.hasTimeframe(): begin = strftime("%a, %d %b", localtime(timer.getTimeframeBegin())) end = strftime("%a, %d %b", localtime(timer.getTimeframeEnd())) timeframe = (("%s ... %s") % (begin, end)) res.append((eListboxPythonMultiContent.TYPE_TEXT, iconMargin, rowSplit1, float(width)/10*4.5, rowHeight, 2, RT_HALIGN_LEFT|RT_VALIGN_TOP, timeframe)) if timer.include[3]: total = len(timer.include[3]) count = 0 days = [] while count+1 <= total: day = timer.include[3][count] day = { '0': _("Mon"), '1': _("Tue"), '2': _("Wed"), '3': _("Thur"), '4': _("Fri"), '5': _("Sat"), '6': _("Sun"), "weekend": _("Weekend"), "weekday": _("Weekday") }[day] days.append(day) count += 1 days = ', '.join(days) else: days = _("Everyday") res.append((eListboxPythonMultiContent.TYPE_TEXT, float(width)/10*5.5, rowSplit1, width-float(width)/10*5.5, rowHeight, 2, RT_HALIGN_RIGHT|RT_VALIGN_TOP, days)) res.append((eListboxPythonMultiContent.TYPE_TEXT, iconMargin, rowSplit2, width-(iconMargin*2), rowHeight, 0, RT_HALIGN_LEFT|RT_VALIGN_TOP, channel)) try: devide = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "div-h.png")) except: devide = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height-2, width, 2, devide)) return res
def buildTimerEntry(self, timer, processed): height = self.l.getItemSize().height() width = self.l.getItemSize().width() res = [None] serviceName = ' ' + timer.service_ref.getServiceName() serviceNameWidth = getTextBoundarySize(self.instance, self.serviceNameFont, self.l.getItemSize(), serviceName).width() if 200 > width - serviceNameWidth - self.iconWidth - self.iconMargin: serviceNameWidth = width - 200 - self.iconWidth - self.iconMargin res.append( (eListboxPythonMultiContent.TYPE_TEXT, width - serviceNameWidth, 0, serviceNameWidth, self.rowSplit, 0, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, serviceName)) res.append( (eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, 0, width - serviceNameWidth - self.iconWidth - self.iconMargin, self.rowSplit, 2, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timer.name)) begin = FuzzyTime(timer.begin) if timer.repeated: days = (_('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'), _('Sat'), _('Sun')) repeatedtext = [] flags = timer.repeated for x in (0, 1, 2, 3, 4, 5, 6): if flags & 1 == 1: repeatedtext.append(days[x]) flags >>= 1 if repeatedtext == [ _('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'), _('Sat'), _('Sun') ]: repeatedtext = _('Everyday') elif repeatedtext == [ _('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri') ]: repeatedtext = _('Weekday') elif repeatedtext == [_('Sat'), _('Sun')]: repeatedtext = _('Weekend') else: repeatedtext = ', '.join(repeatedtext) if self.iconRepeat: res.append( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, self.rowSplit + (self.itemHeight - self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, self.iconRepeat)) else: repeatedtext = begin[0] if timer.justplay: if timer.end > timer.begin + 3: text = repeatedtext + (' %s ... %s (' + _('ZAP') + ', %d ' + _( 'mins') + ')') % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60) else: text = repeatedtext + (' %s (' + _('ZAP') + ')') % begin[1] else: text = repeatedtext + (' %s ... %s (%d ' + _('mins') + ')') % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _('waiting') if timer.isAutoTimer: icon = self.iconAutoTimer else: icon = self.iconWait elif timer.state == TimerEntry.StatePrepared: state = _('about to start') icon = self.iconPrepared elif timer.state == TimerEntry.StateRunning: if timer.justplay: state = _('zapped') icon = self.iconZapped else: state = _('recording...') icon = self.iconRecording elif timer.state == TimerEntry.StateEnded: state = _('done!') icon = self.iconDone else: state = _('<unknown>') icon = None elif timer.disabled: state = _('disabled') icon = self.iconDisabled elif timer.failed: state = _('failed') icon = self.iconFailed else: state = _('done!') icon = self.iconDone icon and res.append( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, icon)) orbpos = self.getOrbitalPos(timer.service_ref) orbposWidth = getTextBoundarySize(self.instance, self.font, self.l.getItemSize(), orbpos).width() res.append( (eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft, self.rowSplit, orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, orbpos)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, self.rowSplit, self.satPosLeft - self.iconWidth - self.iconMargin, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, state)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft + orbposWidth, self.rowSplit, width - self.satPosLeft - orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_RIGHT | RT_VALIGN_TOP, text)) line = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, 'div-h.png')) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height - 2, width, 2, line)) return res
def buildMovieListEntry(self, serviceref, info, begin, data): switch = config.usage.show_icons_in_movielist.value ext = config.movielist.useextlist.value width = self.l.getItemSize().width() pathName = serviceref.getPath() res = [ None ] if ext != '0': ih = self.itemHeight / 2 else: ih = self.itemHeight if self.screenwidth and self.screenwidth == 1920: listBeginX = 3 listEndX = 3 listMarginX = 12 pathIconSize = 29 dataIconSize = 25 progressIconSize = 25 progressBarSize = 72 textPosY = 2 else: listBeginX = 2 listEndX = 2 listMarginX = 8 pathIconSize = 25 dataIconSize = 21 progressIconSize = 21 progressBarSize = 48 textPosY = 1 textPosX = listBeginX + dataIconSize + listMarginX if serviceref.flags & eServiceReference.mustDescent: # Directory iconSize = pathIconSize iconPosX = listBeginX-1 iconPosY = ih/2-iconSize/2 if iconPosY < iconPosX: iconPosY = iconPosX # Name is full path name if info is None: # Special case: "parent" txt = ".." else: p = os.path.split(pathName) if not p[1]: # if path ends in '/', p is blank. p = os.path.split(p[0]) txt = p[1] if txt == ".Trash": dateSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), _("Trashcan")).width() res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPosX,iconPosY), size=(iconSize,iconSize), png=self.iconTrash)) res.append(MultiContentEntryText(pos=(textPosX, 0), size=(width-textPosX-dateSize-listMarginX-listEndX, ih), font = 0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = _("Deleted items"))) res.append(MultiContentEntryText(pos=(width-dateSize-listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Trashcan"))) return res dateSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), _("Directory")).width() res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPosX,iconPosY), size=(iconSize,iconSize), png=self.iconFolder)) res.append(MultiContentEntryText(pos=(textPosX, 0), size=(width-textPosX-dateSize-listMarginX-listEndX, ih), font = 0, flags = RT_HALIGN_LEFT|RT_VALIGN_CENTER, text = txt)) res.append(MultiContentEntryText(pos=(width-dateSize-listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=_("Directory"))) return res if (data == -1) or (data is None): data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] # x = ref,info,begin,... data.len = 0 #dont recalc movielist to speedup loading the list self.list[cur_idx] = (x[0], x[1], x[2], data) #update entry in list... so next time we don't need to recalc data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch == 'p' or switch == 's': data.part = 100 if (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = 0xffc71d else: data.partcol = 0xff001d elif (self.playInBackground or self.playInForeground) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] else: if config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch == 'p' or switch == 's': if data.part is not None and data.part > 0: data.partcol = 0xffc71d else: if config.usage.movielist_unseen.value: data.part = 100 data.partcol = 0x206333 len = data.len if len > 0: len = "%d:%02d" % (len / 60, len % 60) else: len = "" iconSize = 0 if switch == 'i': iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih/2-iconSize/2 if iconPosY < iconPosX: iconPosY = iconPosX res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPosX,iconPosY), size=(iconSize,iconSize), png=data.icon)) elif switch == 'p': if data.part is not None and data.part > 0: iconSize = progressBarSize iconPosX = listBeginX iconPosY = ih/2-iconSize/8 if iconPosY < iconPosX: iconPosY = iconPosX res.append(MultiContentEntryProgress(pos=(iconPosX,iconPosY), size=(iconSize,iconSize/4), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih/2-iconSize/2 if iconPosY < iconPosX: iconPosY = iconPosX res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPosX,iconPosY), size=(iconSize,iconSize), png=data.icon)) elif switch == 's': iconSize = progressIconSize iconPosX = listBeginX iconPosY = ih/2-iconSize/2 if iconPosY < iconPosX: iconPosY = iconPosX if data.part is not None and data.part > 0: res.append(MultiContentEntryProgress(pos=(iconPosX,iconPosY), size=(iconSize,iconSize), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append(MultiContentEntryPixmapAlphaBlend(pos=(iconPosX,iconPosY), size=(iconSize,iconSize), png=data.icon)) begin_string = "" if begin > 0: begin_string = ', '.join(FuzzyTime(begin, inPast = True)) dateSize = serviceSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), begin_string).width() if iconSize: textPosX = listBeginX + iconSize + listMarginX else: textPosX = listBeginX if ext != '0': getrec = info.getName(serviceref) fileName, fileExtension = os.path.splitext(getrec) desc = None picon = None service = None try: serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(serviceref) desc = info.getInfoString(serviceref, iServiceInformation.sDescription) # get description ref = info.getInfoString(serviceref, iServiceInformation.sServiceref) # get reference service = ServiceReference(ref).getServiceName() # get service name serviceSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), service).width() except Exception, e: print('[MovieList] load extended infos get failed: ', e) if ext == '2': try: picon = getPiconName(ref) picon = loadPNG(picon) except Exception, e: print('[MovieList] load picon get failed: ', e)
def buildTimerEntry(self, timer, processed): height = self.l.getItemSize().height() width = self.l.getItemSize().width() res = [None] piconWidth = 100 if config.usage.timerlist_showpicons.value else 0 serviceName = timer.service_ref.getServiceName() serviceNameWidth = getTextBoundarySize(self.instance, self.serviceNameFont, self.l.getItemSize(), serviceName).width() nameWidth = width - serviceNameWidth - self.iconWidth - self.iconMargin - piconWidth if nameWidth < 200: serviceNameWidth = width - 200 - self.iconWidth - self.iconMargin - piconWidth def addPicon(): refstr = None if hasattr(timer.service_ref, 'sref'): refstr = str(timer.service_ref.sref) else: refstr = str(timer.service_ref) displayPicon = None picon = getPiconName(refstr) if picon != "": displayPicon = LoadPixmap(picon) if displayPicon is not None: res.append( MultiContentEntryPixmapAlphaBlend( pos=(colX, 0), size=(piconWidth, self.itemHeight), png=displayPicon, backcolor=None, backcolor_sel=None, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO | BT_ALIGN_CENTER)) return piconWidth colX = 0 if config.usage.timerlist_showpicons.value: colX += addPicon() res.append( (eListboxPythonMultiContent.TYPE_TEXT, colX + self.iconWidth + self.iconMargin, 0, nameWidth, self.rowSplit, 2, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timer.name)) res.append( (eListboxPythonMultiContent.TYPE_TEXT, width - serviceNameWidth, 0, serviceNameWidth, self.rowSplit, 0, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, serviceName)) begin = FuzzyTime(timer.begin) if timer.repeated: days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")) repeatedtext = [] flags = timer.repeated for x in (0, 1, 2, 3, 4, 5, 6): if flags & 1 == 1: repeatedtext.append(days[x]) flags >>= 1 if repeatedtext == [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ]: repeatedtext = _('Everyday') elif repeatedtext == [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri") ]: repeatedtext = _('Weekday') elif repeatedtext == [_("Sat"), _("Sun")]: repeatedtext = _('Weekend') else: repeatedtext = ", ".join(repeatedtext) if self.iconRepeat: res.append( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, colX + self.iconMargin, self.rowSplit + (self.itemHeight - self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, self.iconRepeat)) else: repeatedtext = begin[0] # date if timer.justplay: extra_text = _("(ZAP)") if timer.pipzap: extra_text = _("(ZAP as PiP)") text = repeatedtext + ((" %s " + extra_text) % (begin[1])) else: text = repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _("waiting") if timer.isAutoTimer: icon = self.iconAutoTimer else: icon = self.iconWait elif timer.state == TimerEntry.StatePrepared: state = _("about to start") icon = self.iconPrepared elif timer.state == TimerEntry.StateRunning: if timer.justplay: state = _("zapped") icon = self.iconZapped else: state = _("recording...") icon = self.iconRecording elif timer.state == TimerEntry.StateEnded: state = _("done!") icon = self.iconDone else: state = _("<unknown>") icon = None elif timer.disabled: state = _("disabled") icon = self.iconDisabled elif timer.failed: state = _("failed") icon = self.iconFailed else: state = _("done!") icon = self.iconDone icon and res.append( (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, colX + self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, icon)) orbpos = self.getOrbitalPos(timer.service_ref) orbposWidth = getTextBoundarySize(self.instance, self.font, self.l.getItemSize(), orbpos).width() res.append( (eListboxPythonMultiContent.TYPE_TEXT, colX + self.satPosLeft, self.rowSplit, orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, orbpos)) res.append((eListboxPythonMultiContent.TYPE_TEXT, colX + self.iconWidth + self.iconMargin, self.rowSplit, self.satPosLeft - self.iconWidth - self.iconMargin, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, state)) res.append((eListboxPythonMultiContent.TYPE_TEXT, colX + self.satPosLeft + orbposWidth, self.rowSplit, width - self.satPosLeft - orbposWidth - colX, self.itemHeight - self.rowSplit, 1, RT_HALIGN_RIGHT | RT_VALIGN_TOP, text)) line = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "div-h.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height - 2, width, 2, line)) return res
def buildTimerEntry(self, timer, processed): width = self.l.getItemSize().width() res = [ None ] serviceName = timer.service_ref.getServiceName() serviceNameWidth = getTextBoundarySize(self.instance, self.serviceNameFont, self.l.getItemSize(), serviceName).width() if 200 > width - serviceNameWidth - self.iconWidth - self.iconMargin: serviceNameWidth = width - 200 - self.iconWidth - self.iconMargin res.append((eListboxPythonMultiContent.TYPE_TEXT, width - serviceNameWidth, 0, serviceNameWidth, self.rowSplit, 0, RT_HALIGN_RIGHT|RT_VALIGN_BOTTOM, serviceName)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, 0, width - serviceNameWidth - self.iconWidth - self.iconMargin, self.rowSplit, 2, RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, timer.name)) begin = FuzzyTime(timer.begin) if timer.repeated: days = ( _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ) repeatedtext = [] flags = timer.repeated for x in (0, 1, 2, 3, 4, 5, 6): if (flags & 1 == 1): repeatedtext.append(days[x]) flags = flags >> 1 repeatedtext = ", ".join(repeatedtext) if self.iconRepeat: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, self.iconMargin / 2, self.rowSplit + (self.itemHeight - self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, self.iconRepeat)) else: repeatedtext = begin[0] # date if timer.justplay: text = repeatedtext + ((" %s "+ _("(ZAP)")) % (begin[1])) else: text = repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") % (begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60)) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _("waiting") icon = self.iconWait elif timer.state == TimerEntry.StatePrepared: state = _("about to start") icon = self.iconPrepared elif timer.state == TimerEntry.StateRunning: if timer.justplay: state = _("zapped") icon = self.iconZapped else: state = _("recording...") icon = self.iconRecording elif timer.state == TimerEntry.StateEnded: state = _("done!") icon = self.iconDone else: state = _("<unknown>") icon = None elif timer.disabled: state = _("disabled") icon = self.iconDisabled else: state = _("done!") icon = self.iconDone icon and res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, icon)) orbpos = self.getOrbitalPos(timer.service_ref) orbposWidth = getTextBoundarySize(self.instance, self.font, self.l.getItemSize(), orbpos).width() res.append((eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft, self.rowSplit, orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT|RT_VALIGN_TOP, orbpos)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, self.rowSplit, self.satPosLeft - self.iconWidth - self.iconMargin, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT|RT_VALIGN_TOP, state)) res.append((eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft + orbposWidth, self.rowSplit, width - self.satPosLeft - orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_RIGHT|RT_VALIGN_TOP, text)) return res
def buildMovieListEntry(self, serviceref, info, begin, data): switch = config.usage.show_icons_in_movielist.value ext = config.movielist.useextlist.value width = self.l.getItemSize().width() pathName = serviceref.getPath() res = [None] if ext != '0': ih = self.itemHeight // 2 else: ih = self.itemHeight if skin.getSkinFactor() == 1.5: listBeginX = 3 listEndX = 3 listMarginX = 12 pathIconSize = 29 dataIconSize = 25 progressIconSize = 25 progressBarSize = 72 textPosY = 2 else: listBeginX = 2 listEndX = 2 listMarginX = 8 pathIconSize = 25 dataIconSize = 21 progressIconSize = 21 progressBarSize = 48 textPosY = 1 textPosX = listBeginX + dataIconSize + listMarginX if serviceref.flags & eServiceReference.mustDescent: # Directory iconSize = pathIconSize iconPosX = listBeginX - 1 iconPosY = ih / 2 - iconSize / 2 if iconPosY < iconPosX: iconPosY = iconPosX # Name is full path name if info is None: # Special case: "parent" txt = ".." else: p = os.path.split(pathName) if not p[1]: # if path ends in '/', p is blank. p = os.path.split(p[0]) txt = p[1] if txt == ".Trash": dateSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), _("Trashcan")).width() res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=self.iconTrash)) res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_("Deleted items"))) res.append( MultiContentEntryText( pos=(width - dateSize - listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Trashcan"))) return res dateSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), _("Directory")).width() res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=self.iconFolder)) res.append( MultiContentEntryText(pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=txt)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, textPosY), size=(dateSize, self.itemHeight), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=_("Directory"))) return res if (data == -1) or (data is None): data = MovieListData() cur_idx = self.l.getCurrentSelectionIndex() x = self.list[cur_idx] # x = ref,info,begin,... data.len = 0 #dont recalc movielist to speedup loading the list self.list[cur_idx] = ( x[0], x[1], x[2], data ) #update entry in list... so next time we don't need to recalc data.txt = info.getName(serviceref) if config.movielist.hide_extensions.value: fileName, fileExtension = os.path.splitext(data.txt) if fileExtension in KNOWN_EXTENSIONS: data.txt = fileName data.icon = None data.part = None if os.path.split(pathName)[1] in self.runningTimers: if switch == 'i': if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlayRec else: data.icon = self.iconMovieRec elif switch == 'p' or switch == 's': data.part = 100 if (self.playInBackground or self.playInForeground ) and serviceref == (self.playInBackground or self.playInForeground): data.partcol = 0xffc71d else: data.partcol = 0xff001d elif (self.playInBackground or self.playInForeground) and serviceref == ( self.playInBackground or self.playInForeground): data.icon = self.iconMoviePlay else: data.part = moviePlayState(pathName + '.cuts', serviceref, data.len) if switch == 'i': if data.part is not None and data.part > 0: data.icon = self.iconPart[data.part // 25] else: if config.usage.movielist_unseen.value: data.icon = self.iconUnwatched elif switch == 'p' or switch == 's': if data.part is not None and data.part > 0: data.partcol = 0xffc71d else: if config.usage.movielist_unseen.value: data.part = 100 data.partcol = 0x206333 len = data.len if len > 0: len = "%d:%02d" % (len // 60, len % 60) else: len = "" iconSize = 0 if switch == 'i': iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 2 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon)) elif switch == 'p': if data.part is not None and data.part > 0: iconSize = progressBarSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 8 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryProgress(pos=(iconPosX, iconPosY), size=(iconSize, iconSize // 4), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: iconSize = dataIconSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 2 if iconPosY < iconPosX: iconPosY = iconPosX res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon)) elif switch == 's': iconSize = progressIconSize iconPosX = listBeginX iconPosY = ih // 2 - iconSize // 2 if iconPosY < iconPosX: iconPosY = iconPosX if data.part is not None and data.part > 0: res.append( MultiContentEntryProgress(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), percent=data.part, borderWidth=2, foreColor=data.partcol, foreColorSelected=None, backColor=None, backColorSelected=None)) else: res.append( MultiContentEntryPixmapAlphaBlend(pos=(iconPosX, iconPosY), size=(iconSize, iconSize), png=data.icon)) begin_string = "" if begin > 0: begin_string = ', '.join(FuzzyTime(begin, inPast=True)) dateSize = serviceSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), begin_string).width() if iconSize: textPosX = listBeginX + iconSize + listMarginX else: textPosX = listBeginX if ext != '0': getrec = info.getName(serviceref) fileName, fileExtension = os.path.splitext(getrec) desc = None picon = None service = None try: serviceHandler = eServiceCenter.getInstance() info = serviceHandler.info(serviceref) desc = info.getInfoString( serviceref, iServiceInformation.sDescription) # get description ref = info.getInfoString( serviceref, iServiceInformation.sServiceref) # get reference service = ServiceReference( ref).getServiceName() # get service name serviceSize = getTextBoundarySize(self.instance, self.dateFont, self.l.getItemSize(), service).width() except Exception as e: print(('[MovieList] load extended infos get failed: ', e)) if ext == '2': try: picon = getPiconName(ref) picon = loadPNG(picon) except Exception as e: print(('[MovieList] load picon get failed: ', e)) if fileExtension in RECORD_EXTENSIONS: if ext == '1': res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - serviceSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryText( pos=(width - serviceSize - listEndX, textPosY), size=(serviceSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=service)) if ext == '2': piconSize = ih * 1.667 res.append( MultiContentEntryText( pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryPixmapAlphaBlend( pos=(width - piconSize - listEndX, listEndX), size=(piconSize, ih), png=picon, flags=BT_SCALE | BT_KEEP_ASPECT_RATIO)) res.append( MultiContentEntryText(pos=(listBeginX, ih + textPosY), size=(width - listBeginX - dateSize - listMarginX - listEndX, ih), font=1, flags=RT_HALIGN_LEFT, text=desc)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, ih + textPosY), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: res.append( MultiContentEntryText(pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, ih), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT, text=begin_string)) return res else: res.append( MultiContentEntryText(pos=(textPosX, 0), size=(width - textPosX - dateSize - listMarginX - listEndX, ih), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=data.txt)) res.append( MultiContentEntryText(pos=(width - dateSize - listEndX, textPosY), size=(dateSize, ih), font=1, flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER, text=begin_string)) return res
def buildTimerEntry(self, timer, processed): height = self.l.getItemSize().height() width = self.l.getItemSize().width() res = [None] serviceName = " " + timer.service_ref.getServiceName() serviceNameWidth = getTextBoundarySize( self.instance, self.serviceNameFont, self.l.getItemSize(), serviceName ).width() if 200 > width - serviceNameWidth - self.iconWidth - self.iconMargin: serviceNameWidth = width - 200 - self.iconWidth - self.iconMargin res.append( ( eListboxPythonMultiContent.TYPE_TEXT, width - serviceNameWidth, 0, serviceNameWidth, self.rowSplit, 0, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, serviceName, ) ) res.append( ( eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, 0, width - serviceNameWidth - self.iconWidth - self.iconMargin, self.rowSplit, 2, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timer.name, ) ) begin = FuzzyTime(timer.begin) if timer.repeated: days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun")) repeatedtext = [] flags = timer.repeated for x in (0, 1, 2, 3, 4, 5, 6): if flags & 1 == 1: repeatedtext.append(days[x]) flags >>= 1 repeatedtext = ", ".join(repeatedtext) if self.iconRepeat: res.append( ( eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, self.rowSplit + (self.itemHeight - self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, self.iconRepeat, ) ) else: repeatedtext = begin[0] if timer.justplay: if timer.end > timer.begin + 3: text = repeatedtext + (" %s ... %s (" + _("ZAP") + ", %d " + _("mins") + ")") % ( begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60, ) else: text = repeatedtext + (" %s (" + _("ZAP") + ")") % begin[1] else: text = repeatedtext + (" %s ... %s (%d " + _("mins") + ")") % ( begin[1], FuzzyTime(timer.end)[1], (timer.end - timer.begin) / 60, ) icon = None if not processed: if timer.state == TimerEntry.StateWaiting: state = _("waiting") if timer.isAutoTimer: icon = self.iconAutoTimer else: icon = self.iconWait elif timer.state == TimerEntry.StatePrepared: state = _("about to start") icon = self.iconPrepared elif timer.state == TimerEntry.StateRunning: if timer.justplay: state = _("zapped") icon = self.iconZapped else: state = _("recording...") icon = self.iconRecording elif timer.state == TimerEntry.StateEnded: state = _("done!") icon = self.iconDone else: state = _("<unknown>") icon = None elif timer.disabled: state = _("disabled") icon = self.iconDisabled elif timer.failed: state = _("failed") icon = self.iconFailed else: state = _("done!") icon = self.iconDone icon and res.append( ( eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2, self.iconWidth, self.iconHeight, icon, ) ) orbpos = self.getOrbitalPos(timer.service_ref) orbposWidth = getTextBoundarySize(self.instance, self.font, self.l.getItemSize(), orbpos).width() res.append( ( eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft, self.rowSplit, orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, orbpos, ) ) res.append( ( eListboxPythonMultiContent.TYPE_TEXT, self.iconWidth + self.iconMargin, self.rowSplit, self.satPosLeft - self.iconWidth - self.iconMargin, self.itemHeight - self.rowSplit, 1, RT_HALIGN_LEFT | RT_VALIGN_TOP, state, ) ) res.append( ( eListboxPythonMultiContent.TYPE_TEXT, self.satPosLeft + orbposWidth, self.rowSplit, width - self.satPosLeft - orbposWidth, self.itemHeight - self.rowSplit, 1, RT_HALIGN_RIGHT | RT_VALIGN_TOP, text, ) ) line = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "div-h.png")) res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0, height - 2, width, 2, line)) return res
def setMode(self, mode): self.mode = mode self.setItemsPerPage() self.l.setItemHeight(self.ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) self.l.setServicePiconDownsize(int(config.usage.servicelist_picon_downsize.value)) if config.usage.service_icon_enable.value: if config.usage.use_custom_picon_dir.value: self.l.setGetPiconNameFunc(getServiceListPiconName) else: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - 30 if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = 0 else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), '0000').width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), '00000').width() channelNumberSpace = self.fieldMargins self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, channelNumberWidth, self.ItemHeight)) self.l.setProgressBarMode(int(0)) progressWidth = self.progressBarWidth if 'perc' in config.usage.show_event_progress_in_servicelist.value: progressWidth = self.progressPercentWidth or self.progressBarWidth if 'left' in config.usage.show_event_progress_in_servicelist.value: if config.usage.double_line_mode.value == '1': self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, 0, progressWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) elif 'right' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins + 10), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace), self.ItemHeight)) if config.usage.double_line_mode.value == '1': if 'barleft' in config.usage.show_event_progress_in_servicelist.value: self.l.setProgressBarMode(int(1)) if config.usage.service_icon_enable.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace + 2 * int(self.ItemHeight) - self.fieldMargins - self.fieldMargins, self.ItemHeight / 2, self.progressBarWidth, 10)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, self.ItemHeight / 2, self.progressBarWidth, 10)) elif 'barright' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, self.ItemHeight / 2, self.progressBarWidth, 10)) elif 'percleft' in config.usage.show_event_progress_in_servicelist.value: self.l.setProgressBarMode(int(1)) if config.usage.service_icon_enable.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace + 2 * int(self.ItemHeight) - self.progressBarWidth / 2, self.ItemHeight / 2, self.progressBarWidth + 10, 10)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, self.ItemHeight / 2, self.progressBarWidth + 10, 10)) elif 'percright' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, self.ItemHeight / 2, self.progressBarWidth + 10, 10)) self.l.setElementPosition(self.l.celServiceInfo, eRect(channelNumberWidth + channelNumberSpace, self.ItemHeight / 2, rowWidth - (channelNumberWidth + channelNumberSpace + self.progressBarWidth + self.fieldMargins), self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) if 'perc' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, self.ServiceInfoFont) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setDoubleLineMode(int(config.usage.double_line_mode.value)) self.l.setColumnWidth(int(config.usage.servicelist_column.value)) return
def setMode(self, mode): self.mode = mode self.setItemsPerPage() self.l.setItemHeight(self.ItemHeight) self.l.setVisualMode(eListboxServiceContent.visModeComplex) self.l.setServicePiconDownsize(int(config.usage.servicelist_picon_downsize.value)) if config.usage.service_icon_enable.value: self.l.setGetPiconNameFunc(getPiconName) else: self.l.setGetPiconNameFunc(None) rowWidth = self.instance.size().width() - 30 if mode == self.MODE_NORMAL or not config.usage.show_channel_numbers_in_servicelist.value: channelNumberWidth = 0 channelNumberSpace = 0 else: channelNumberWidth = config.usage.alternative_number_mode.value and getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), '0000').width() or getTextBoundarySize(self.instance, self.ServiceNumberFont, self.instance.size(), '00000').width() channelNumberSpace = self.fieldMargins self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, channelNumberWidth, self.ItemHeight)) self.l.setProgressBarMode(int(0)) progressWidth = self.progressBarWidth if 'perc' in config.usage.show_event_progress_in_servicelist.value: progressWidth = self.progressPercentWidth or self.progressBarWidth if 'left' in config.usage.show_event_progress_in_servicelist.value: if config.usage.double_line_mode.value == '1': self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, 0, progressWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins), self.ItemHeight)) elif 'right' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, 0, progressWidth, self.ItemHeight)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace + progressWidth + self.fieldMargins + 10), self.ItemHeight)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0)) self.l.setElementPosition(self.l.celServiceName, eRect(channelNumberWidth + channelNumberSpace, 0, rowWidth - (channelNumberWidth + channelNumberSpace), self.ItemHeight)) if config.usage.double_line_mode.value == '1': if 'barleft' in config.usage.show_event_progress_in_servicelist.value: self.l.setProgressBarMode(int(1)) if config.usage.service_icon_enable.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace + 2 * int(self.ItemHeight) - self.fieldMargins - self.fieldMargins, self.ItemHeight / 2, self.progressBarWidth, 10)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, self.ItemHeight / 2, self.progressBarWidth, 10)) elif 'barright' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, self.ItemHeight / 2, self.progressBarWidth, 10)) elif 'percleft' in config.usage.show_event_progress_in_servicelist.value: self.l.setProgressBarMode(int(1)) if config.usage.service_icon_enable.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace + 2 * int(self.ItemHeight) - self.progressBarWidth / 2, self.ItemHeight / 2, self.progressBarWidth + 10, 10)) else: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(channelNumberWidth + channelNumberSpace, self.ItemHeight / 2, self.progressBarWidth + 10, 10)) elif 'percright' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(rowWidth - progressWidth, self.ItemHeight / 2, self.progressBarWidth + 10, 10)) self.l.setElementPosition(self.l.celServiceInfo, eRect(channelNumberWidth + channelNumberSpace, self.ItemHeight / 2, rowWidth - (channelNumberWidth + channelNumberSpace + self.progressBarWidth + self.fieldMargins), self.ItemHeight)) self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont) self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont) self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont) if 'perc' in config.usage.show_event_progress_in_servicelist.value: self.l.setElementFont(self.l.celServiceEventProgressbar, self.ServiceInfoFont) self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value)) self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value)) self.l.setRecordIndicatorMode(int(config.usage.record_indicator_mode.value)) self.l.setDoubleLineMode(int(config.usage.double_line_mode.value)) self.l.setColumnWidth(int(config.usage.servicelist_column.value)) return