Ejemplo n.º 1
0
 def gotThreadMsg(self, msg):
     """Create Notifications if there is anything to display."""
     ret = self.__queue.pop()
     conflicts = ret[4]
     if conflicts and config.plugins.autotimer.notifconflict.value and Standby.inStandby is None:
         AddPopup(
             #_("%d conflict(s) encountered when trying to add new timers:\n%s") % (len(conflicts), '\n'.join([_("%s: %s at %s") % (x[4], x[0], asctime(localtime(x[2]))) for x in conflicts])),
             _("%d conflict(s) encountered when trying to add new timers:\n%s"
               ) % (len(conflicts), '\n'.join([
                   _("%s: %s at %s") %
                   (x[4], x[0], "('%s', '%s')" % FuzzyTime(x[2]))
                   for x in conflicts
               ])),
             MessageBox.TYPE_INFO,
             config.plugins.autotimer.popup_timeout.value,
             NOTIFICATIONID)
     similars = ret[5]
     if similars and config.plugins.autotimer.notifsimilar.value and Standby.inStandby is None:
         AddPopup(
             _("%d conflict(s) solved with similar timer(s):\n%s") %
             (len(similars), '\n'.join([
                 _("%s: %s at %s") %
                 (x[4], x[0], "('%s', '%s')" % FuzzyTime(x[2]))
                 for x in similars
             ])), MessageBox.TYPE_INFO,
             config.plugins.autotimer.popup_timeout.value,
             SIMILARNOTIFICATIONID)
     added_timer = ret[1]
     if added_timer and config.plugins.autotimer.notiftimers.value and Standby.inStandby is None:
         AddPopup(
             _("AutoTimer\n%d timer(s) were added.") % (ret[1]),
             MessageBox.TYPE_INFO,
             config.plugins.autotimer.popup_timeout.value,
             TIMERNOTIFICATIONID)
    def __init__(self, session, timers):
        Screen.__init__(self, session)

        # Sort timers by begin
        timers.sort(key=lambda x: x[1])
        self.sort_type = 0

        # name, begin, end, serviceref, timername -> name, begin, timername, sname, timestr
        self.timers = []
        for x in timers:
            serviceref = removeBad(ServiceReference(x[3]).getServiceName())
            if six.PY2:
                serviceref = serviceref.encode('utf-8', 'ignore')
            self.timers.append((x[0], x[1], x[4], serviceref,
                                (("%s, %s ... %s (%d " + _("mins") + ")") %
                                 (FuzzyTime(x[1]) + FuzzyTime(x[2])[1:] +
                                  ((x[2] - x[1]) / 60, )))))

        self["timerlist"] = List(self.timers)

        # Initialize Buttons
        self["key_red"] = StaticText(_("Cancel"))
        self["key_yellow"] = StaticText()

        self.setSortDescription()

        # Define Actions
        self["actions"] = ActionMap(["SetupActions", "ColorActions"], {
            "cancel": self.cancel,
            "save": self.save,
            "yellow": self.sort
        })

        self.onLayoutFinish.append(self.setCustomTitle)
Ejemplo n.º 3
0
 def JobMessage(self):
     if self.callback is not None:
         if self.simulateOnly == True:
             self.callback(self.autotimers, self.skipped)
         else:
             total = (self.new + self.modified + len(self.conflicting) +
                      len(self.existing) + len(self.similars))
             _result = (total, self.new, self.modified, self.autotimers,
                        self.conflicting, self.similars, self.existing,
                        self.skipped)
             self.callback(_result)
     elif self.autoPoll:
         if self.conflicting and config.plugins.autotimer.notifconflict.value:
             AddPopup(
                 _("%d conflict(s) encountered when trying to add new timers:\n%s"
                   ) % (len(self.conflicting), '\n'.join([
                       _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2]))
                       for x in self.conflicting
                   ])), MessageBox.TYPE_INFO, 15, CONFLICTNOTIFICATIONID)
         elif self.similars and config.plugins.autotimer.notifsimilar.value:
             AddPopup(
                 _("%d conflict(s) solved with similar timer(s):\n%s") %
                 (len(self.similars), '\n'.join([
                     _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2]))
                     for x in self.similars
                 ])), MessageBox.TYPE_INFO, 15, SIMILARNOTIFICATIONID)
     else:
         AddPopup(
             _("Found a total of %d matching Events.\n%d Timer were added and\n%d modified,\n%d conflicts encountered,\n%d unchanged,\n%d similars added."
               ) % ((self.new + self.modified + len(self.conflicting) +
                     len(self.existing) + len(self.similars)), self.new,
                    self.modified, len(self.conflicting), len(
                        self.existing), len(self.similars)),
             MessageBox.TYPE_INFO, 15, NOTIFICATIONID)
Ejemplo n.º 4
0
    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

        channel = []
        for t in timer.services:
            channel.append(ServiceReference(t).getServiceName())
        if len(channel) > 0:
            channel = ", ".join(channel)
        width = self.l.getItemSize().width()
        res = [None]
        x = (2 * width) // 3
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 52, 2, x - 26, 25, 0,
                    RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timer.name))
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 2, 47, width - 4, 25,
                    1, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, channel))

        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]))
            res.append(
                (eListboxPythonMultiContent.TYPE_TEXT, width - 150 - 4, 0, 150,
                 25, 1, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, timespan))

        if timer.hasTimeframe():
            begin = strftime("%a, %d %b", localtime(timer.getTimeframeBegin()))
            end = strftime("%a, %d %b", localtime(timer.getTimeframeEnd()))
            timespan = (("%s ... %s") % (begin, end))
            res.append(
                (eListboxPythonMultiContent.TYPE_TEXT, width - 200 - 4, 25,
                 200, 25, 1, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, timespan))

        if icon:
            res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 2,
                        24, 25, icon))
        res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 28, 5,
                    24, 25, rectypeicon))
        return res
Ejemplo n.º 5
0
    def updateState(self):
        cur = self["timerlist"].getCurrent()

        if cur:
            self["description"].setText(cur.description)
        else:
            self["description"].setText("")

        self.updateRedState(cur)
        self.updateGreenState(cur)
        self.updateYellowState(cur)
        self.updateBlueState(cur)

        if len(self.list) == 0:
            return
        timer = self['timerlist'].getCurrent()

        if timer:
            try:
                name = str(timer.name)
                time = "%s %s ... %s" % (FuzzyTime(
                    timer.begin)[0], FuzzyTime(
                        timer.begin)[1], FuzzyTime(timer.end)[1])
                duration = ("(%d " + _("mins") + ")") % (
                    (timer.end - timer.begin) / 60)
                service = str(timer.service_ref.getServiceName())

                if timer.state == RealTimerEntry.StateWaiting:
                    state = _("waiting")
                elif timer.state == RealTimerEntry.StatePrepared:
                    state = _("about to start")
                elif timer.state == RealTimerEntry.StateRunning:
                    if timer.justplay:
                        state = _("zapped")
                    else:
                        state = _("recording...")
                elif timer.state == RealTimerEntry.StateEnded:
                    state = _("done!")
                else:
                    state = _("<unknown>")
            except:
                name = ""
                time = ""
                duration = ""
                service = ""
                state = ""
        else:
            name = ""
            time = ""
            duration = ""
            service = ""
            state = ""
        for cb in self.onChangedEntry:
            cb(name, time, duration, service, state)
Ejemplo n.º 6
0
	def updateStatus(self):
		text = ""
		if epgimport.isImportRunning():
			src = epgimport.source
			text = self.importStatusTemplate % (src.description, epgimport.eventCount)
		self["status"].setText(text)
		if lastImportResult and (lastImportResult != self.lastImportResult):
			start, count = lastImportResult
			try:
				d, t = FuzzyTime(start, inPast=True)
			except:
				# Not all images have inPast
				d, t = FuzzyTime(start)
			self["statusbar"].setText(_("Last: %s %s, %d events") % (d, t, count))
			self.lastImportResult = lastImportResult
Ejemplo n.º 7
0
	def buildMovieListEntry(self, movieInfo):
		res = [ None ]
		if movieInfo.serviceref.flags & eServiceReference.mustDescent:
			res.extend(("[%s]" %(movieInfo.name,) , "", "", "", "", ""))
			return res

		duration = movieInfo.duration
		if duration > 0:
			duration = "%d:%02d" % (duration // 60, duration % 60)
		else:
			duration = ""


		begin_string = ""
		if movieInfo.begin > 0:
			t = FuzzyTime(movieInfo.begin)
			begin_string = t[0] + ", " + t[1]
		tags = " ".join(movieInfo.tags)
		if self.list_type == MovieList.LISTTYPE_ORIGINAL:
			res.extend((movieInfo.name, tags, movieInfo.servicename, movieInfo.description, begin_string, duration))
		elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
			res.extend((movieInfo.name, movieInfo.description, begin_string, movieInfo.servicename, duration))
		elif self.list_type == MovieList.LISTTYPE_COMPACT:
			res.extend((movieInfo.name, tags, movieInfo.servicename, begin_string, duration))
		else:
			assert(self.list_type == MovieList.LISTTYPE_MINIMAL)
			if self.descr_state == MovieList.SHOW_DESCRIPTION:
				res.extend((movieInfo.name, begin_string))
			else:
				res.extend((movieInfo.name, duration))
		return res
Ejemplo n.º 8
0
 def changedWhere(self, cfg):
     self.isActive = False
     if not cfg.value:
         self["status"].setText(
             _("No suitable media found, insert USB stick, flash card or harddisk."
               ))
         self.isActive = False
     else:
         config.plugins.autobackup.where.value = cfg.value
         path = os.path.join(cfg.value, 'backup')
         if not os.path.exists(path):
             self["status"].setText(_("No backup present"))
         else:
             try:
                 st = os.stat(os.path.join(path, ".timestamp"))
                 try:
                     macaddr = open('/sys/class/net/eth0/address').read(
                     ).strip().replace(':', '')
                     fn = "AutoBackup%s.tar.gz" % macaddr
                     st = os.stat(os.path.join(path, fn))
                 except:
                     # No box-specific backup found
                     pass
                 self.isActive = True
                 self["status"].setText(
                     _("Last backup date") + ": " +
                     " ".join(FuzzyTime(st.st_mtime, inPast=True)))
             except Exception, ex:
                 print "Failed to stat %s: %s" % (path, ex)
                 self["status"].setText(_("Disabled"))
Ejemplo n.º 9
0
 def gotThreadMsg(self, msg):
     """Create Notifications if there is anything to display."""
     ret = self.__queue.pop()
     conflicts = ret[4]
     if conflicts and config.plugins.autotimer.notifconflict.value:
         AddPopup(
             _("%d conflict(s) encountered when trying to add new timers:\n%s"
               ) % (len(conflicts), '\n'.join([
                   _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2]))
                   for x in conflicts
               ])), MessageBox.TYPE_INFO, 5, NOTIFICATIONID)
     similars = ret[5]
     if similars and config.plugins.autotimer.notifsimilar.value:
         AddPopup(
             _("%d conflict(s) solved with similar timer(s):\n%s") %
             (len(similars), '\n'.join([
                 _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2]))
                 for x in similars
             ])), MessageBox.TYPE_INFO, 5, SIMILARNOTIFICATIONID)
Ejemplo n.º 10
0
	def doremoveautoinstall(self):
		backupList = []
		foundBackupLocations = [media for media in os.listdir("/media/") if os.path.isdir(os.path.join("/media/", media))]
		for backupMedia in foundBackupLocations:
			path = "/media/%s/backup/" % backupMedia
			if os.path.isfile(path + "autoinstall") and os.path.isfile(path + ".timestamp"):
				try:
					st = os.stat(os.path.join(path, ".timestamp"))
					backupList.append(("/media/%s " % backupMedia + _("from: ") + " ".join(FuzzyTime(st.st_mtime, inPast=True)), "/media/%s" % backupMedia, st.st_mtime))
				except Exception, ex:
					print "Failed to stat %s: %s" % (path, ex)
    def keyInfo(self):
        lastscan = config.plugins.epgrefresh.lastscan.value
        if lastscan:
            from Tools.FuzzyDate import FuzzyTime
            scanDate = ', '.join(FuzzyTime(lastscan))
        else:
            scanDate = _("never")

        self.session.open(MessageBox,
                          _("Last refresh was %s") % (scanDate, ),
                          type=MessageBox.TYPE_INFO)
Ejemplo n.º 12
0
    def buildMovieListEntry(self, serviceref, info, begin, len):
        if serviceref.flags & eServiceReference.mustDescent:
            return None

        if len <= 0:  #recalc len when not already done
            cur_idx = self.l.getCurrentSelectionIndex()
            x = self.list[cur_idx]
            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)
        servicename = ""
        if service is not None:
            servicename = service.getServiceName()

        begin_string = ""
        if begin > 0:
            t = FuzzyTime(begin)
            begin_string = t[0] + ", " + t[1]

        if self.list_type == MovieList.LISTTYPE_ORIGINAL:
            res.extend(
                (txt, tags, servicename, description, begin_string, len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
            res.extend((txt, description, begin_string, servicename, len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT:
            res.extend((txt, tags, servicename, begin_string, len))
        else:
            assert (self.list_type == MovieList.LISTTYPE_MINIMAL)
            if self.descr_state == MovieList.SHOW_DESCRIPTION:
                res.extend((txt, begin_string))
            else:
                res.extend((txt, len))

        return res
Ejemplo n.º 13
0
    def getMovieList(self):
        self.movielist.reload(root=self.root, filter_tags=self.tagfilter)
        lst = []
        append = lst.append

        loadLength = config.plugins.Webinterface.loadmovielength.value
        for (serviceref, info, begin, unknown) in self.movielist.list:
            rtime = info.getInfo(serviceref, iServiceInformation.sTimeCreate)

            if rtime > 0:
                t = FuzzyTime(rtime)
                begin_string = t[0] + ", " + t[1]
            else:
                begin_string = _("undefined")

            if loadLength:
                Len = info.getLength(serviceref)
                if Len > 0:
                    Len = "%d:%02d" % (Len / 60, Len % 60)
                else:
                    Len = "?:??"
            else:
                Len = _("disabled")

            sourceERef = info.getInfoString(serviceref,
                                            iServiceInformation.sServiceref)
            sourceRef = ServiceReference(sourceERef)

            event = info.getEvent(serviceref)
            ext = event and event.getExtendedDescription() or ""

            filename = "/%s" % (serviceref.getPath(), )
            servicename = ServiceReference(
                serviceref).getServiceName().replace('\xc2\x86', '').replace(
                    '\xc2\x87', '')

            append((
                serviceref.toString(),
                servicename,
                info.getInfoString(serviceref,
                                   iServiceInformation.sDescription),
                rtime,
                begin_string,
                Len,
                sourceRef.getServiceName(),
                info.getInfoString(serviceref, iServiceInformation.sTags),
                ext,
                filename,
                info.getInfoObject(serviceref, iServiceInformation.sFileSize),
                self.checkStreamServerSeek(),
            ))
        return lst
Ejemplo n.º 14
0
	def getMovieList(self):
		self.movielist.reload(root=self.root, filter_tags=self.tagfilter)
		lst = []
		append = lst.append

		loadLength = config.plugins.Webinterface.loadmovielength.value
		for (serviceref, info, begin, unknown) in self.movielist.list:
			if serviceref.flags & eServiceReference.mustDescent:
				# Skip subdirectories (TODO: Browse?)
				continue
			rtime = info.getInfo(serviceref, iServiceInformation.sTimeCreate)

			if rtime > 0:
				t = FuzzyTime(rtime, inPast=True)
				begin_string = t[0] + ", " + t[1]
			else:
				begin_string = _("undefined")

			if loadLength:
				Len = info.getLength(serviceref)
				if Len > 0:
					Len = "%d:%02d" % (Len / 60, Len % 60)
				else:
					Len = "?:??"
			else:
				Len = _("disabled")

			sourceERef = info.getInfoString(serviceref, iServiceInformation.sServiceref)
			sourceRef = ServiceReference(sourceERef)

			event = info.getEvent(serviceref)
			ext = event and event.getExtendedDescription() or ""

			filename = "/" + "/".join(serviceref.toString().split("/")[1:])
			servicename = ServiceReference(serviceref).getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', '')

			append((
				serviceref.toString(),
				servicename,
				info.getInfoString(serviceref, iServiceInformation.sDescription),
				rtime,
				begin_string,
				Len,
				sourceRef.getServiceName(),
				info.getInfoString(serviceref, iServiceInformation.sTags),
				ext,
				filename,
				os_stat(filename)[6]
			))
		return lst
Ejemplo n.º 15
0
    def getMovieList(self):
        self.movielist.reload(root=self.root, filter_tags=self.tagfilter)
        list = []

        tag = self.cmd['tag']
        tag = tag and tag.lower()
        for (serviceref, info, begin, unknown) in self.movielist.list:
            if serviceref.flags & eServiceReference.mustDescent:
                # Skip subdirectories (TODO: Browse?)
                continue
            rtime = info.getInfo(serviceref, iServiceInformation.sTimeCreate)

            if rtime > 0:
                t = FuzzyTime(rtime, inPast=True)
                begin_string = t[0] + ", " + t[1]
            else:
                begin_string = "undefined"

            if config.plugins.Webinterface.loadmovielength.value:
                len = info.getLength(serviceref)
                if len > 0:
                    len = "%d:%02d" % (len / 60, len % 60)
                else:
                    len = "?:??"
            else:
                len = "disabled"

            sourceERef = info.getInfoString(serviceref,
                                            iServiceInformation.sServiceref)
            sourceRef = ServiceReference(sourceERef)

            event = info.getEvent(serviceref)
            ext = event and event.getExtendedDescription() or ""

            filename = "/" + "/".join(serviceref.toString().split("/")[1:])
            servicename = ServiceReference(
                serviceref).getServiceName().replace('\xc2\x86', '').replace(
                    '\xc2\x87', '')

            if not tag or tag in info.getInfoString(
                    serviceref, iServiceInformation.sTags).lower():
                """ add movie only to list, if a given tag is applied to the movie """
                list.append(
                    (serviceref.toString(), servicename,
                     info.getInfoString(serviceref,
                                        iServiceInformation.sDescription),
                     rtime, begin_string, len, sourceRef.getServiceName(),
                     info.getInfoString(serviceref, iServiceInformation.sTags),
                     ext, filename, os_stat(filename)[6]))
        return list
Ejemplo n.º 16
0
	def changedWhere(self, cfg):
		if not cfg.value:
			self["status"].setText(_("No suitable media found, insert USB stick, flash card or harddisk."))
		else:
			config.plugins.autobackup.where.value = cfg.value
			path = os.path.join(cfg.value, 'backup')
			try:
				if os.path.isfile(os.path.join(path, ".timestamp")) and os.path.isfile(os.path.join(path, "PLi-AutoBackup.tar.gz")):
					st = os.stat(os.path.join(path, ".timestamp"))
					self["status"].setText(_("Last backup date") + ": " + " ".join(FuzzyTime(st.st_mtime, inPast=True)))
				else:
					self["status"].setText(_("No backup present"))
			except Exception, ex:
				print "Failed to stat %s: %s" % (path, ex)
				self["status"].setText(_("No backup present"))
Ejemplo n.º 17
0
    def info(self):
        lastscan = config.downloader.autoupdate_last.value
        if lastscan:
            from Tools.FuzzyDate import FuzzyTime
            scanDate = ', '.join(FuzzyTime(lastscan))
        else:
            scanDate = _("never")

        try:
            nextTimer = str(
                iptvtimer.getNextTimerEntry()).split(",")[0].split("(")[1]
        except:
            nextTimer = "No Timer Configured"

        self.session.open(MessageBox,
                          _("Last refresh was %s\nNext timer: %s") %
                          (scanDate, nextTimer),
                          type=MessageBox.TYPE_INFO)
Ejemplo n.º 18
0
    def query(self):
        from plugin import autotimer

        # Ignore any program errors
        try:
            ret = autotimer.parseEPG()
        except Exception:
            # Dump error to stdout
            import traceback, sys
            traceback.print_exc(file=sys.stdout)
        else:
            conflicts = ret[4]
            if conflicts and config.plugins.autotimer.notifconflict.value:
                AddPopup(
                    _("%d conflict(s) encountered when trying to add new timers:\n%s"
                      ) % (len(conflicts), '\n'.join([
                          _("%s: %s at %s") % (x[4], x[0], FuzzyTime(x[2]))
                          for x in conflicts
                      ])), MessageBox.TYPE_INFO, 5, NOTIFICATIONID)

        self.timer.startLongTimer(config.plugins.autotimer.interval.value *
                                  3600)
Ejemplo n.º 19
0
    def buildMovieListEntry(self, serviceref, info, begin, data):

        showPicons = "picon" in config.usage.movielist_servicename_mode.value
        switch = config.usage.show_icons_in_movielist.value
        piconWidth = config.usage.movielist_piconwidth.value if showPicons else 0
        durationWidth = self.durationWidth if config.usage.load_length_of_movies_in_moviellist.value else 0

        width = self.l.getItemSize().width()

        dateWidth = self.dateWidth
        if not config.movielist.use_fuzzy_dates.value:
            dateWidth += 30

        iconSize = self.iconsWidth
        if switch == 'p':
            iconSize = self.pbarLargeWidth
        ih = self.itemHeight
        col0iconSize = piconWidth if showPicons else iconSize

        space = self.spaceIconeText
        r = self.spaceRight
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            # 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":
                    res.append(
                        MultiContentEntryPixmapAlphaTest(
                            pos=((col0iconSize - self.iconTrash.size().width())
                                 / 2, (self.itemHeight -
                                       self.iconFolder.size().height()) / 2),
                            size=(iconSize, self.iconTrash.size().height()),
                            png=self.iconTrash))
                    res.append(
                        MultiContentEntryText(
                            pos=(col0iconSize + space, 0),
                            size=(width - 145, self.itemHeight),
                            font=0,
                            flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                            text=_("Deleted items")))
                    res.append(
                        MultiContentEntryText(pos=(width - 185 - r, 0),
                                              size=(185, self.itemHeight),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT
                                              | RT_VALIGN_CENTER,
                                              text=_("Trash can")))
                    return res
            if not config.movielist.show_underlines.value:
                txt = txt.replace('_', ' ').strip()
            res.append(
                MultiContentEntryPixmapAlphaTest(
                    pos=((col0iconSize - self.iconFolder.size().width()) / 2,
                         (self.itemHeight - self.iconFolder.size().height()) /
                         2),
                    size=(iconSize, iconSize),
                    png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(col0iconSize + space, 0),
                                      size=(width - 145, self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - 145 - r, 0),
                                      size=(145, 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,...
            if config.usage.load_length_of_movies_in_moviellist.value:
                data.len = x[1].getLength(x[0])  #recalc the movie length...
            else:
                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
            if config.movielist.show_underlines.value:
                data.txt = info.getName(serviceref)
            else:
                data.txt = info.getName(serviceref).replace('_', ' ').strip()
            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 in ('p', 's'):
                    data.part = 100
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.partcol = self.pbarColourSeen
                    else:
                        data.partcol = self.pbarColourRec
            elif (self.playInBackground
                  or self.playInForeground) and serviceref == (
                      self.playInBackground or self.playInForeground):
                data.icon = self.iconMoviePlay
            elif pathName.endswith(
                    ".tmpcut.ts"
            ):  # cutting with moviecut plugin to same filename
                data.icon = self.iconCutting
            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 in ('p', 's'):
                    if data.part is not None and data.part > 0:
                        data.partcol = self.pbarColourSeen
                    else:
                        if config.usage.movielist_unseen.value:
                            data.part = 100
                            data.partcol = self.pbarColour

        colX = 0
        if switch == 'p':
            iconSize = self.pbarLargeWidth
        ih = self.itemHeight

        def addProgress():
            # icon/progress
            if data:
                if switch == 'i' and hasattr(data,
                                             'icon') and data.icon is not None:
                    res.append(
                        MultiContentEntryPixmapAlphaTest(
                            pos=(colX, self.partIconeShift),
                            size=(iconSize, data.icon.size().height()),
                            png=data.icon))
                elif switch in ('p', 's'):
                    if hasattr(data, 'part') and data.part > 0:
                        res.append(
                            MultiContentEntryProgress(pos=(colX,
                                                           self.pbarShift),
                                                      size=(iconSize,
                                                            self.pbarHeight),
                                                      percent=data.part,
                                                      borderWidth=2,
                                                      foreColor=data.partcol,
                                                      foreColorSelected=None,
                                                      backColor=None,
                                                      backColorSelected=None))
                    elif hasattr(data, 'icon') and data.icon is not None:
                        res.append(
                            MultiContentEntryPixmapAlphaTest(
                                pos=(colX, self.pbarShift),
                                size=(iconSize, self.pbarHeight),
                                png=data.icon))
            return iconSize

        serviceref = info.getInfoString(serviceref,
                                        iServiceInformation.sServiceref)
        displayPicon = None
        if piconWidth > 0:
            # Picon
            picon = getPiconName(serviceref)
            if picon != "":
                displayPicon = loadPNG(picon)
            if displayPicon is not None:
                res.append(
                    MultiContentEntryPixmapAlphaTest(
                        pos=(colX, 0),
                        size=(piconWidth, ih),
                        png=displayPicon,
                        backcolor=None,
                        backcolor_sel=None,
                        flags=BT_SCALE | BT_KEEP_ASPECT_RATIO
                        | BT_HALIGN_CENTER | BT_VALIGN_CENTER))
            colX = piconWidth
        else:
            colX = addProgress()

        # Recording name
        res.append(
            MultiContentEntryText(pos=(colX, 0),
                                  size=(width - iconSize - space -
                                        durationWidth - dateWidth - r - colX,
                                        ih),
                                  font=0,
                                  flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                  text=data.txt))
        colX = width - iconSize - space - durationWidth - dateWidth - r

        if piconWidth > 0:
            colX = addProgress()

        # Duration Mins
        if durationWidth > 0:
            if data:
                len = data.len
                if len > 0:
                    len = ngettext("%d Min", "%d Mins",
                                   (len / 60)) % (len / 60)
                    res.append(
                        MultiContentEntryText(pos=(colX + 880, 2),
                                              size=(durationWidth, ih),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT
                                              | RT_VALIGN_CENTER,
                                              text=len))

        # Date
        begin_string = ""
        if begin > 0:
            if config.movielist.use_fuzzy_dates.value:
                begin_string = ', '.join(FuzzyTime(begin, inPast=True))
            else:
                begin_string = strftime(
                    "%s, %s" % (config.usage.date.daylong.value,
                                config.usage.time.short.value),
                    localtime(begin))

        res.append(
            MultiContentEntryText(pos=(width - dateWidth - r - 130, 2),
                                  size=(dateWidth + 130, ih),
                                  font=1,
                                  flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                  text=begin_string))
        return res
Ejemplo n.º 20
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        width = self.l.getItemSize().width()
        iconSize = self.iconsWidth
        space = self.spaceIconeText
        r = self.spaceRight
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            # Name is full path name
            valign_center = 0
            if self.list_type == MovieList.LISTTYPE_MINIMAL:
                valign_center = RT_VALIGN_CENTER
            x = iconSize + space
            tn = self.treeDescription
            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":
                    res.append(
                        MultiContentEntryPixmapAlphaTest(
                            pos=(0, self.trashShift),
                            size=(iconSize, self.iconTrash.size().height()),
                            png=self.iconTrash))
                    res.append(
                        MultiContentEntryText(
                            pos=(x, 0),
                            size=(width - x - tn - r, self.itemHeight),
                            font=0,
                            flags=RT_HALIGN_LEFT | valign_center,
                            text=_("Deleted items")))
                    res.append(
                        MultiContentEntryText(pos=(width - tn - r, 0),
                                              size=(tn, self.itemHeight),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT
                                              | valign_center,
                                              text=_("Trash can")))
                    return res
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=(0, self.dirShift),
                                                 size=(iconSize, iconSize),
                                                 png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(x, 0),
                                      size=(width - x - tn - r,
                                            self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | valign_center,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - tn - r, 0),
                                      size=(tn, self.itemHeight),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT | 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,...
            if config.usage.load_length_of_movies_in_moviellist.value:
                data.len = x[1].getLength(x[0])  #recalc the movie length...
            else:
                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 self.playInBackground and serviceref == self.playInBackground:
                    data.icon = self.iconMoviePlayRec
                else:
                    data.icon = self.iconMovieRec
            elif self.playInBackground and serviceref == self.playInBackground:
                data.icon = self.iconMoviePlay
            else:
                switch = config.usage.show_icons_in_movielist.value
                data.part = moviePlayState(pathName + '.cuts', serviceref,
                                           data.len)
                if switch == 'i':
                    if data.part is None:
                        if config.usage.movielist_unseen.value:
                            data.icon = self.iconUnwatched
                    else:
                        data.icon = self.iconPart[data.part // 25]
                elif switch == 'p' or switch == 's':
                    if data.part is None:
                        if config.usage.movielist_unseen.value:
                            data.part = 0
                        data.partcol = 0x808080
                    else:
                        data.partcol = 0xf0f0f0
            service = ServiceReference(
                info.getInfoString(serviceref,
                                   iServiceInformation.sServiceref))
            if service is None:
                data.serviceName = None
            else:
                data.serviceName = service.getServiceName()
            data.description = info.getInfoString(
                serviceref, iServiceInformation.sDescription)

        len = data.len
        if len > 0:
            len = "%d:%02d" % (len / 60, len % 60)
        else:
            len = ""

        if data.icon is not None:
            if self.list_type in (MovieList.LISTTYPE_COMPACT_DESCRIPTION,
                                  MovieList.LISTTYPE_COMPACT):
                pos = (0, self.partIconeShiftCompact)
            elif self.list_type == MovieList.LISTTYPE_ORIGINAL:
                pos = (0, self.partIconeShiftOriginal)
            else:
                pos = (0, self.partIconeShiftMinimal)
            res.append(
                MultiContentEntryPixmapAlphaTest(
                    pos=pos,
                    size=(iconSize, data.icon.size().height()),
                    png=data.icon))
        switch = config.usage.show_icons_in_movielist.value
        if switch in ('p', 's'):
            if switch == 'p':
                iconSize = self.pbarLargeWidth
            if data.part is not None:
                res.append(
                    MultiContentEntryProgress(pos=(0, self.pbarShift),
                                              size=(iconSize, self.pbarHeight),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
        elif switch == 'i':
            pass
        else:
            iconSize = 0

        begin_string = ""
        if begin > 0:
            begin_string = ', '.join(FuzzyTime(begin, inPast=True))

        ih = self.itemHeight
        if self.list_type == MovieList.LISTTYPE_ORIGINAL:
            fc, sc = self.columnsOriginal[0], self.columnsOriginal[1]
            ih1 = (ih * 2) / 5  # 75 -> 30
            ih2 = (ih * 2) / 3  # 75 -> 50
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - fc - r, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            if self.tags:
                res.append(
                    MultiContentEntryText(pos=(width - fc - r, 0),
                                          size=(fc, ih1),
                                          font=2,
                                          flags=RT_HALIGN_RIGHT,
                                          text=info.getInfoString(
                                              serviceref,
                                              iServiceInformation.sTags)))
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(sc - r, ih2),
                                              size=(sc, ih2 - ih1),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=data.serviceName))
            else:
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(width - fc - r, 0),
                                              size=(fc, ih1),
                                              font=2,
                                              flags=RT_HALIGN_RIGHT,
                                              text=data.serviceName))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(width - r, ih2 - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.description))
            res.append(
                MultiContentEntryText(pos=(0, ih2),
                                      size=(sc - r, ih - ih2),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            if len:
                res.append(
                    MultiContentEntryText(pos=(width - sc - r, ih2),
                                          size=(sc, ih - ih2),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT_DESCRIPTION:
            ih1 = ((ih * 8) + 14) / 15  # 37 -> 20, round up
            if len:
                lenSize = 58 * ih / 37
            else:
                lenSize = 0
            fc, sc, tc = self.columnsCompactDescription[
                0], self.columnsCompactDescription[
                    1], self.columnsCompactDescription[2]
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - sc - r, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(width - tc - lenSize - r,
                                            ih - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.description))
            res.append(
                MultiContentEntryText(pos=(width - fc - r, 6),
                                      size=(fc, ih1),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=begin_string))
            if data.serviceName:
                res.append(
                    MultiContentEntryText(pos=(width - tc - lenSize - r, ih1),
                                          size=(tc, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=data.serviceName))
            if lenSize:
                res.append(
                    MultiContentEntryText(pos=(width - lenSize - r, ih1),
                                          size=(lenSize, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        elif self.list_type == MovieList.LISTTYPE_COMPACT:
            col = self.compactColumn
            ih1 = ((ih * 8) + 14) / 15  # 37 -> 20, round up
            if len:
                lenSize = 2 * ih
            else:
                lenSize = 0
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - lenSize - iconSize -
                                            space - r, ih1),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=data.txt))
            if self.tags:
                res.append(
                    MultiContentEntryText(pos=(width - col - r, ih1),
                                          size=(col, ih - ih1),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=info.getInfoString(
                                              serviceref,
                                              iServiceInformation.sTags)))
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(col, ih1),
                                              size=(col, ih - ih1),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=data.serviceName))
            else:
                if data.serviceName:
                    res.append(
                        MultiContentEntryText(pos=(width - col - r, ih1),
                                              size=(col, ih - ih1),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=data.serviceName))
            res.append(
                MultiContentEntryText(pos=(0, ih1),
                                      size=(col, ih - ih1),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            if lenSize:
                res.append(
                    MultiContentEntryText(pos=(width - lenSize - r, 0),
                                          size=(lenSize, ih1),
                                          font=0,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        else:
            if (self.descr_state == MovieList.SHOW_DESCRIPTION) or not len:
                dateSize = ih * 145 / 25  # 25 -> 145
                res.append(
                    MultiContentEntryText(
                        pos=(iconSize + space, 0),
                        size=(width - iconSize - space - dateSize - r, ih),
                        font=0,
                        flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                        text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - dateSize - r, 4),
                                          size=(dateSize, ih),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT
                                          | RT_VALIGN_CENTER,
                                          text=begin_string))
            else:
                lenSize = ih * 3  # 25 -> 75
                res.append(
                    MultiContentEntryText(pos=(iconSize + space, 0),
                                          size=(width - lenSize - iconSize -
                                                space - r, ih),
                                          font=0,
                                          flags=RT_HALIGN_LEFT,
                                          text=data.txt))
                res.append(
                    MultiContentEntryText(pos=(width - lenSize - r, 0),
                                          size=(lenSize, ih),
                                          font=0,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        return res
Ejemplo n.º 21
0
    def buildListboxEntry(self, timer):
        if self.style_autotimerslist == "standard":
            size = self.l.getItemSize()
            color = None
            if not timer.enabled:
                color = self.colorDisabled
            return [
                None,
                (eListboxPythonMultiContent.TYPE_TEXT, 5, 0, size.width() - 5,
                 size.height(), 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                 timer.name, color, color)
            ]
        else:
            if not timer.enabled:
                icon = self.iconDisabled
            else:
                icon = self.iconEnabled
            if timer.justplay:
                rectypeicon = self.iconZapped
            else:
                rectypeicon = self.iconRecording

            channel = []
            if timer.services is not None:
                for t in timer.services:
                    channel.append(ServiceReference(t).getServiceName())
            elif timer.bouquets is not None:
                for x in timer.bouquets:
                    channel.append(
                        ServiceReference(str(x)).getServiceName().replace(
                            '\xc2\x86', '').replace('\xc2\x87', ''))
            if len(channel) > 0:
                channel = ", ".join(channel)
            else:
                channel = _('All channels')
            height = self.l.getItemSize().height()
            width = self.l.getItemSize().width()
            res = [None]
            x = (2 * width) // 3
            res.append((eListboxPythonMultiContent.TYPE_TEXT, 52, 2, x - 26,
                        32 if HD else 25, 0, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM,
                        timer.name))
            res.append(
                (eListboxPythonMultiContent.TYPE_TEXT, 2, 68 if HD else 47,
                 width - 4, 25, 1, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, channel))

            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 * 4.5 + 1, 27 if HD else 25,
                        float(width) / 10 * 5.5 - 5, 25, 1,
                        RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, days))

            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, width - 150 - 4, 1, 150,
                 25, 1, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, timespan))

            if timer.hasTimeframe():
                begin = strftime("%a, %d %b",
                                 localtime(timer.getTimeframeBegin()))
                end = strftime("%a, %d %b", localtime(timer.getTimeframeEnd()))
                timespan = (("%s ... %s") % (begin, end))
                res.append(
                    (eListboxPythonMultiContent.TYPE_TEXT, 2, 38 if HD else 25,
                     float(width) / 10 * 4.5 - 5, 25, 1,
                     RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timespan))

            if icon:
                res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST,
                            2, 2, 24, 25, icon))
            res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 28,
                        5, 24, 25, rectypeicon))
            devide = LoadPixmap(
                resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
            res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0,
                        height - 2, width, 1, devide))
            return res
Ejemplo n.º 22
0
    def updateState(self):
        cur = self["timerlist"].getCurrent()
        if cur:
            self["description"].setText(cur.description)
            if self.key_red_choice != self.DELETE:
                self["actions"].actions.update(
                    {"red": self.removeTimerQuestion})
                self["key_red"].setText(_("Delete"))
                self.key_red_choice = self.DELETE

            if cur.disabled and (self.key_yellow_choice != self.ENABLE):
                self["actions"].actions.update(
                    {"yellow": self.toggleDisabledState})
                self["key_yellow"].setText(_("Enable"))
                self.key_yellow_choice = self.ENABLE
            elif cur.isRunning() and not cur.repeated and (
                    self.key_yellow_choice != self.STOP):
                self["actions"].actions.update(
                    {"yellow": self.removeTimerQuestion})
                self["key_yellow"].setText(_("Stop"))
                self.key_yellow_choice = self.STOP
            elif ((not cur.isRunning())
                  or cur.repeated) and (not cur.disabled) and (
                      self.key_yellow_choice != self.DISABLE):
                self["actions"].actions.update(
                    {"yellow": self.toggleDisabledState})
                self["key_yellow"].setText(_("Disable"))
                self.key_yellow_choice = self.DISABLE
        else:
            self["description"].setText(" ")
            if self.key_red_choice != self.EMPTY:
                self.removeAction("red")
                self["key_red"].setText(" ")
                self.key_red_choice = self.EMPTY
            if self.key_yellow_choice != self.EMPTY:
                self.removeAction("yellow")
                self["key_yellow"].setText(" ")
                self.key_yellow_choice = self.EMPTY

        showCleanup = True
        for x in self.list:
            if (not x[0].disabled) and (x[1] == True):
                break
        else:
            showCleanup = False

        if showCleanup and (self.key_blue_choice != self.CLEANUP):
            self["actions"].actions.update({"blue": self.cleanupQuestion})
            self["key_blue"].setText(_("Cleanup"))
            self.key_blue_choice = self.CLEANUP
        elif (not showCleanup) and (self.key_blue_choice != self.EMPTY):
            self.removeAction("blue")
            self["key_blue"].setText(" ")
            self.key_blue_choice = self.EMPTY
        if len(self.list) == 0:
            return
        timer = self['timerlist'].getCurrent()

        if timer:
            try:
                name = str(timer.name)
                time = "%s %s ... %s" % (FuzzyTime(
                    timer.begin)[0], FuzzyTime(
                        timer.begin)[1], FuzzyTime(timer.end)[1])
                duration = ("(%d " + _("mins") + ")") % (
                    (timer.end - timer.begin) / 60)
                service = str(timer.service_ref.getServiceName())

                if timer.state == RealTimerEntry.StateWaiting:
                    state = _("waiting")
                elif timer.state == RealTimerEntry.StatePrepared:
                    state = _("about to start")
                elif timer.state == RealTimerEntry.StateRunning:
                    if timer.justplay:
                        state = _("zapped")
                    else:
                        state = _("recording...")
                elif timer.state == RealTimerEntry.StateEnded:
                    state = _("done!")
                else:
                    state = _("<unknown>")
            except:
                name = ""
                time = ""
                duration = ""
                service = ""
        else:
            name = ""
            time = ""
            duration = ""
            service = ""
        for cb in self.onChangedEntry:
            cb(name, time, duration, service, state)

        if config.usage.timerlist_show_epg.value:
            event = self.getEPGEvent(cur)
            if event:
                self["Event"].newEvent(event)
                self["ServiceEvent"].newService(cur.service_ref.ref)
Ejemplo n.º 23
0
    def buildMovieListEntry(self, serviceref, info, begin, tinfo):
        #		print("[SF-Plugin] SF:MovieList.buildMovieListEntry, lst_type=%x, show_tims=%x" % (self.list_type, self.show_times))

        width = self.l.getItemSize().width()
        len = tinfo[5]  #tinfo = [type, pixmap, txt, description, service, len]

        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][3][
                5] = 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]
        begin_string = ""
        date_string = ""

        pixmap = tinfo[1]
        typ = tinfo[0]
        service = None
        if typ & (self.VIRT_UP | self.REAL_UP):
            txt = tinfo[3]  # [2] == " " for alpha-sort to top
        else:
            txt = tinfo[2]
            if begin > 0:
                t = FuzzyTime(begin)
                begin_string = t[0] + ", " + t[1]
                date_string = t[0]
        if not typ & (self.REAL_DIR | self.VIRT_ENTRY):
            service = tinfo[4]
        description = tinfo[3]
        tags = self.tags and info.getInfoString(serviceref,
                                                iServiceInformation.sTags)

        if isinstance(pixmap, str):
            pixmap = MultiContentEntryText(pos=(0, 0),
                                           size=(25, 20),
                                           font=0,
                                           flags=RT_HALIGN_LEFT,
                                           text=pixmap)
        if pixmap is not None:
            res.append(pixmap)

        XPOS = 25

        if self.list_type & MovieList.LISTTYPE_ORIGINAL:
            res.append(
                MultiContentEntryText(pos=(XPOS, 0),
                                      size=(width, 30),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=txt))
            line2 = 20
            if self.list == self.sflists[0]:
                line2 = 50
                if not typ & (self.REAL_DIR | self.VIRT_ENTRY):
                    res.append(
                        MultiContentEntryText(pos=(XPOS, 30),
                                              size=(width, 20),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=description))
            res.append(
                MultiContentEntryText(pos=(XPOS, line2),
                                      size=(150, 20),
                                      font=1,
                                      flags=RT_HALIGN_LEFT,
                                      text=begin_string))
            if service:
                res.append(
                    MultiContentEntryText(pos=(XPOS + 150, line2),
                                          size=(180, 20),
                                          font=2,
                                          flags=RT_HALIGN_RIGHT,
                                          text=service))
            if tags:
                res.append(
                    MultiContentEntryText(pos=(width - 250, line2),
                                          size=(180, 20),
                                          font=2,
                                          flags=RT_HALIGN_RIGHT,
                                          text=tags))
            if not typ & (self.REAL_DIR | self.VIRT_ENTRY):
                res.append(
                    MultiContentEntryText(pos=(width - 60, line2),
                                          size=(60, 20),
                                          font=2,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
            return res

        tslen = 80
        if self.show_times & self.SHOW_RECORDINGTIME:
            tslen += 50
            date_string = begin_string
        dusz = 0
        if self.show_times & self.SHOW_DURATION and not tinfo[0] & (
                self.VIRT_ENTRY | self.REAL_UP):
            dusz = 57

        if self.list_type & MovieList.LISTTYPE_COMPACT:
            res.append(
                MultiContentEntryText(pos=(XPOS, 4),
                                      size=(tslen - 5, 20),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=date_string))
            res.append(
                MultiContentEntryText(pos=(XPOS + tslen, 0),
                                      size=(width - XPOS - tslen, 20),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=txt))
            other = None
            if self.list_type & MovieList.LISTTYPE_COMPACT_TAGS:
                if tags:
                    res.append(
                        MultiContentEntryText(pos=(width - dusz - 185, 20),
                                              size=(180, 17),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=tags))
                otherend = dusz + 185
                other = service
            else:
                if service:
                    res.append(
                        MultiContentEntryText(pos=(width - dusz - 155, 20),
                                              size=(153, 17),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT,
                                              text=service))
                otherend = dusz + 160
                other = tags
            if self.list == self.sflists[0]:
                if not typ & (self.REAL_DIR | self.VIRT_ENTRY):
                    res.append(
                        MultiContentEntryText(pos=(XPOS, 20),
                                              size=(width - (XPOS + otherend),
                                                    17),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=description))
                elif other:
                    res.append(
                        MultiContentEntryText(pos=(XPOS, 20),
                                              size=(width - (XPOS + otherend),
                                                    17),
                                              font=1,
                                              flags=RT_HALIGN_LEFT,
                                              text=other))
            if dusz:
                res.append(
                    MultiContentEntryText(pos=(width - dusz, 20),
                                          size=(dusz - 2, 20),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))
        else:
            #			assert(self.list_type == MovieList.LISTTYPE_MINIMAL)
            res.append(
                MultiContentEntryText(pos=(XPOS, 3),
                                      size=(tslen - 5, 20),
                                      font=1,
                                      flags=RT_HALIGN_RIGHT,
                                      text=date_string))
            res.append(
                MultiContentEntryText(pos=(XPOS + tslen, 0),
                                      size=(width - XPOS - tslen - dusz, 20),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=txt))
            if dusz:
                res.append(
                    MultiContentEntryText(pos=(width - dusz, 3),
                                          size=(dusz, 20),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT,
                                          text=len))

        return res
Ejemplo n.º 24
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        switch = config.usage.show_icons_in_movielist.getValue()
        width = self.l.getItemSize().width()
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            iconSize = 22
            # 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":
                    res.append(
                        MultiContentEntryPixmapAlphaTest(pos=(0, 2),
                                                         size=(iconSize, 24),
                                                         png=self.iconTrash))
                    res.append(
                        MultiContentEntryText(pos=(iconSize + 2, 0),
                                              size=(width - 166,
                                                    self.itemHeight),
                                              font=0,
                                              flags=RT_HALIGN_LEFT,
                                              text=_("Deleted items")))
                    res.append(
                        MultiContentEntryText(pos=(width - 145, 0),
                                              size=(145, self.itemHeight),
                                              font=1,
                                              flags=RT_HALIGN_RIGHT
                                              | RT_VALIGN_CENTER,
                                              text=_("Trashcan")))
                    return res
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=(0, 2),
                                                 size=(iconSize, iconSize),
                                                 png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(iconSize + 2, 0),
                                      size=(width - 166, self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - 145, 0),
                                      size=(145, 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.getValue():
                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.getValue():
                            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.getValue():
                            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 = 22
            res.append(
                MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                 size=(iconSize, 20),
                                                 png=data.icon))
        elif switch == 'p':
            iconSize = 48
            if data.part is not None and data.part > 0:
                res.append(
                    MultiContentEntryProgress(pos=(0, 5),
                                              size=(iconSize - 2, 16),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
            else:
                res.append(
                    MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                     size=(iconSize, 20),
                                                     png=data.icon))
        elif switch == 's':
            iconSize = 22
            if data.part is not None and data.part > 0:
                res.append(
                    MultiContentEntryProgress(pos=(0, 5),
                                              size=(iconSize - 2, 16),
                                              percent=data.part,
                                              borderWidth=2,
                                              foreColor=data.partcol,
                                              foreColorSelected=None,
                                              backColor=None,
                                              backColorSelected=None))
            else:
                res.append(
                    MultiContentEntryPixmapAlphaTest(pos=(0, 1),
                                                     size=(iconSize, 20),
                                                     png=data.icon))

        begin_string = ""
        if begin > 0:
            begin_string = ' '.join(FuzzyTime(begin, inPast=True))

        ih = self.itemHeight
        lenSize = ih * 3  # 25 -> 75
        dateSize = ih * 145 / 25  # 25 -> 145
        res.append(
            MultiContentEntryText(pos=(iconSize, 0),
                                  size=(width - iconSize - dateSize, ih),
                                  font=0,
                                  flags=RT_HALIGN_LEFT,
                                  text=data.txt))
        res.append(
            MultiContentEntryText(pos=(width - dateSize, 0),
                                  size=(dateSize, ih),
                                  font=1,
                                  flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                  text=begin_string))
        return res
Ejemplo n.º 25
0
    def buildTimerEntry(self, timer, processed):
        width = self.l.getItemSize().width()
        res = [None]
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, width, 30, 0,
                    RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                    timer.service_ref.getServiceName()))
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, width, 20, 1,
                    RT_HALIGN_LEFT | RT_VALIGN_CENTER, timer.name))

        repeatedtext = ""
        days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"),
                _("Sun"))
        if timer.repeated:
            flags = timer.repeated
            count = 0
            for x in (0, 1, 2, 3, 4, 5, 6):
                if (flags & 1 == 1):
                    if (count != 0):
                        repeatedtext += ", "
                    repeatedtext += days[x]
                    count += 1
                flags = flags >> 1
            if timer.justplay:
                res.append(
                    (eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width - 150,
                     20, 1, RT_HALIGN_LEFT | RT_VALIGN_CENTER, repeatedtext +
                     ((" %s " + _("(ZAP)")) % (FuzzyTime(timer.begin)[1]))))
            else:
                res.append(
                    (eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width - 150,
                     20, 1, RT_HALIGN_LEFT | RT_VALIGN_CENTER, repeatedtext +
                     ((" %s ... %s (%d " + _("mins") + ")") %
                      (FuzzyTime(timer.begin)[1], FuzzyTime(timer.end)[1],
                       (timer.end - timer.begin) / 60))))
        else:
            if timer.justplay:
                res.append(
                    (eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width - 150,
                     20, 1, RT_HALIGN_LEFT | RT_VALIGN_CENTER, repeatedtext +
                     (("%s, %s " + _("(ZAP)")) % (FuzzyTime(timer.begin)))))
            else:
                res.append(
                    (eListboxPythonMultiContent.TYPE_TEXT, 0, 50, width - 150,
                     20, 1, RT_HALIGN_LEFT | RT_VALIGN_CENTER, repeatedtext +
                     (("%s, %s ... %s (%d " + _("mins") + ")") %
                      (FuzzyTime(timer.begin) + FuzzyTime(timer.end)[1:] +
                       ((timer.end - timer.begin) / 60, )))))

        if not processed:
            if timer.state == TimerEntry.StateWaiting:
                state = _("waiting")
            elif timer.state == TimerEntry.StatePrepared:
                state = _("about to start")
            elif timer.state == TimerEntry.StateRunning:
                if timer.justplay:
                    state = _("zapped")
                else:
                    state = _("recording...")
            elif timer.state == TimerEntry.StateEnded:
                state = _("done!")
            else:
                state = _("<unknown>")
        else:
            state = _("done!")

        if timer.disabled:
            state = _("disabled")

        res.append((eListboxPythonMultiContent.TYPE_TEXT, width - 150, 50, 150,
                    20, 1, RT_HALIGN_RIGHT | RT_VALIGN_CENTER, state))

        if timer.disabled:
            png = LoadPixmap(
                resolveFilename(SCOPE_SKIN_IMAGE,
                                "skin_default/icons/redx.png"))
            res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 490,
                        5, 40, 40, png))
        return res
Ejemplo n.º 26
0
    def buildMovieListEntry(self, serviceref, info, begin, data):
        switch = config.usage.show_icons_in_movielist.value
        width = self.l.getItemSize().width()
        dateWidth = self.dateWidth
        if not config.movielist.use_fuzzy_dates.value:
            dateWidth += 30
        iconSize = self.iconsWidth
        space = self.spaceIconeText
        r = self.spaceRight
        pathName = serviceref.getPath()
        res = [None]

        if serviceref.flags & eServiceReference.mustDescent:
            # Directory
            # 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":
                res.append(
                    MultiContentEntryPixmapAlphaBlend(
                        pos=(0, self.trashShift),
                        size=(iconSize, self.iconTrash.size().height()),
                        png=self.iconTrash))
                res.append(
                    MultiContentEntryText(pos=(iconSize + space, 0),
                                          size=(width - 166, self.itemHeight),
                                          font=0,
                                          flags=RT_HALIGN_LEFT
                                          | RT_VALIGN_CENTER,
                                          text=_("Deleted items")))
                res.append(
                    MultiContentEntryText(pos=(width - 145 - r, 0),
                                          size=(145, self.itemHeight),
                                          font=1,
                                          flags=RT_HALIGN_RIGHT
                                          | RT_VALIGN_CENTER,
                                          text=_("Trash can")))
                return res
            res.append(
                MultiContentEntryPixmapAlphaBlend(pos=(0, self.dirShift),
                                                  size=(iconSize, iconSize),
                                                  png=self.iconFolder))
            res.append(
                MultiContentEntryText(pos=(iconSize + space, 0),
                                      size=(width - 166, self.itemHeight),
                                      font=0,
                                      flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                      text=txt))
            res.append(
                MultiContentEntryText(pos=(width - 145 - r, 0),
                                      size=(145, 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 in ('p', 's'):
                    data.part = 100
                    if (self.playInBackground or self.playInForeground
                        ) and serviceref == (self.playInBackground
                                             or self.playInForeground):
                        data.partcol = self.pbarColourSeen
                    else:
                        data.partcol = self.pbarColourRec
            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 in ('p', 's'):
                    if data.part is not None and data.part > 0:
                        data.partcol = self.pbarColourSeen
                    else:
                        if config.usage.movielist_unseen.value:
                            data.part = 100
                            data.partcol = self.pbarColour
        len = data.len
        if len > 0:
            len = "%d:%02d" % (len / 60, len % 60)
        else:
            len = ""

        if data:
            pos = (0, self.partIconeShift)
            if switch == 'i' and hasattr(data,
                                         'icon') and data.icon is not None:
                res.append(
                    MultiContentEntryPixmapAlphaBlend(
                        pos=pos,
                        size=(iconSize, data.icon.size().height()),
                        png=data.icon))
            elif switch in ('p', 's'):
                if switch == 'p':
                    iconSize = self.pbarLargeWidth
                if hasattr(data, 'part') and data.part > 0:
                    res.append(
                        MultiContentEntryProgress(pos=(0, self.pbarShift),
                                                  size=(iconSize,
                                                        self.pbarHeight),
                                                  percent=data.part,
                                                  borderWidth=2,
                                                  foreColor=data.partcol,
                                                  foreColorSelected=None,
                                                  backColor=None,
                                                  backColorSelected=None))
                elif hasattr(data, 'icon') and data.icon is not None:
                    res.append(
                        MultiContentEntryPixmapAlphaBlend(
                            pos=(0, self.pbarShift),
                            size=(iconSize, self.pbarHeight),
                            png=data.icon))

        begin_string = ""
        if begin > 0:
            if config.movielist.use_fuzzy_dates.value:
                begin_string = ', '.join(FuzzyTime(begin, inPast=True))
            else:
                begin_string = strftime(
                    "%s, %s" % (config.usage.date.daylong.value,
                                config.usage.time.short.value),
                    localtime(begin))

        ih = self.itemHeight
        res.append(
            MultiContentEntryText(pos=(iconSize + space, 0),
                                  size=(width - iconSize - space - dateWidth -
                                        r, ih),
                                  font=0,
                                  flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER,
                                  text=data.txt))
        res.append(
            MultiContentEntryText(pos=(width - dateWidth - r, 2),
                                  size=(dateWidth, ih),
                                  font=1,
                                  flags=RT_HALIGN_RIGHT | RT_VALIGN_CENTER,
                                  text=begin_string))
        return res
Ejemplo n.º 27
0
    def updateState(self):
        cur = self["timerlist"].getCurrent()
        if cur:
            if self.key_red_choice != self.DELETE:
                self["actions"].actions.update(
                    {"red": self.removeTimerQuestion})
                self["key_red"].setText(_("Delete"))
                self.key_red_choice = self.DELETE

            if cur.disabled and (self.key_yellow_choice != self.ENABLE):
                self["actions"].actions.update(
                    {"yellow": self.toggleDisabledState})
                self["key_yellow"].setText(_("Enable"))
                self.key_yellow_choice = self.ENABLE
            elif cur.isRunning() and not cur.repeated and (
                    self.key_yellow_choice != self.EMPTY):
                self.removeAction("yellow")
                self["key_yellow"].setText("")
                self.key_yellow_choice = self.EMPTY
            elif ((not cur.isRunning())
                  or cur.repeated) and (not cur.disabled) and (
                      self.key_yellow_choice != self.DISABLE):
                self["actions"].actions.update(
                    {"yellow": self.toggleDisabledState})
                self["key_yellow"].setText(_("Disable"))
                self.key_yellow_choice = self.DISABLE
        else:
            if self.key_red_choice != self.EMPTY:
                self.removeAction("red")
                self["key_red"].setText("")
                self.key_red_choice = self.EMPTY
            if self.key_yellow_choice != self.EMPTY:
                self.removeAction("yellow")
                self["key_yellow"].setText("")
                self.key_yellow_choice = self.EMPTY

        showCleanup = True
        for x in self.list:
            if (not x[0].disabled) and (x[1] == True):
                break
        else:
            showCleanup = False

        if showCleanup and (self.key_blue_choice != self.CLEANUP):
            self["actions"].actions.update({"blue": self.cleanupQuestion})
            self["key_blue"].setText(_("Cleanup"))
            self.key_blue_choice = self.CLEANUP
        elif (not showCleanup) and (self.key_blue_choice != self.EMPTY):
            self.removeAction("blue")
            self["key_blue"].setText("")
            self.key_blue_choice = self.EMPTY
        if len(self.list) == 0:
            return
        timer = self['timerlist'].getCurrent()

        if timer:
            name = gettimerType(timer)
            if getafterEvent(timer) == "Nothing":
                after = ""
            else:
                after = getafterEvent(timer)
            time = "%s %s ... %s" % (FuzzyTime(
                timer.begin)[0], FuzzyTime(timer.begin)[1], FuzzyTime(
                    timer.end)[1])
            duration = ("(%d " + _("mins") + ")") % (
                (timer.end - timer.begin) / 60)

            if timer.state == RealTimerEntry.StateWaiting:
                state = _("Waiting")
            elif timer.state == RealTimerEntry.StatePrepared:
                state = _("About to start")
            elif timer.state == RealTimerEntry.StateRunning:
                state = _("Running")
            elif timer.state == RealTimerEntry.StateEnded:
                state = _("Done")
            else:
                state = _("<Unknown>")
        else:
            name = ""
            after = ""
            time = ""
            duration = ""
            state = ""
        for cb in self.onChangedEntry:
            cb(name, after, time, duration, state)
Ejemplo n.º 28
0
    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
Ejemplo n.º 29
0
    def buildTimerEntry(self, timer, processed):
        screenwidth = getDesktop(0).size().width()
        timertype = {
            TIMERTYPE.WAKEUP: _("Wake Up"),
            TIMERTYPE.WAKEUPTOSTANDBY: _("Wake Up To Standby"),
            TIMERTYPE.STANDBY: _("Standby"),
            TIMERTYPE.AUTOSTANDBY: _("Auto Standby"),
            TIMERTYPE.AUTODEEPSTANDBY: _("Auto Deep Standby"),
            TIMERTYPE.DEEPSTANDBY: _("Deep Standby"),
            TIMERTYPE.REBOOT: _("Reboot"),
            TIMERTYPE.RESTART: _("Restart GUI")
        }[timer.timerType]

        afterevent = {
            AFTEREVENT.NONE: _("Nothing"),
            AFTEREVENT.WAKEUPTOSTANDBY: _("Wake Up To Standby"),
            AFTEREVENT.STANDBY: _("Standby"),
            AFTEREVENT.DEEPSTANDBY: _("Deep Standby")
        }[timer.afterEvent]

        height = self.l.getItemSize().height()
        width = self.l.getItemSize().width()
        res = [None]
        x = width / 2
        res.append((eListboxPythonMultiContent.TYPE_TEXT,
                    self.iconWidth + self.iconMargin, 2, width, self.rowSplit,
                    0, RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, timertype))
        if timer.timerType == TIMERTYPE.AUTOSTANDBY or timer.timerType == TIMERTYPE.AUTODEEPSTANDBY:
            if self.iconRepeat and timer.autosleeprepeat != "once":
                res.append(
                    (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND,
                     self.iconMargin / 2, self.rowSplit +
                     (self.itemHeight - self.rowSplit - self.iconHeight) / 2,
                     self.iconWidth, self.iconHeight, self.iconRepeat))
            icon = None
            if not processed:
                if timer.state == TimerEntry.StateWaiting:
                    state = _("waiting")
                    icon = self.iconWait
                elif timer.state == TimerEntry.StatePrepared or timer.state == TimerEntry.StateRunning:
                    state = _("running...")
                    icon = self.iconZapped
                elif timer.state == TimerEntry.StateEnded:
                    state = _("done!")
                    icon = self.iconDone
                else:
                    state = _("<unknown>")
                    icon = None
            else:
                state = _("done!")
                icon = self.iconDone
            res.append((eListboxPythonMultiContent.TYPE_TEXT, 148, 26,
                        width - 150, self.itemHeight - self.rowSplit, 2,
                        RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, _("Delay:") + " " +
                        str(timer.autosleepdelay) + "(" + _("mins") + ")"))
        else:
            res.append((eListboxPythonMultiContent.TYPE_TEXT, x + 24, 2,
                        x - 2 - 24, self.itemHeight - self.rowSplit, 2,
                        RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM,
                        _('At End:') + ' ' + afterevent))
            days = (_("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"),
                    _("Sun"))
            begin = FuzzyTime(timer.begin)
            if timer.repeated:
                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, 2,
                         self.rowSplit, 20, 20, self.iconRepeat))
            else:
                repeatedtext = begin[0]  # date
            text = repeatedtext + ((" %s ... %s (%d " + _("mins") + ")") %
                                   (begin[1], FuzzyTime(timer.end)[1],
                                    (timer.end - timer.begin) / 60))
            res.append(
                (eListboxPythonMultiContent.TYPE_TEXT, 148,
                 self.itemHeight - self.rowSplit, width - 150, self.rowSplit,
                 2, RT_HALIGN_RIGHT | RT_VALIGN_BOTTOM, text))
            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:
                    state = _("running...")
                    icon = self.iconZapped
                elif timer.state == TimerEntry.StateEnded:
                    state = _("done!")
                    icon = self.iconDone
                else:
                    state = _("<unknown>")
                    icon = None
            else:
                state = _("done!")
                icon = self.iconDone

        if timer.disabled:
            state = _("disabled")
            icon = self.iconDisabled

        if timer.failed:
            state = _("failed")
            icon = self.iconFailed
        icon and res.append(
            (eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND,
             self.iconMargin / 2, (self.rowSplit - self.iconHeight) / 2,
             self.iconWidth, self.iconHeight, icon))

        res.append((eListboxPythonMultiContent.TYPE_TEXT,
                    self.iconMargin + self.iconWidth, self.rowSplit, 126,
                    height - self.rowSplit, 2,
                    RT_HALIGN_LEFT | RT_VALIGN_BOTTOM, state))

        line = LoadPixmap(resolveFilename(SCOPE_ACTIVE_SKIN, "div-h.png"))
        res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHABLEND, 0,
                    height - 2, width, 2, line))

        return res
Ejemplo n.º 30
0
	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