예제 #1
0
 def __init__(self):
     List.__init__(self,
                   enableWrapAround=True,
                   item_height=28,
                   buildfunc=self.buildEntry)
     self.mode = 0
     self.list = []
예제 #2
0
    def __init__(self,
                 name,
                 type,
                 enableWrapAround=True,
                 entryHelper=PlayListEntry):
        List.__init__(self,
                      enableWrapAround=enableWrapAround,
                      item_height=55,
                      buildfunc=self._buildfunc)
        self._playing = -1
        self._list = []
        self._history = []
        self._lastPlayed = -1
        self.serviceHandler = eServiceCenter.getInstance()
        self._entryHelper = entryHelper

        self._name = name
        self._type = type
        self._valid = False
        self._shuffle = False
        self._repeat = self.REPEAT_NONE

        self.style = "default"

        if self.FEATURE_LISTABLE and not self.__class__ in Playlist.listable:
            Playlist.listable.append(self.__class__)
예제 #3
0
	def __init__(self, list = [ ], enableWrapAround = False, item_height = 25, fonts = [ ]):
		List.__init__(self, list = [ ], enableWrapAround = False, item_height = 25, fonts = [ ])
		Source.__init__(self)
		self.__list = list
		self.onSelectionChanged = [ ]
		self.item_height = item_height
		self.fonts = fonts
		self.disable_callbacks = False
		self.enableWrapAround = enableWrapAround
		self.__style = "default" # style might be an optional string which can be used to define different visualisations in the skin
예제 #4
0
	def __init__(self, list = [ ], enableWrapAround = False, item_height = 25, fonts = [ ]):
		List.__init__(self, list = [ ], enableWrapAround = False, item_height = 25, fonts = [ ])
		Source.__init__(self)
		self.__list = list
		self.onSelectionChanged = [ ]
		self.item_height = item_height
		self.fonts = fonts
		self.disable_callbacks = False
		self.enableWrapAround = enableWrapAround
		self.__style = "default" # style might be an optional string which can be used to define different visualisations in the skin
예제 #5
0
	def __init__(self, list=[], enableWrapAround=False):
		List.__init__(self, list, enableWrapAround, item_height=50)
		self.pixmaps_to_load = []
		self.picloads = {}
		self.listCompleted = []
		self.lastListLength = 0
		self.lastIndex = 0
		self.callback = None
		self.idx = 0
		self.thumb = ""
		self.active = True
		self.ListUpdate = False
예제 #6
0
	def __init__(self, list = [ ], enableWrapAround=False):
		List.__init__(self, list, enableWrapAround, item_height = 50 )
		self.pixmaps_to_load = []
		self.picloads = {}
		self.listCompleted = []
		self.lastListLength = 0
		self.lastIndex = 0
		self.callback = None
		self.idx = 0
		self.thumb = ""
		self.active = True
		self.ListUpdate = False
예제 #7
0
파일: Playlist.py 프로젝트: OpenDMM/enigma2
	def __init__(self, name, type, enableWrapAround=True, entryHelper=PlayListEntry):
		List.__init__(self, enableWrapAround=enableWrapAround, item_height=55, buildfunc=self._buildfunc)
		self._playing = -1
		self._list = []
		self._history = []
		self._lastPlayed = -1
		self.serviceHandler = eServiceCenter.getInstance()
		self._entryHelper = entryHelper

		self._name = name
		self._type = type
		self._valid = False
		self._shuffle = False
		self._repeat = self.REPEAT_NONE

		self.style = "default"

		if self.FEATURE_LISTABLE and not self.__class__ in Playlist.listable:
			Playlist.listable.append(self.__class__)
예제 #8
0
    def __init__(self, helplist, callback, rcPos=None):
        List.__init__(self)
        self.callback = callback
        formatFlags = 0
        self.rcPos = rcPos
        self.rcKeyIndex = None
        self.buttonMap = {}
        self.longSeen = False

        def actMapId():
            return getattr(actionmap, "description", None) or id(actionmap)

        headings, sortCmp, sortKey = {
            "headings+alphabetic": (True, None, self._sortKeyAlpha),
            "flat+alphabetic": (False, None, self._sortKeyAlpha),
            "flat+remotepos": (False, self._sortCmpPos, None),
            "flat+remotegroups": (False, self._sortCmpInd, None)
        }.get(config.usage.help_sortorder.value, (False, None, None))
        if rcPos is None:
            if sortCmp in (self._sortCmpPos, self._sortCmpInd):
                sortCmp = None
        else:
            if sortCmp == self._sortCmpInd:
                self.rcKeyIndex = dict(
                    (x[1], x[0]) for x in enumerate(rcPos.getRcKeyList()))
        buttonsProcessed = set()
        helpSeen = defaultdict(list)
        sortedHelplist = sorted(helplist, key=lambda hle: hle[0].prio)
        actionMapHelp = defaultdict(list)
        for (actionmap, context, actions) in sortedHelplist:
            if not actionmap.enabled:
                continue
            amId = actMapId()
            if headings and actionmap.description and not (formatFlags
                                                           & self.HEADINGS):
                print "[HelpMenuList] headings found"
                formatFlags |= self.HEADINGS
            for (action, help) in actions:
                helpTags = []
                if callable(help):
                    help = help()
                    helpTags.append(
                        pgettext('Abbreviation of "Configurable"', 'C'))
                if help is None:
                    continue
                buttons = queryKeyBinding(context, action)
                if not buttons:  # Do not display entries which are not accessible from keys.
                    continue
                buttonNames = []
                for n in buttons:
                    name = getKeyDescription(n[0])
                    if name is not None:
                        if len(name) > 0 and not rcPos.getRcKeyPos(
                                name[0]
                        ):  # Ignore buttons that don't have a button location.
                            continue
                        if (len(name) < 2 or name[1] not in ("fp", "kbd")):
                            if n[1] & 8:  # For long keypresses, make the second tuple item "long".
                                name = (name[0], "long")
                            if name not in buttonsProcessed:
                                buttonNames.append(name)
                                buttonsProcessed.add(name)
                if not buttonNames:  # Only show entries with keys that are available on the used rc.
                    continue
                isExtended = isinstance(help, (tuple, list))
                if isExtended and not (formatFlags & self.EXTENDED):
                    print "[HelpMenuList] extendedHelp entry found"
                    formatFlags |= self.EXTENDED
                if helpTags:
                    helpStr = help[0] if isExtended else help
                    tagsStr = pgettext("Text list separator",
                                       ', ').join(helpTags)
                    helpStr = _("%s (%s)") % (helpStr, tagsStr)
                    help = [helpStr, help[1]] if isExtended else helpStr
                entry = [(actionmap, context, action, buttonNames, help), help]
                if self._filterHelpList(entry, helpSeen):
                    actionMapHelp[actMapId()].append(entry)
        lst = []
        extendedPadding = (None, ) if formatFlags & self.EXTENDED else ()
        for (actionmap, context, actions) in helplist:
            amId = actMapId()
            if headings and amId in actionMapHelp and getattr(
                    actionmap, "description", None):
                if sortCmp or sortKey:
                    actionMapHelp[amId].sort(cmp=sortCmp, key=sortKey)
                self.addListBoxContext(actionMapHelp[amId], formatFlags)
                lst.append((None, actionmap.description, None) +
                           extendedPadding)
                lst.extend(actionMapHelp[amId])
                del actionMapHelp[amId]
        if actionMapHelp:
            if formatFlags & self.HEADINGS:  # Add a header if other actionmaps have descriptions.
                lst.append((None, _("Other functions"), None) +
                           extendedPadding)
            otherHelp = []
            for (actionmap, context, actions) in helplist:
                amId = actMapId()
                if amId in actionMapHelp:
                    otherHelp.extend(actionMapHelp[amId])
                    del actionMapHelp[amId]
            if sortCmp or sortKey:
                otherHelp.sort(cmp=sortCmp, key=sortKey)
            self.addListBoxContext(otherHelp, formatFlags)
            lst.extend(otherHelp)
        for i, ent in enumerate(lst):
            if ent[0] is not None:
                for b in ent[0][
                        3]:  # Ignore "break" events from OK and EXIT on return from help popup.
                    if b[0] not in ('OK', 'EXIT'):
                        self.buttonMap[b] = i
        self.style = (
            "default",
            "default+headings",
            "extended",
            "extended+headings",
        )[formatFlags]
        self.list = lst
예제 #9
0
	def __init__(self, helplist, callback, rcPos=None):
		List.__init__(self)
		self.onSelChanged = []
		self.callback = callback
		self.extendedHelp = False
		self.rcPos = rcPos
		self.rcKeyIndex = None
		self.buttonMap = {}
		self.longSeen = False

		self.onSelectionChanged.append(self.selChanged)

		def actMapId():
			return getattr(actionmap, "description", None) or id(actionmap)

		headings, sortCmp, sortKey = {
			"headings+alphabetic": (True, None, self._sortKeyAlpha),
			"flat+alphabetic": (False, None, self._sortKeyAlpha),
			"flat+remotepos": (False, self._sortCmpPos, None),
			"flat+remotegroups": (False, self._sortCmpInd, None)
		}.get(config.usage.help_sortorder.value, (False, None, None))

		if rcPos is None:
			if sortCmp in (self._sortCmpPos, self._sortCmpInd):
				sortCmp = None
		else:
			if sortCmp == self._sortCmpInd:
				self.rcKeyIndex = dict((x[1], x[0]) for x in enumerate(rcPos.getRcKeyList()))

		indent = 0

		if headings:
			for (actionmap, context, actions) in helplist:
				if actionmap.enabled and getattr(actionmap, "description", None):
					indent = 1
					break

		buttonsProcessed = set()
		helpSeen = defaultdict(list)
		sortedHelplist = sorted(helplist, key=lambda hle: hle[0].prio)
		actionMapHelp = defaultdict(list)

		for (actionmap, context, actions) in sortedHelplist:
			if not actionmap.enabled:
				continue

			amId = actMapId()

			from Screens.ButtonSetup import helpableButtonSetupActionMap
			isHelpableButtonSetupActionMap = isinstance(actionmap, helpableButtonSetupActionMap)

			for (action, help) in actions:
				helpTags = []
				if callable(help):
					help = help()
					# ButtonSetupButtonActions help looks as though
					# the button is configurable, but it isn't really
					if not isHelpableButtonSetupActionMap:
						helpTags.append('C')

				if help is None:
					continue

				# Ignore inactive ButtonSetupButtonActions
				if isHelpableButtonSetupActionMap and not help:
					continue

				buttons = queryKeyBinding(context, action)

				# do not display entries which are not accessible from keys
				if not buttons:
					continue

				name = None
				flags = 0

				buttonNames = []

				for n in buttons:
					(name, flags) = (getKeyDescription(n[0]), n[1])
					if name is not None:
						if not self.rcPos.getRcKeyPos(name[0]):
							continue
						if (len(name) < 2 or name[1] not in("fp", "kbd")):
							if flags & 8:  # for long keypresses, make the second tuple item "long".
								name = (name[0], "long")
							nlong = (n[0], flags & 8)
							if nlong not in buttonsProcessed:
								buttonNames.append(name)
								buttonsProcessed.add(nlong)

				# only show non-empty entries with keys that are available on the used rc
				if not (buttonNames and help):
					continue
				if isinstance(help, (tuple, list)):
					self.extendedHelp = True
				if helpTags:
					helpTagStr = " (" + ", ".join(helpTags) + ")"
					if isinstance(help, (tuple, list)):
						help[0] += helpTagStr
					else:
						help += helpTagStr

				entry = [(actionmap, context, action, buttonNames), help]
				if self._filterHelpList(entry, helpSeen):
					actionMapHelp[amId].append(entry)

		l = []
		extendedPadding = ('', '') if self.extendedHelp else ()

		for (actionmap, context, actions) in helplist:
			amId = actMapId()
			if headings and amId in actionMapHelp and getattr(actionmap, "description", None):
				if sortCmp or sortKey:
					actionMapHelp[amId].sort(cmp=sortCmp, key=sortKey)
				self.addListBoxContext(actionMapHelp[amId], indent)

				l.append((None, actionmap.description, '') + extendedPadding)
				l.extend(actionMapHelp[amId])
				del actionMapHelp[amId]

		if actionMapHelp:
			if indent:
				l.append((None, _("Other functions"), '') + extendedPadding)

			otherHelp = []
			for (actionmap, context, actions) in helplist:
				amId = actMapId()
				if amId in actionMapHelp:
					otherHelp.extend(actionMapHelp[amId])
					del actionMapHelp[amId]

			if sortCmp or sortKey:
				otherHelp.sort(cmp=sortCmp, key=sortKey)
			self.addListBoxContext(otherHelp, indent)
			l.extend(otherHelp)

		for i, ent in enumerate(l):
			if ent[0] is not None:
				for b in ent[0][3]:
					# Ignore "break" events from
					# OK and EXIT on return from
					# help popup
					if b[0] not in ('OK', 'EXIT'):
						self.buttonMap[b] = i

		if self.extendedHelp:
			self.style = "extended"

		self.list = l
예제 #10
0
	def __init__(self):
		List.__init__(self, enableWrapAround=True, item_height=28, buildfunc=self.buildEntry)
		self.mode = 0
		self.list = []
예제 #11
0
 def __init__(self, list, enableWrapAround=False):
     List.__init__(self, list, enableWrapAround, item_height=50)
예제 #12
0
    def __init__(self, helpList, callback):
        List.__init__(self)
        self.callback = callback
        self.rcKeyIndex = None
        self.buttonMap = {}
        self.longSeen = False
        formatFlags = 0

        def actMapId():
            return getattr(actionmap, "description", None) or id(actionmap)

        headings, sortCmp, sortKey = {
            "headings+alphabetic": (True, None, self._sortKeyAlpha),
            "flat+alphabetic": (False, None, self._sortKeyAlpha),
            "flat+remotepos": (False, self._sortCmpPos, None),
            "flat+remotegroups": (False, self._sortCmpInd, None)
        }.get(config.usage.helpSortOrder.value, (False, None, None))
        if remoteControl is None:
            if sortCmp in (self._sortCmpPos, self._sortCmpInd):
                sortCmp = None
        else:
            if sortCmp == self._sortCmpInd:
                self.rcKeyIndex = dict((x[1], x[0]) for x in enumerate(
                    remoteControl.getRemoteControlKeyList()))
        buttonsProcessed = set()
        helpSeen = defaultdict(list)
        sortedHelpList = sorted(helpList, key=lambda hle: hle[0].prio)
        actionMapHelp = defaultdict(list)
        for (actionmap, context, actions) in sortedHelpList:
            # print("[HelpMenu] HelpMenuList DEBUG: actionmap='%s', context='%s', actions='%s'." % (str(actionmap), context, str(actions)))
            if not actionmap.enabled:
                # print("[HelpMenu] Action map disabled.")
                continue
            amId = actMapId()
            if headings and actionmap.description and not (formatFlags
                                                           & self.HEADINGS):
                # print("[HelpMenu] HelpMenuList DEBUG: Headings found.")
                formatFlags |= self.HEADINGS
            for (action, help) in actions:  # DEBUG: Should help be response?
                helpTags = [
                ]  # if mapFlag else [pgettext("Abbreviation of 'Disabled'", "Disabled")]
                if callable(help):
                    help = help()
                    helpTags.append(
                        pgettext("Abbreviation of 'Configurable'",
                                 "Configurable"))
                if help is None:
                    # print("[HelpMenu] HelpMenuList DEBUG: No help text found.")
                    # help = _("No help text available")
                    continue
                buttons = queryKeyBinding(context, action)
                # print("[HelpMenu] HelpMenuList DEBUG: queryKeyBinding buttons=%s." % str(buttons))
                if not buttons:  # Do not display entries which are not accessible from keys.
                    # print("[HelpMenu] HelpMenuList DEBUG: No buttons allocated.")
                    # helpTags.append(pgettext("Abbreviation of 'Unassigned'", "Unassigned"))
                    continue
                buttonLabels = []
                for keyId, flags in buttons:
                    if remoteControl.getRemoteControlKeyPos(keyId):
                        buttonLabels.append(
                            (keyId, "LONG") if flags & 8 else (keyId, )
                        )  # For long keypresses, make the second tuple item "LONG".
                if not buttonLabels:  # Only show entries with keys that are available on the used rc.
                    # print("[HelpMenu] HelpMenuList DEBUG: Button not available on current remote control.")
                    # helpTags.append(pgettext("Abbreviation of 'No Button'", "No Button"))
                    continue
                isExtended = isinstance(help, (list, tuple))
                if isExtended and not (formatFlags & self.EXTENDED):
                    # print("[HelpMenu] HelpMenuList DEBUG: Extended help entry found.")
                    formatFlags |= self.EXTENDED
                if helpTags:
                    helpStr = help[0] if isExtended else help
                    tagsStr = pgettext("Text list separator",
                                       ", ").join(helpTags)
                    helpStr = _("%s  (%s)") % (helpStr, tagsStr)
                    help = [helpStr, help[1]] if isExtended else helpStr
                entry = [(actionmap, context, action, buttonLabels, help),
                         help]
                if self._filterHelpList(entry, helpSeen):
                    actionMapHelp[actMapId()].append(entry)
        helpMenuList = []
        extendedPadding = (None, ) if formatFlags & self.EXTENDED else ()
        for (actionmap, context, actions) in helpList:
            amId = actMapId()
            if headings and amId in actionMapHelp and getattr(
                    actionmap, "description", None):
                if sortCmp:
                    actionMapHelp[amId].sort(key=cmp_to_key(sortCmp))
                elif sortKey:
                    actionMapHelp[amId].sort(key=sortKey)
                self.addListBoxContext(actionMapHelp[amId], formatFlags)
                helpMenuList.append((None, actionmap.description, None) +
                                    extendedPadding)
                helpMenuList.extend(actionMapHelp[amId])
                del actionMapHelp[amId]
        if actionMapHelp:
            if formatFlags & self.HEADINGS:  # Add a header if other actionmaps have descriptions.
                helpMenuList.append((None, _("Other Actions"), None) +
                                    extendedPadding)
            otherHelp = []
            for (actionmap, context, actions) in helpList:
                amId = actMapId()
                if amId in actionMapHelp:
                    otherHelp.extend(actionMapHelp[amId])
                    del actionMapHelp[amId]
            if sortCmp:
                otherHelp.sort(key=cmp_to_key(sortCmp))
            elif sortKey:
                otherHelp.sort(key=sortKey)
            self.addListBoxContext(otherHelp, formatFlags)
            helpMenuList.extend(otherHelp)
        ignoredKeyIds = (KEYIDS.get("KEY_OK"), KEYIDS.get("KEY_EXIT"))
        for index, entry in enumerate(helpMenuList):
            if entry[0] and entry[0][3]:  # This should not be required.
                for button in entry[0][3]:
                    if button[0] not in (
                            ignoredKeyIds
                    ):  # Ignore "break" events from OK and EXIT on return from help popup.
                        self.buttonMap[button] = index
        self.style = (
            "default",
            "default+headings",
            "extended",
            "extended+headings",
        )[formatFlags]
        # [(actionmap, context, [(action, help), (action, help), ...]), ...]
        # [((ActionMap, Context, Action, [(Button, Device/Long), ...], HelpText), HelpText), ...]
        self.list = helpMenuList
예제 #13
0
 def __init__(self, list=[]):
     List.__init__(self, list)
예제 #14
0
	def __init__(self, list=[]):
		List.__init__(self, list=[])
		self.__list = list
예제 #15
0
	def __init__(self, list, enableWrapAround=False):
		List.__init__(self, list, enableWrapAround, item_height = 50 )