Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 3
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__)
Exemplo n.º 4
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
Exemplo n.º 5
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        list = []

        menuID = None
        for x in parent:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                self.addMenu(list, x)
                count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1

        if menuID is not None:
            # plugins
            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break
                if len(l) > 4 and l[4]:
                    list.append(
                        (l[0], boundFunction(l[1], self.session,
                                             self.close), l[2], l[3] or 50))
                else:
                    list.append((l[0], boundFunction(l[1],
                                                     self.session), l[2], l[3]
                                 or 50))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")
        self.menuID = menuID
        ProtectedScreen.__init__(self)

        # Sort by Weight
        if config.usage.sort_menus.value:
            list.sort()
        else:
            list.sort(key=lambda x: int(x[3]))

        if config.usage.menu_show_numbers.value:
            list = [(str(x[0] + 1) + "  " + x[1][0], x[1][1], x[1][2])
                    for x in enumerate(list)]

        self["menu"] = List(list)

        # self["menuActions"] = HelpableNumberActionMap(self, ["OkCancelActions", "MenuActions", "NumberActions"], {
        self["menuActions"] = HelpableNumberActionMap(
            self,
            ["OkCancelActions", "NumberActions"],
            {
                "ok": (self.okbuttonClick, _("Select the current menu item")),
                "cancel": (self.closeNonRecursive, _("Exit menu")),
                "close": (self.closeRecursive, _("Exit all menus")),
                # "menu": (self.closeRecursive, _("Exit all menus")),
                "1": (self.keyNumberGlobal, _("Direct menu item selection")),
                "2": (self.keyNumberGlobal, _("Direct menu item selection")),
                "3": (self.keyNumberGlobal, _("Direct menu item selection")),
                "4": (self.keyNumberGlobal, _("Direct menu item selection")),
                "5": (self.keyNumberGlobal, _("Direct menu item selection")),
                "6": (self.keyNumberGlobal, _("Direct menu item selection")),
                "7": (self.keyNumberGlobal, _("Direct menu item selection")),
                "8": (self.keyNumberGlobal, _("Direct menu item selection")),
                "9": (self.keyNumberGlobal, _("Direct menu item selection")),
                "0": (self.keyNumberGlobal, _("Direct menu item selection"))
            },
            prio=0,
            description=_("Common Menu Actions"))

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a) or _(parent.get("text", "").encode("UTF-8"))
        self.setTitle(a)

        self.number = 0
        self.nextNumberTimer = eTimer()
        self.nextNumberTimer.callback.append(self.okbuttonClick)
Exemplo n.º 6
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        list = []

        menuID = None
        for x in parent:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                self.addMenu(list, x)
                count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1

        if menuID is not None:
            # plugins
            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break
                if len(l) > 4 and l[4]:
                    list.append(
                        (l[0], boundFunction(l[1], self.session,
                                             self.close), l[2], l[3] or 50))
                else:
                    list.append((l[0], boundFunction(l[1],
                                                     self.session), l[2], l[3]
                                 or 50))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")
        self.menuID = menuID
        ProtectedScreen.__init__(self)

        # Sort by Weight
        if config.usage.sort_menus.value:
            list.sort()
        else:
            list.sort(key=lambda x: int(x[3]))

        if config.usage.menu_show_numbers.value:
            list = [(str(x[0] + 1) + "  " + x[1][0], x[1][1], x[1][2])
                    for x in enumerate(list)]

        self["menu"] = List(list)

        self["actions"] = NumberActionMap(
            ["OkCancelActions", "MenuActions", "NumberActions"], {
                "ok": self.okbuttonClick,
                "cancel": self.closeNonRecursive,
                "menu": self.closeRecursive,
                "0": self.keyNumberGlobal,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal
            })

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a) or _(parent.get("text", "").encode("UTF-8"))
        self.menu_title = a
        global menu_path
        self.menu_path_compressed = menu_path
        if menu_path == "":
            menu_path += a
        elif not menu_path.endswith(a):
            menu_path += " / " + a
        global full_menu_path
        full_menu_path = menu_path + ' / '
        if config.usage.show_menupath.value == 'large':
            Screen.setTitle(self, menu_path)
            self["title"] = StaticText(menu_path)
            self["menu_path_compressed"] = StaticText("")
        elif config.usage.show_menupath.value == 'small':
            Screen.setTitle(self, a)
            self["title"] = StaticText(a)
            self["menu_path_compressed"] = StaticText(
                self.menu_path_compressed and self.menu_path_compressed + " >"
                or "")
        else:
            Screen.setTitle(self, a)
            self["title"] = StaticText(a)
            self["menu_path_compressed"] = StaticText("")

        self.number = 0
        self.nextNumberTimer = eTimer()
        self.nextNumberTimer.callback.append(self.okbuttonClick)
Exemplo n.º 7
0
 def __init__(self, session, parentMenu):
     self.session = session
     self.parentMenu = parentMenu
     Screen.__init__(self, session)
     HelpableScreen.__init__(self)
     self.menuList = []
     self["menu"] = List(self.menuList)
     self["menu"].onSelectionChanged.append(self.selectionChanged)
     self["menuimage"] = Pixmap()
     self["description"] = StaticText()
     self["key_menu"] = StaticText(_("MENU"))
     self["key_red"] = StaticText(_("Exit"))
     self["key_green"] = StaticText()
     self["key_yellow"] = StaticText()
     self["key_blue"] = StaticText()
     menuImageLibrary = resolveFilename(SCOPE_GUISKIN, "mainmenu")
     self.menuImageLibrary = menuImageLibrary if isdir(
         menuImageLibrary) else None
     self.showNumericHelp = False
     self.sortMode = False
     self.selectedEntry = None
     self.subMenuSort = None
     self.createMenuList()
     ProtectedScreen.__init__(self)  # ProtectedScreen needs self.menuID
     # For the skin: first try a menu_<menuID>, then Menu.
     self.skinName = []
     if self.menuID is not None:
         if config.usage.menuType.value == "horzanim" and findSkinScreen(
                 "Animmain"):
             self.skinName.append("Animmain")
         elif config.usage.menuType.value == "horzicon" and findSkinScreen(
                 "Iconmain"):
             self.skinName.append("Iconmain")
         else:
             self.skinName.append("Menu%s" % self.menuID)
             self.skinName.append("menu_%s" % self.menuID)
     self.skinName.append("Menu")
     if config.usage.menuType.value == "horzanim" and findSkinScreen(
             "Animmain"):
         self.onShown.append(self.openTestA)
     elif config.usage.menuType.value == "horzicon" and findSkinScreen(
             "Iconmain"):
         self.onShown.append(self.openTestB)
     self["menuActions"] = HelpableNumberActionMap(
         self, [
             "OkCancelActions", "MenuActions", "ColorActions",
             "NumberActions"
         ], {
             "ok": (self.okbuttonClick, _("Select the current menu item")),
             "cancel": (self.closeNonRecursive, _("Exit menu")),
             "close": (self.closeRecursive, _("Exit all menus")),
             "menu": (self.keySetupMenu, _("Change OSD Settings")),
             "red": (self.closeNonRecursive, _("Exit menu")),
             "1": (self.keyNumberGlobal, _("Direct menu item selection")),
             "2": (self.keyNumberGlobal, _("Direct menu item selection")),
             "3": (self.keyNumberGlobal, _("Direct menu item selection")),
             "4": (self.keyNumberGlobal, _("Direct menu item selection")),
             "5": (self.keyNumberGlobal, _("Direct menu item selection")),
             "6": (self.keyNumberGlobal, _("Direct menu item selection")),
             "7": (self.keyNumberGlobal, _("Direct menu item selection")),
             "8": (self.keyNumberGlobal, _("Direct menu item selection")),
             "9": (self.keyNumberGlobal, _("Direct menu item selection")),
             "0": (self.keyNumberGlobal, _("Direct menu item selection"))
         },
         prio=0,
         description=_("Menu Common Actions"))
     if config.usage.menuSortOrder.value == "user":
         self["moveActions"] = HelpableActionMap(
             self,
             ["NavigationActions"],
             {
                 "top": (self.keyTop, _("Move to first line / screen")),
                 "pageUp": (self.keyPageUp, _("Move up a screen")),
                 "up": (self.keyUp, _("Move up a line")),
                 # "first": (self.keyFirst, _("Jump to first item in list or the start of text")),
                 # "left": (self.keyLeft, _("Select the previous item in list or move cursor left")),
                 "left": (self.keyPageUp, _("Move up a screen")),
                 "right": (self.keyPageDown, _("Move down a screen")),
                 # "right": (self.keyRight, _("Select the next item in list or move cursor right")),
                 # "last": (self.keyLast, _("Jump to last item in list or the end of text")),
                 "down": (self.keyDown, _("Move down a line")),
                 "pageDown": (self.keyPageDown, _("Move down a screen")),
                 "bottom": (self.keyBottom, _("Move to last line / screen"))
             },
             prio=-1,
             description=_("Menu Navigation Actions"))
         self["editActions"] = HelpableActionMap(
             self, ["ColorActions"], {
                 "green":
                 (self.keyGreen, _("Toggle item move mode on/off")),
                 "yellow": (self.keyYellow,
                            _("Toggle hide/show of the current item")),
                 "blue":
                 (self.toggleSortMode, _("Toggle item edit mode on/off"))
             },
             prio=0,
             description=_("Menu Edit Actions"))
     title = parentMenu.get("title", "") or None
     title = title and _(title)
     if title is None:
         title = _(parentMenu.get("text", ""))
     self.setTitle(title)
     self.number = 0
     self.nextNumberTimer = eTimer()
     self.nextNumberTimer.callback.append(self.okbuttonClick)
     if len(
             self.menuList
     ) == 1:  # Does this menu have only one item, if so just run that item.
         self.onExecBegin.append(self.singleItemMenu)
     self.onLayoutFinish.append(self.layoutFinished)
Exemplo n.º 8
0
    def __init__(self, session, infobar=None, page=PAGE_AUDIO):
        Screen.__init__(self, session)

        self["streams"] = List([], enableWrapAround=True)
        self["key_red"] = Boolean(False)
        self["key_green"] = Boolean(False)
        self["key_yellow"] = Boolean(True)
        self["key_blue"] = Boolean(False)
        self["key_left"] = Pixmap()
        self["key_right"] = Pixmap()
        self["switchdescription"] = Label(
            _("Switch between Audio-, Subtitlepage"))
        self["summary_description"] = StaticText("")

        self.protectContextMenu = True

        ConfigListScreen.__init__(self, [])
        self.infobar = infobar or self.session.infobar

        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={iPlayableService.evUpdatedInfo: self.__updatedInfo})
        self.cached_subtitle_checked = False
        self.__selected_subtitle = None

        self["actions"] = NumberActionMap(
            [
                "ColorActions", "OkCancelActions", "DirectionActions",
                "MenuActions", "InfobarAudioSelectionActions",
                "InfobarSubtitleSelectionActions"
            ], {
                "red": self.keyRed,
                "green": self.keyGreen,
                "yellow": self.keyYellow,
                "subtitleSelection": self.keyAudioSubtitle,
                "audioSelection": self.keyAudioSubtitle,
                "blue": self.keyBlue,
                "ok": self.keyOk,
                "cancel": self.cancel,
                "up": self.keyUp,
                "down": self.keyDown,
                "volumeUp": self.volumeUp,
                "volumeDown": self.volumeDown,
                "volumeMute": self.volumeMute,
                "menu": self.openAutoLanguageSetup,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
            }, -2)

        self.settings = ConfigSubsection()
        choicelist = [(PAGE_AUDIO, ""), (PAGE_SUBTITLES, "")]
        self.settings.menupage = ConfigSelection(choices=choicelist,
                                                 default=page)
        self.onLayoutFinish.append(self.__layoutFinished)
Exemplo n.º 9
0
    def __init__(self, session, name, url, desc):
        global SREF
        Screen.__init__(self, session)
        self.name = name
        self.url = url
        self.skin = Playvid.skin
        self["list"] = List([])
        self["list"] = RSList([])
        self['info'] = Label()
        self['key_red'] = Button(_('Exit'))
        self['key_green'] = Button(_('Download'))
        self['key_yellow'] = Button(_('Play'))
        self['key_blue'] = Button(_('Stop Download'))
        self['setupActions'] = ActionMap(
            ['SetupActions', 'ColorActions', 'TimerEditActions'], {
                'red': self.close,
                'green': self.okClicked,
                'yellow': self.play,
                'blue': self.stopDL,
                'cancel': self.cancel,
                'ok': self.okClicked
            }, -2)
        self.icount = 0
        self.bLast = 0
        self.useragent = "QuickTime/7.6.2 (qtver=7.6.2;os=Windows NT 5.1Service Pack 3)"
        cachefold = "/tmp/"
        self.svfile = " "
        self.list = []
        ########################
        """
        i=0
        while i<7:
               self.list.append(i)
               i=i+1 
        self.list[0] =(_("Play"))
        self.list[1] =(_("Play with vlc"))
        self.list[2] =(_("Download"))
        self.list[3] =(_("Stop download"))
        self.list[4] =(_("Add to favorites"))
        self.list[5] =(_("Add to bouquets"))
        self.list[6] =(_("Current Downloads"))
        """
        self.list.append((_("Play")))
        ########################
        self.name = name
        #hls        url = "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"
        #null        url = "http://188.138.9.246/S2/HLS_LIVE/disney/playlist.m3u8"
        self.url = url
        print("Here in Playvid self.url =", self.url)
        print("<<<Endurl")
        #        self.url = self.url.replace("|", "\|")
        n1 = self.url.find("|", 0)
        if n1 > -1:
            self.url = self.url[:n1]

        print("Here in Playvid self.url B=", self.url)
        #self['info'].setText(txt)

        ####################
        ##        self.updateTimer = eTimer()
        ##        self.updateTimer.callback.append(self.updateStatus)
        ##        self.updateTimer.start(2000)
        ##        self.updateStatus()
        ####################
        self.updateTimer = eTimer()
        try:
            self.updateTimer_conn = self.updateTimer.timeout.connect(
                self.updateStatus)
        except AttributeError:
            self.updateTimer.callback.append(self.updateStatus)
#       self.updateTimer.callback.append(self.updateStatus)
##	self.updateTimer.start(2000)
##	self.updateStatus()
####################
        self['info'].setText(" ")
        self.srefOld = self.session.nav.getCurrentlyPlayingServiceReference()
        SREF = self.srefOld
        """
        if config.plugins.kodiplug.directpl.value is True:
                print "Here in directpl"
                self.onShown.append(self.start2)
        elif "hds://" in url: 
                self.onShown.append(self.start3)
        elif self.url.startswith("stack://"):
                self.onShown.append(self.start4)
        elif "plugin://plugin.video.youtube" in self.url or "youtube.com/" in self.url :
                self.onShown.append(self.start5)        
        
        else:        
                print "Here in no directpl"
        """
        self.onLayoutFinish.append(self.start)
Exemplo n.º 10
0
    def __init__(self, session, args=0):
        skin = """<screen position="93,70" size="550,450" title="Webcams provided by webcams.travel">

			<widget source="list" render="Listbox" position="0,0" size="550,350" zPosition="1" scrollbarMode="showOnDemand" transparent="1"  >
				<convert type="TemplatedMultiContent">
				{"templates":
					{"default": (77,[
							MultiContentEntryPixmapAlphaTest(pos = (0, 0), size = (100, 75), png = 4), # index 4 is the thumbnail
							MultiContentEntryText(pos = (100, 1), size = (500, 22), font=0, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 1), # index 1 is the Title
							MultiContentEntryText(pos = (100, 24), size = (300, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 5), # index 5 is the Published Date
							MultiContentEntryText(pos = (100, 43), size = (300, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 6), # index 6 is the Views Count
							MultiContentEntryText(pos = (400, 24), size = (200, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 7), # index 7 is the duration
							MultiContentEntryText(pos = (400, 43), size = (200, 18), font=1, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 8), # index 8 is the ratingcount
						]),
					"status": (77,[
							MultiContentEntryText(pos = (10, 1), size = (500, 28), font=2, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 0), # index 0 is the name
							MultiContentEntryText(pos = (10, 22), size = (500, 46), font=3, flags = RT_HALIGN_LEFT | RT_VALIGN_TOP| RT_WRAP, text = 1), # index 2 is the description
						])
					},
					"fonts": [gFont("Regular", 22),gFont("Regular", 18),gFont("Regular", 26),gFont("Regular", 20)],
					"itemHeight": 77
				}
				</convert>
			</widget>
			<widget name="thumbnail" position="0,0" size="100,75" alphatest="on"/> # fake entry for dynamic thumbnail resizing, currently there is no other way doing this.

			<widget name="count" position="5,360" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="page" position="150,360" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="currentnumbers" position="295,360" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />

			<ePixmap position="5,410" zPosition="0" size="140,40" pixmap="buttons/red.png" transparent="1" alphatest="on" />
			<ePixmap position="150,410" zPosition="1" size="140,40" pixmap="buttons/green.png" transparent="1" alphatest="on" />
			<ePixmap position="295,410" zPosition="2" size="140,40" pixmap="buttons/yellow.png" transparent="1" alphatest="on" />
			<!-- #not used now# ePixmap position="445,410" zPosition="3" size="140,40" pixmap="buttons/blue.png" transparent="1" alphatest="on" //-->
			<widget name="key_red" position="5,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_green" position="150,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_yellow" position="295,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
			<widget name="key_blue" position="445,410" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />

		</screen>"""
        self.skin = skin
        Screen.__init__(self, session)
        self.picloads = {}
        self.thumbnails = {}

        self["list"] = List([])
        self["thumbnail"] = Pixmap()
        self["thumbnail"].hide()

        self["count"] = Label(_("Cams: "))
        self["page"] = Label(_("Page: "))
        self["currentnumbers"] = Label(_("current: "))

        self["key_red"] = Button(_("prev"))
        self["key_red"].hide()
        self["key_green"] = Button(_("next"))
        self["key_green"].hide()
        self["key_yellow"] = Button(_("search"))
        self["key_blue"] = Button(_("hdkfjhg"))

        self["key_blue"].hide()  #not used at the moment

        self["actions"] = ActionMap(
            [
                "WizardActions", "MenuActions", "DirectionActions",
                "ShortcutActions"
            ], {
                "ok": self.onOK,
                "red": self.onRed,
                "green": self.onGreen,
                "yellow": self.onYellow,
                "back": self.close
            }, -1)
        self.finish_loading = True
        self.timer_default = eTimer()
        self.timer_default.timeout.callback.append(self.buildCamList)

        self.timer_status = eTimer()
        self.timer_status.timeout.callback.append(self.buildStatusList)

        self.timer_labels = eTimer()
        self.timer_labels.timeout.callback.append(self.refreshLabels)

        self.onLayoutFinish.append(self.loadData)
Exemplo n.º 11
0
			self["menu_path_compressed"] = StaticText(menu_path + " >" if not menu_path.endswith(' / ') else menu_path[:-3] + " >" or "")
		else:
			title = screentitle
			self["menu_path_compressed"] = StaticText("")
		Screen.setTitle(self, title)

<<<<<<< HEAD
		language.InitLang()
		self.oldActiveLanguage = language.getActiveLanguage()
		self.catalog = language.getActiveCatalog()

		self.list = []
# 		self["flag"] = Pixmap()
		self["summarylangname"] = StaticText()
		self["summarylangsel"] = StaticText()
		self["languages"] = List(self.list)
		self["languages"].onSelectionChanged.append(self.changed)
=======
		self.oldActiveLanguage = language.getActiveLanguage()

		self.list = []
		self["summarylangname"] = StaticText()
		self["languages"] = List(self.list)
>>>>>>> dev/Dev

		self.updateList()
		self.onLayoutFinish.append(self.selectActiveLanguage)

		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("Save"))
<<<<<<< HEAD
Exemplo n.º 12
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.session = session
		
		skin = skin_path + 'jmx_bouquets.xml'
		with open(skin, 'r') as f:
			self.skin = f.read()
			
		self.setup_title = _('Choose Bouquets')
		
		self.startList = []
		self.drawList = []
		
		self.pause = 100
		
		self['list'] = List(self.drawList) 
		
		self['key_red'] = StaticText('')
		self['key_green'] = StaticText('')
		self['key_yellow'] = StaticText('')
		self['key_blue'] = StaticText('')
		self['key_info'] = StaticText('')
		self['description'] = Label('')
		self['lab1'] = Label(_('Loading data... Please wait...'))
		
		self['setupActions'] = ActionMap(['ColorActions', 'SetupActions', 'ChannelSelectEPGActions'], {
			 'red': self.keyCancel,
			 'green': self.keyGreen,
			 'yellow': self.toggleAllSelection,
			 'blue': self.clearAllSelection,
			 'save': self.keyGreen,
			 'cancel': self.keyCancel,
			 'ok': self.toggleSelection,
			 'info': self.viewChannels,
			 'showEPGList': self.viewChannels
			 }, -2)
			 
		self['key_red'] = StaticText(_('Cancel'))
		self['key_green'] = StaticText(_('Create'))
		self['key_yellow'] = StaticText(_('Invert'))
		self['key_blue'] = StaticText(_('Clear All'))
		self['key_info'] = StaticText(_('Show Channels'))
		self['description'] = Label(_('Select the playlist categories you wish to create bouquets for.\nPress OK to invert the selection.\nPress INFO to show the channels in this category.'))
		
		self['list'].onSelectionChanged.append(self.getCurrentEntry)
		
		self.cat_list = ''
		self.currentSelection = 0
		
		self.playlisttype = jglob.current_playlist['playlist_info']['playlisttype']
		

		if self.playlisttype == 'xtream':
			protocol = jglob.current_playlist['playlist_info']['protocol']
			domain = jglob.current_playlist['playlist_info']['domain']
			port = str(jglob.current_playlist['playlist_info']['port'])   
			host = str(protocol) + str(domain) + ':' + str(port) + '/' 
			username = jglob.current_playlist['playlist_info']['username']
			password = jglob.current_playlist['playlist_info']['password']
			player_api = str(host) + 'player_api.php?username='******'&password='******'&action=get_live_categories'
			self.VodCategoriesUrl = player_api + '&action=get_vod_categories'
			self.SeriesCategoriesUrl = player_api + '&action=get_series_categories'
		
			self.LiveStreamsUrl = player_api + '&action=get_live_streams'
			self.VodStreamsUrl = player_api + '&action=get_vod_streams'
			self.SeriesUrl = player_api + '&action=get_series'
			
			if jglob.live:
				self['lab1'].setText('Downloading Live data')
				
				self.timer = eTimer()
				self.timer.start(self.pause, 1)
				try: 
					self.timer_conn = self.timer.timeout.connect(self.downloadLive)
				except:
					self.timer.callback.append(self.downloadLive)
					
			elif jglob.vod:
				self['lab1'].setText('Downloading VOD data')
				
				self.timer = eTimer()
				self.timer.start(self.pause, 1)
				try: 
					self.timer_conn = self.timer.timeout.connect(self.downloadVod)
				except:
					self.timer.callback.append(self.downloadVod)
					
			elif jglob.series:
				self['lab1'].setText('Downloading Series data')
				
				self.timer = eTimer()
				self.timer.start(self.pause, 1)
				try:
					self.timer_conn = self.timer.timeout.connect(self.downloadSeries)
				except:
					self.timer.callback.append(self.downloadSeries)
					
			else:
				self.close()
 
		else:
			self.onFirstExecBegin.append(self.m3uStart)
		self.onLayoutFinish.append(self.__layoutFinished)
Exemplo n.º 13
0
 def __init__(self, list, enableWrapAround=False):
     List.__init__(self, list, enableWrapAround, item_height=50)
Exemplo n.º 14
0
	def modifyEntry(self, index, data):
		self._list[index] = data
		List.modifyEntry(self, index, data)
Exemplo n.º 15
0
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Software Panel"))
		skin = """
		<screen name="SoftwarePanel" position="center,center" size="650,605" title="Software Panel">
			<widget name="a_off" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/aoff.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="a_red" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/ared.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="a_yellow" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/ayellow.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="a_green" pixmap="/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/icons/agreen.png" position="10,10" zPosition="1" size="36,97" alphatest="on" />
			<widget name="feedstatusRED" position="60,14" size="200,30" zPosition="1" font="Regular;25" halign="left" transparent="1" />
			<widget name="feedstatusYELLOW" position="60,46" size="200,30" zPosition="1" font="Regular;25" halign="left" transparent="1" />
			<widget name="feedstatusGREEN" position="60,78" size="200,30" zPosition="1" font="Regular;25" halign="left" transparent="1" />
			<widget name="packagetext" position="180,50" size="350,30" zPosition="1" font="Regular;25" halign="right" transparent="1" />
			<widget name="packagenr" position="511,50" size="50,30" zPosition="1" font="Regular;25" halign="right" transparent="1" />
			<widget source="list" render="Listbox" position="10,120" size="630,365" scrollbarMode="showOnDemand">
				<convert type="TemplatedMultiContent">
					{"template": [
							MultiContentEntryText(pos = (5, 1), size = (540, 28), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
							MultiContentEntryText(pos = (5, 26), size = (540, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description
							MultiContentEntryPixmapAlphaBlend(pos = (545, 2), size = (48, 48), png = 4), # index 4 is the status pixmap
							MultiContentEntryPixmapAlphaBlend(pos = (5, 50), size = (610, 2), png = 5), # index 4 is the div pixmap
						],
					"fonts": [gFont("Regular", 22),gFont("Regular", 14)],
					"itemHeight": 52
					}
				</convert>
			</widget>
			<ePixmap pixmap="skin_default/buttons/red.png" position=" 30,570" size="35,27" alphatest="blend" />
			<widget name="key_green_pic" pixmap="skin_default/buttons/green.png" position="290,570" size="35,27" alphatest="blend" />
			<widget name="key_red" position=" 80,573" size="200,26" zPosition="1" font="Regular;22" halign="left" transparent="1" />
			<widget name="key_green" position="340,573" size="200,26" zPosition="1" font="Regular;22" halign="left" transparent="1" />
		</screen> """
		self.skin = skin
		self.list = []
		self.statuslist = []
		self["list"] = List(self.list)
		self['a_off'] = Pixmap()
		self['a_red'] = Pixmap()
		self['a_yellow'] = Pixmap()
		self['a_green'] = Pixmap()
		self['key_green_pic'] = Pixmap()
		self['key_red_pic'] = Pixmap()
		self['key_red'] = Label(_("Cancel"))
		self['key_green'] = Label(_("Update"))
		self['packagetext'] = Label(_("Updates Available:"))
		self['packagenr'] = Label("0")
		self['feedstatusRED'] = Label("<  " + _("feed status"))
		self['feedstatusYELLOW'] = Label("<  " + _("feed status"))
		self['feedstatusGREEN'] = Label("<  " + _("feed status"))
		self['key_green'].hide()
		self['key_green_pic'].hide()
		self.update = False
		self.packages = 0
		self.ipkg = IpkgComponent()
		self.ipkg.addCallback(self.ipkgCallback)
		self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "ColorActions", "SetupActions"],
		{
			"cancel": self.Exit,
			"green": self.Green,
			"red": self.Exit,
		}, -2)

		self.onLayoutFinish.append(self.layoutFinished)
Exemplo n.º 16
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        list = []

        menuID = None
        for x in parent:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addMenu(list, x)
                    count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1

        self.menuID = menuID
        if config.ParentalControl.configured.value:
            ProtectedScreen.__init__(self)

        if menuID is not None:
            # plugins
            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break
                if len(l) > 4 and l[4]:
                    list.append(
                        (l[0], boundFunction(l[1], self.session,
                                             self.close), l[2], l[3] or 50))
                else:
                    list.append((l[0], boundFunction(l[1],
                                                     self.session), l[2], l[3]
                                 or 50))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")
        self.menuID = menuID
        ProtectedScreen.__init__(self)

        # Sort by Weight
        if config.usage.sort_menus.value:
            list.sort()
        else:
            list.sort(key=lambda x: int(x[3]))

        self["menu"] = List(list)

        self["actions"] = NumberActionMap(
            ["OkCancelActions", "MenuActions", "NumberActions"], {
                "ok": self.okbuttonClick,
                "cancel": self.closeNonRecursive,
                "menu": self.closeRecursive,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal
            })

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a)
        if a is None:
            a = _(parent.get("text", "").encode("UTF-8"))
        self["title"] = StaticText(a)
        Screen.setTitle(self, a)
        self.menu_title = a
Exemplo n.º 17
0
	def __init__(self):
		List.__init__(self, enableWrapAround=True, item_height=28, buildfunc=self.buildEntry)
		self.mode = 0
		self.list = []
Exemplo n.º 18
0
	def setList(self, list):
		self.list = list
		List.setList(self, list)
Exemplo n.º 19
0
    def __init__(self, session, args=None):
        Screen.__init__(self, session)
        self.session = session

        self.list = []
        self.SelectedIndex = None
        self.prev_running_service = None
        self.packages = []
        self.installedpackages = []
        self.upgradeablepackages = []
        self.ActiveFilterID = 0
        self.ActiveFilter = ""
        self.LocalFileName = ""
        #self.changeList = []
        self.maxSize = 8000000
        self.maxPackages = 15
        if self.getFreeSpace('/var/cache') > self.maxSize * 3:
            self.CacheDir = "/var/cache"
        elif self.getFreeSpace('/media/data') > self.maxSize * 4:
            self.CacheDir = "/media/data"
        elif self.getFreeSpace('/hdd') > self.maxSize * 4:
            self.CacheDir = "/hdd"
        else:
            self.CacheDir = "/var/cache"
            if fileExists('/hdd/epg.dat'):
                os_remove('/hdd/epg.dat')

        self.firstRun = True
        self.MainMenu = True
        self.pushUpgrade = True
        self.BlockedInstall = False
        #self.IPTVfullInstalled = False
        self.BlockedInput = True
        self.packages2upgrade = 0
        self.keyGreenAction = ""
        self.keyBlueAction = ""
        self.actionInfo = ""
        self.SkinSelectorInstalled = 0
        self.changed = False  #zmiana na True kiedy cokolwiek zainstalujemy
        self.Console = ComConsole()
        self.divpng = LoadPixmap(cached=True,
                                 path=resolveFilename(
                                     SCOPE_SKIN_IMAGE,
                                     'skin_default/div-h.png'))
        self.goinstalledpng = LoadPixmap(cached=True,
                                         path=PluginPath + 'icons/install.png')
        self.goremovepng = LoadPixmap(cached=True,
                                      path=PluginPath + 'icons/remove.png')
        self.gousbpng = LoadPixmap(cached=True,
                                   path=PluginPath + 'icons/opkg_local.png')
        self.installedpng = LoadPixmap(cached=True,
                                       path=PluginPath + 'icons/installed.png')
        self.upgradeablepng = LoadPixmap(cached=True,
                                         path=PluginPath +
                                         'icons/upgradeable.png')

        self["list"] = List(self.list)

        self["key_red"] = Label(_("Refresh list"))
        self["key_green"] = Label()
        self["key_blue"] = Label()
        self["key_yellow"] = Label()
        self["whatUPDATED"] = ScrollLabel()

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "DirectionActions"], {
                "cancel": self.keyCancel,
                "ok": self.doAction,
                "red": self.keyRed,
                "green": self.doAction,
                "yellow": self.keyYellow,
                "blue": self.keyBlue,
                "pageUp": self["whatUPDATED"].pageUp,
                "pageDown": self["whatUPDATED"].pageDown
            }, -2)

        self.onLayoutFinish.append(self.layoutFinished)
        self.onShown.append(self.checkFreeSpace)
        if self.selectionChanged not in self['list'].onSelectionChanged:
            self['list'].onSelectionChanged.append(self.selectionChanged)
Exemplo n.º 20
0
class HddFastRemove(Screen):

    skin = """
                <screen name="HddFastRemove" position="center,115" size="900,530" title="HddFastRemove" flags="wfBorder">
                      <ePixmap position="10,497" size="35,27" pixmap="skin_default/buttons/red.png" alphatest="blend" />
                      <ePixmap position="230,497" size="35,27" pixmap="skin_default/buttons/green.png" alphatest="blend" />
                      <ePixmap position="464,497" size="35,27" pixmap="skin_default/buttons/yellow.png" alphatest="blend" />
                      <ePixmap position="695,497" size="35,27" pixmap="skin_default/buttons/blue.png" alphatest="blend" />
                      <widget name="key_red" position="48,498" zPosition="2" size="150,22" valign="center" halign="center" font="Regular; 20" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
                      <widget name="key_green" position="273,499" zPosition="2" size="150,22" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="foreground" />
                      <widget name="key_yellow" position="508,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <widget name="key_blue" position="736,499" zPosition="3" size="150,22" valign="center" halign="center" font="Regular; 21" transparent="1" backgroundColor="foreground" />
                      <eLabel text="Hard Drive Remove" zPosition="2" position="10,11" size="880,40" halign="left" font="Regular;28" foregroundColor="un538eff" transparent="1" shadowColor="black" shadowOffset="-1,-1" backgroundColor="black" />
                      <widget source="menu" render="Listbox" position="11,58" size="880,410" scrollbarMode="showOnDemand" transparent="1">
                      <convert type="TemplatedMultiContent">
				{"template": [
					MultiContentEntryPixmapAlphaTest(pos = (5, 0), size = (48, 48), png = 0),
					MultiContentEntryText(pos = (65, 3), size = (190, 38), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1),
					MultiContentEntryText(pos = (65, 27), size = (190, 38), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 2),
					],
					"fonts": [gFont("Regular", 22), gFont("Regular", 18)],
					"itemHeight": 50
				}
			</convert>
                     </widget>
                    </screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)
        self.mdisks = Disks()
        self.mountpoints = MountPoints()
        self.mountpoints.read()
        self.disks = list()
        self.mounts = list()
        for disk in self.mdisks.disks:
            if disk[2] == True:
                diskname = disk[3]
                for partition in disk[5]:
                    mp = ""
                    rmp = ""
                    try:
                        mp = self.mountpoints.get(partition[0][:3],
                                                  int(partition[0][3:]))
                        rmp = self.mountpoints.getRealMount(
                            partition[0][:3], int(partition[0][3:]))
                    except Exception, e:
                        pass
                    if len(mp) > 0:
                        self.disks.append(
                            MountEntry(
                                disk[3],
                                "P.%s (Fixed: %s)" % (partition[0][3:], mp)))
                        self.mounts.append(mp)
                    elif len(rmp) > 0:
                        self.disks.append(
                            MountEntry(
                                disk[3],
                                "P.%s (Fast: %s)" % (partition[0][3:], rmp)))
                        self.mounts.append(rmp)

        self["menu"] = List(self.disks)
        self["key_red"] = Button(_("Umount"))
        self["key_blue"] = Button(_("Exit"))
        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "blue": self.quit,
            "red": self.red,
            "cancel": self.quit,
        }, -2)
Exemplo n.º 21
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.session = session

        skin = skin_path + 'jmx_playlist.xml'
        with open(skin, 'r') as f:
            self.skin = f.read()

        self.setup_title = _('Playlists')

        self.drawList = []
        self.playlists_all = []

        # check if playlists.txt file exists in specified location
        if os.path.isfile(
                playlist_path) and os.stat(playlist_path).st_size > 0:
            self.removeBlanks()
            self.checkFile()
        else:
            open(playlist_path, 'a').close()

        self["playlists"] = List(self.drawList)
        self['lab1'] = Label(_('Loading data... Please wait...'))

        if jglob.playlist_exists is not True:
            self['key_red'] = StaticText(_('Back'))
            self['key_green'] = StaticText(_('Add Playlist'))
            self['key_yellow'] = StaticText('')
            self['key_blue'] = StaticText('')
            self['key_channelup'] = StaticText('')
            self['key_info'] = StaticText('')
            self['lastupdate'] = Label('')
            self['liveupdate'] = Label('')
            self['vodupdate'] = Label('')
            self['seriesupdate'] = Label('')
            self['description'] = Label(
                'Press Green to add your playlist details.\nOr enter your playlist url in %s'
                % cfg.location.value +
                'playlists.txt\ne.g. http://domain.xyx:8000/get.php?username=user&password=pass&type=m3u_plus&output=ts'
            )

            self['setupActions'] = ActionMap(
                ['ColorActions', 'OkCancelActions'], {
                    'red': self.quit,
                    'green': self.addPlaylist,
                    'cancel': self.quit
                }, -2)

        else:
            self['setupActions'] = ActionMap(
                [
                    'ColorActions', 'SetupActions', 'TvRadioActions',
                    'ChannelSelectEPGActions'
                ], {
                    'red': self.quit,
                    'green': self.addPlaylist,
                    'yellow': self.editPlaylist,
                    'blue': self.deletePlaylist,
                    'info': self.openUserInfo,
                    'showEPGList': self.openUserInfo,
                    'keyTV': self.createBouquet,
                    'ok': self.createBouquet,
                    'cancel': self.quit
                }, -2)

            self['key_red'] = StaticText(_('Back'))
            self['key_green'] = StaticText(_('Add Playlist'))
            self['key_yellow'] = StaticText(_('Edit Playlist'))
            self['key_blue'] = StaticText(_('Delete Playlist'))
            self['key_info'] = StaticText(_('User Info'))
            self['description'] = Label(
                _('Press OK to create bouquets. \nView your bouquets by exiting the Jedi plugin and then press the TV button. \nGo into EPG Importer plugin settings, select your playlist in sources... Save... Manually download sources.'
                  ))
            self['lastupdate'] = Label(_('Last Update:'))
            self['liveupdate'] = Label('Live: ---')
            self['vodupdate'] = Label('Vod: ---')
            self['seriesupdate'] = Label('Series: ---')

        self.onLayoutFinish.append(self.__layoutFinished)

        jglob.current_selection = 0

        self.list = []

        self.timer = eTimer()
        self.timer.start(100, 1)
        try:  # DreamOS fix
            self.timer_conn = self.timer.timeout.connect(self.loadPlaylist)
        except:
            self.timer.callback.append(self.loadPlaylist)
Exemplo n.º 22
0
def buildDeviceList(device, List):
    if re.search('mmcblk[0-1]p[0-3]', device):
        device2 = re.sub('p[0-9]', '', device)
    else:
        device2 = re.sub('[0-9]', '', device)
    devicetype = path.realpath('/sys/block/' + device2 + '/device')

    # print('[MountManager] device: %s' %device)
    # print('[MountManager] device2: %s' %device2)
    # print('[MountManager] devicetype:%s' %devicetype)
    # print('[MountManager] Type:%s' %SystemInfo["MountManager"])

    name = _("Hard disk: ")
    if path.exists(
            resolveFilename(SCOPE_CURRENT_SKIN, "visioncore/dev_hdd.png")):
        mypixmap = resolveFilename(SCOPE_CURRENT_SKIN,
                                   "visioncore/dev_hdd.png")
    else:
        mypixmap = '/usr/lib/enigma2/python/Plugins/SystemPlugins/Vision/images/dev_hdd.png'
    if path.exists('/sys/block/' + device2 + '/device/model'):
        model = open('/sys/block/' + device2 + '/device/model').read()
    elif path.exists('/sys/block/' + device2 + '/device/name'):
        model = open('/sys/block/' + device2 + '/device/name').read()
    model = str(model).replace('\n', '')

    if devicetype.find('usb') != -1:
        name = _('USB: ')
        if path.exists(
                resolveFilename(SCOPE_CURRENT_SKIN, "visioncore/dev_usb.png")):
            mypixmap = resolveFilename(SCOPE_CURRENT_SKIN,
                                       "visioncore/dev_usb.png")
        else:
            mypixmap = '/usr/lib/enigma2/python/Plugins/SystemPlugins/Vision/images/dev_usb.png'
    elif devicetype.find('mmc') != -1:
        name = _('SDCARD: ')
        if path.exists(
                resolveFilename(SCOPE_CURRENT_SKIN, "visioncore/dev_sd.png")):
            mypixmap = resolveFilename(SCOPE_CURRENT_SKIN,
                                       "visioncore/dev_sd.png")
        else:
            mypixmap = '/usr/lib/enigma2/python/Plugins/SystemPlugins/Vision/images/dev_sd.png'
    name += model
    description = ''
    mediamount = _("None")
    devicetype = _("unavailable")
    rw = _("None")

    with open('/proc/mounts', 'r') as f:
        for line in f.readlines():
            if line.find(device) != -1:
                parts = line.strip().split()
                mediamount = parts[1]  # media mount e.g. /media/xxxxx
                devicetype = parts[2]  # device type e.g. ext4
                rw = parts[3]  # read/write
                break

    if mediamount == _("None") or mediamount == None:
        description = _("Size: ") + _("unavailable")
    else:
        stat = statvfs(mediamount)
        cap = int(stat.f_blocks * stat.f_bsize)
        size = cap / 1000 / 1000
        if ((float(size) / 1024) / 1024) >= 1:
            description = _("Size: ") + str(
                round(((float(size) / 1024) / 1024), 2)) + _("TB")
        elif (size / 1024) >= 1:
            description = _("Size: ") + str(round(
                (float(size) / 1024), 2)) + _("GB")
        elif size >= 1:
            description = _("Size: ") + str(size) + _("MB")
        else:
            description = _("Size: ") + _("unavailable")
    if description != '':
        if SystemInfo["MountManager"]:
            if rw.startswith('rw'):
                rw = ' R/W'
            elif rw.startswith('ro'):
                rw = ' R/O'
            else:
                rw = ""
            description += '\t' + _("Mount: ") + mediamount + '\n' + _(
                "Device: ") + '/dev/' + device + '\t' + _(
                    "Type: ") + devicetype + rw
            png = LoadPixmap(mypixmap)
            res = (name, description, png)
        else:
            Gmedia = [('/media/' + device, '/media/' + device),
                      ('/media/hdd', '/media/hdd'),
                      ('/media/hdd2', '/media/hdd2'),
                      ('/media/hdd3', '/media/hdd3'),
                      ('/media/usb', '/media/usb'),
                      ('/media/usb2', '/media/usb2'),
                      ('/media/usb3', '/media/usb3'),
                      ('/media/sdcard', '/media/sdcard')]
            item = NoSave(
                ConfigSelection(default='/media/' + device, choices=Gmedia))
            if devicetype == 'Linux':
                devicetype = 'ext4'
            else:
                devicetype = 'auto'
            item.value = mediamount.strip()
            text = name + ' ' + description + ' /dev/' + device
            res = getConfigListEntry(text, item, device, devicetype)
        List.append(res)
Exemplo n.º 23
0
 def __init__(self, session):
     Screen.__init__(self, session)
     HelpableScreen.__init__(self)
     self["key_menu"] = StaticText(_("MENU"))
     self["key_info"] = StaticText(_("INFO"))
     self["key_red"] = StaticText()
     self["key_green"] = StaticText()
     self["key_yellow"] = StaticText()
     self["icons"] = MultiPixmap()
     self["icons"].hide()
     self["locales"] = List(None, enableWrapAround=True)
     self["locales"].onSelectionChanged.append(self.selectionChanged)
     self["description"] = StaticText()
     self["selectionActions"] = HelpableActionMap(
         self,
         "LocaleSelectionActions", {
             "menu": (self.keySettings,
                      _("Manage Locale/Language Selection settings")),
             "current": (self.keyCurrent,
                         _("Jump to the currently active locale/language")),
             "select":
             (self.keySelect,
              _("Select the currently highlighted locale/language for the user interface"
                )),
             "close":
             (self.closeRecursive,
              _("Cancel any changes the active locale/language and exit all menus"
                )),
             "cancel":
             (self.keyCancel,
              _("Cancel any changes to the active locale/language and exit")
              ),
             "save":
             (self.keySave,
              _("Apply any changes to the active locale/langauge and exit"))
         },
         prio=0,
         description=_("Locale/Language Selection Actions"))
     self["manageActions"] = HelpableActionMap(
         self,
         "LocaleSelectionActions", {
             "manage":
             (self.keyManage,
              (_("Purge all but / Add / Delete the currently highlighted locale/language"
                 ),
               _("Purge all but the current and permanent locales/languages.  Add the current locale/language if it is not installed.  Delete the current locale/language if it is installed."
                 )))
         },
         prio=0,
         description=_("Locale/Language Selection Actions"))
     topItem = _("Move up to first line")
     topDesc = _("Move up to the first line in the list.")
     pageUpItem = _("Move up one screen")
     pageUpDesc = _(
         "Move up one screen.  Move to the first line of the screen if this is the first screen."
     )
     upItem = _("Move up one line")
     upDesc = _(
         "Move up one line.  Move to the bottom of the previous screen if this is the first line of the screen.  Move to the last of the entry / list if this is the first line of the list."
     )
     downItem = _("Move down one line")
     downDesc = _(
         "Move down one line.  Move to the top of the next screen if this is the last line of the screen.  Move to the first line of the list if this is the last line on the list."
     )
     pageDownItem = _("Move down one screen")
     pageDownDesc = _(
         "Move down one screen.  Move to the last line of the screen if this is the last screen."
     )
     bottomItem = _("Move down to last line")
     bottomDesc = _("Move down to the last line in the list.")
     self["navigationActions"] = HelpableActionMap(
         self,
         "NavigationActions", {
             "top": (self.keyTop, (topItem, topDesc)),
             "pageUp": (self.keyPageUp, (pageUpItem, pageUpDesc)),
             "up": (self.keyUp, (upItem, upDesc)),
             "first": (self.keyTop, (topItem, topDesc)),
             "left": (self.keyPageUp, (pageUpItem, pageUpDesc)),
             "right": (self.keyPageDown, (pageDownItem, pageDownDesc)),
             "last": (self.keyBottom, (bottomItem, bottomDesc)),
             "down": (self.keyDown, (downItem, downDesc)),
             "pageDown": (self.keyPageDown, (pageDownItem, pageDownDesc)),
             "bottom": (self.keyBottom, (bottomItem, bottomDesc))
         },
         prio=0,
         description=_("List Navigation Actions"))
     self.initialLocale = international.getLocale()
     self.currentLocale = self.initialLocale
     self.packageTimer = eTimer()
     self.packageTimer.callback.append(self.processPackage)
     self.packageDoneTimer = eTimer()
     self.packageDoneTimer.callback.append(self.processPackageDone)
     self.onLayoutFinish.append(self.layoutFinished)
Exemplo n.º 24
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self["left"] = Pixmap()
     self["middle"] = Pixmap()
     self["right"] = Pixmap()
     self.Console = Console()
     list = []
     testl = "0"
     if config.plugins.um_globalsettings.networkinterface.value == True:
         list.append((_("Network Interface"), "NetworkAdapterSelection",
                      "MenuIconNetwork.png", "MenuIconNetworksw.png"))
         if testl == "0":
             self["text"] = Label(_("Network Interface"))
             list.append((_("Network Interface"), "NetworkAdapterSelection",
                          "MenuIconNetwork.png", "MenuIconNetworksw.png"))
             testl = "1"
     if config.plugins.um_globalsettings.telnetcommand.value == True:
         list.append((_("Telnet Command"), "TelnetCommand",
                      "MenuIconTelnet.png", "MenuIconTelnetsw.png"))
         if testl == "0":
             self["text"] = Label(_("Telnet Command"))
             list.append((_("Telnet Command"), "TelnetCommand",
                          "MenuIconTelnet.png", "MenuIconTelnetsw.png"))
             testl = "1"
     if config.plugins.um_globalsettings.softwareupdate.value == True:
         list.append(
             (_("Software Update"), "SoftwarePanel",
              "MenuIconSoftwareUpdate.png", "MenuIconSoftwareUpdatesw.png"))
         if testl == "0":
             self["text"] = Label(_("Software Update"))
             list.append((_("Software Update"), "SoftwarePanel",
                          "MenuIconSoftwareUpdate.png",
                          "MenuIconSoftwareUpdatesw.png"))
             testl = "1"
     if config.plugins.um_globalsettings.softwaremanagersetup.value == True:
         list.append((_("Software Manager Setup"), "SoftwareManagerSetup",
                      "MenuIconSoftwareManager.png",
                      "MenuIconSoftwareManagersw.png"))
         if testl == "0":
             self["text"] = Label(_("Software Manager Setup"))
             list.append(
                 (_("Software Manager Setup"), "SoftwareManagerSetup",
                  "SoftwareManagerSetup.png",
                  "MenuIconSoftwareManagersw.png"))
             testl = "1"
     if config.plugins.um_globalsettings.Skin.value == True:
         list.append((_("skin selektor"), "SkinSelector",
                      "MenuIconSkin.png", "MenuIconSkinsw.png"))
         if testl == "0":
             self["text"] = Label(_("Skin Selektor"))
             list.append((_("skin selektor"), "SkinSelector",
                          "MenuIconSkin.png", "MenuIconSkinsw.png"))
             testl = "1"
     if config.plugins.um_globalsettings.Mediacenter.value == True:
         if os.path.exists(
                 "/usr/lib/enigma2/python/Plugins/Extensions/BMediaCenter"):
             from Plugins.Extensions.BMediaCenter.plugin import DMC_MainMenu
             list.append((_("Media Center"), "DMC_MainMenu",
                          "MenuIconMC.png", "MenuIconMCsw.png"))
             if testl == "0":
                 self["text"] = Label(_("Media Center"))
                 list.append((_("Media Center"), "DMC_MainMenu",
                              "MenuIconMC.png", "MenuIconMCsw.png"))
                 testl = "1"
     if config.plugins.um_globalsettings.Weather.value == True:
         if os.path.exists(
                 "/usr/lib/enigma2/python/Plugins/Extensions/BMediaCenter"):
             from Plugins.Extensions.BMediaCenter.Weather import MeteoMain
             list.append((_("Weather"), "MeteoMain", "MenuIconWeather.png",
                          "MenuIconWeathersw.png"))
             if testl == "0":
                 self["text"] = Label(_("Yahoo Weather"))
                 list.append(
                     (_("Weather"), "MeteoMain", "MenuIconWeather.png",
                      "MenuIconWeathersw.png"))
                 testl = "1"
     if testl == "0":
         self["text"] = Label(_("No UserMainMenuSetup"))
         list.append((_("Exit"), "Exit", "MenuIconUserMenu.png",
                      "MenuIconUserMenusw.png"))
     else:
         list.append((_("Exit"), "Exit", "MenuIconUserMenu.png",
                      "MenuIconUserMenusw.png"))
     global Xlen
     Xlen = len(list)
     self['key_blue'] = Button(_('UserMenuSetup'))
     self["menu"] = List(list)
     self["actions"] = ActionMap(
         ["OkCancelActions", "DirectionActions", "ColorActions"], {
             "cancel": self.Exit,
             "ok": self.okbuttonClick,
             "right": self.next,
             "upRepeated": self.prev,
             "down": self.next,
             "downRepeated": self.next,
             "leftRepeated": self.prev,
             "rightRepeated": self.next,
             "up": self.prev,
             "left": self.prev,
             "blue": self.User_MainMenuSetup,
         }, -1)
Exemplo n.º 25
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.session = session

        skin = skin_path + 'catchup.xml'

        with open(skin, 'r') as f:
            self.skin = f.read()

        self.setup_title = (_('Catch Up TV'))
        self.main_title = (_('Catch Up TV'))

        url = str(glob.current_playlist['playlist_info']['player_api']) + "&action=get_live_categories"

        self.level = 1
        self.category = 0

        glob.nextlist = []
        glob.nextlist.append({"playlist_url": url, "index": 0, "level": self.level})

        self["channel"] = StaticText(self.main_title)

        self.list = []
        self.channelList = []
        self["channel_list"] = List(self.channelList, enableWrapAround=True)
        self.selectedlist = self["channel_list"]

        # epg variables
        self["epg_bg"] = Pixmap()
        self["epg_bg"].hide()

        self["epg_title"] = StaticText()
        self["epg_description"] = StaticText()

        self.epgshortlist = []
        self["epg_short_list"] = List(self.epgshortlist, enableWrapAround=True)
        self["epg_short_list"].onSelectionChanged.append(self.displayShortEPG)

        self["epg_picon"] = Pixmap()
        self["epg_picon"].hide()

        self["key_red"] = StaticText(_('Back'))
        self["key_green"] = StaticText(_('OK'))
        self["key_rec"] = StaticText('')

        self.isStream = False
        self.pin = False

        self.protocol = glob.current_playlist['playlist_info']['protocol']
        self.domain = glob.current_playlist['playlist_info']['domain']
        self.host = glob.current_playlist['playlist_info']['host']
        self.livetype = glob.current_playlist['player_info']['livetype']
        self.username = glob.current_playlist['playlist_info']['username']
        self.password = glob.current_playlist['playlist_info']['password']
        self.output = glob.current_playlist['playlist_info']['output']

        self.live_categories = str(glob.current_playlist['playlist_info']['player_api']) + "&action=get_live_categories"
        self.live_streams = str(glob.current_playlist['playlist_info']['player_api']) + "&action=get_live_streams"
        self.simpledatatable = str(glob.current_playlist['playlist_info']['player_api']) + "&action=get_simple_data_table&stream_id="

        self["page"] = StaticText('')
        self["listposition"] = StaticText('')
        self.page = 0
        self.pageall = 0
        self.position = 0
        self.positionall = 0
        self.itemsperpage = 10

        self.showingshortEPG = False

        self.listType = ''

        self["actions"] = ActionMap(["XStreamityActions"], {
            'red': self.back,
            'cancel': self.back,
            'ok': self.__next__,
            'green': self.__next__,
            "left": self.pageUp,
            "right": self.pageDown,
            "up": self.goUp,
            "down": self.goDown,
            "channelUp": self.pageUp,
            "channelDown": self.pageDown,
            "0": self.reset,
            "rec": self.downloadVideo,
        }, -2)

        self.onFirstExecBegin.append(self.createSetup)
        self.onLayoutFinish.append(self.__layoutFinished)
Exemplo n.º 26
0
    def __init__(self, session, service):
        self.skin = CutListEditor.skin
        Screen.__init__(self, session)
        Screen.setTitle(self, _("Cutlist editor"))
        InfoBarSeek.__init__(self, actionmap="CutlistSeekActions")
        InfoBarCueSheetSupport.__init__(self)
        InfoBarBase.__init__(self, steal_current_service=True)
        HelpableScreen.__init__(self)
        self.old_service = session.nav.getCurrentlyPlayingServiceReference()
        self.service = service
        session.nav.playService(service)
        self.pauseService()

        # disable cutlists. we want to freely browse around in the movie
        # However, downloading and uploading the cue sheet restores the
        # default state, so we need to keep disabling it.
        self.cut_state = 2

        self.getCuesheet()

        # preserve the original cuts to possibly restore them later
        self.prev_cuts = self.cut_list[:]
        self.last_mark = [
            x for x in self.prev_cuts if x[1] == self.CUT_TYPE_LAST
        ]
        self.edited = False
        self.MovieSelection = isinstance(
            self.session.current_dialog,
            MovieSelection) and self.session.current_dialog

        self["InLen"] = Label()
        self["OutLen"] = Label()
        self["Timeline"] = ServicePositionGauge(self.session.nav)
        self["cutlist"] = List(self.getCutlist())
        self["cutlist"].onSelectionChanged.append(self.selectionChanged)
        self["SeekState"] = Label()
        self.onPlayStateChanged.append(self.updateStateLabel)
        self.updateStateLabel(self.seekstate)

        self["key_red"] = Label(_("Start cut"))
        self["key_green"] = Label(_("End cut"))
        self["key_yellow"] = Label(_("Step back"))
        self["key_blue"] = Label(_("Step forward"))

        self["SeekActions"].actions.update({"stepFwd": self.stepFwd})
        self.helpList.append(
            (self["SeekActions"], "CutlistSeekActions", [("stepFwd",
                                                          _("Step forward"))]))

        desktopSize = getDesktop(0).size()
        self["Video"] = VideoWindow(decoder=0,
                                    fb_width=desktopSize.width(),
                                    fb_height=desktopSize.height())

        self["actions"] = HelpableActionMap(
            self,
            "CutListEditorActions", {
                "setIn": (self.setIn, _("Make this mark an 'in' point")),
                "setOut": (self.setOut, _("Make this mark an 'out' point")),
                "setStart":
                (self.setStart, _("Make this mark the initial 'in' point")),
                "setEnd":
                (self.setEnd, _("Make this mark the final 'out' point")),
                "setMark": (self.setMark, _("Make this mark just a mark")),
                "addMark": (self.__addMark, _("Add a mark")),
                "removeMark": (self.__removeMark, _("Remove a mark")),
                "execute": (self.execute, _("Execute cuts and exit")),
                "quickExecute": (self.quickExecute, _("Quick execute...")),
                "leave": (self.exit, _("Exit editor")),
                "showMenu": (self.showMenu, _("Menu")),
                "backMenu": (self.backMenu, _("Restore previous cuts...")),
            },
            prio=-4)

        self.onExecBegin.append(self.showTutorial)
        self.__event_tracker = ServiceEventTracker(
            screen=self,
            eventmap={iPlayableService.evCuesheetChanged: self.refillList})

        # to track new entries we save the last version of the cutlist
        self.last_cuts = self.getCutlist()
        self.cut_start = None
        self.cut_end = None
        self.state = CutListContextMenu.SHOW_DELETECUT
        self.inhibit_seek = False
        self.inhibit_cut = False
        self.onClose.append(self.__onClose)
        # Use onShown to set the initial list index, since apparently that doesn't
        # work from here.
        self.onShown.append(self.__onShown)
Exemplo n.º 27
0
    def __init__(self,
                 session,
                 showSteps=True,
                 showStepSlider=True,
                 showList=True,
                 showConfig=True):
        Screen.__init__(self, session)
        self.isLastWizard = False
        self.stepHistory = []
        self.wizard = {}
        parser = make_parser()
        if not isinstance(self.xmlfile, list):
            self.xmlfile = [self.xmlfile]
        wizardHandler = self.parseWizard(self.wizard)
        parser.setContentHandler(wizardHandler)
        for xmlfile in self.xmlfile:
            if xmlfile[0] != '/':
                parser.parse(eEnv.resolve('${datadir}/enigma2/') + xmlfile)
            else:
                parser.parse(xmlfile)

        self.showSteps = showSteps
        self.showStepSlider = showStepSlider
        self.showList = showList
        self.showConfig = showConfig
        self.numSteps = len(self.wizard)
        self.currStep = self.getStepWithID('start') + 1
        self.timeoutTimer = eTimer()
        self.timeoutTimer.callback.append(self.timeoutCounterFired)
        self['text'] = Label()
        if showConfig:
            self['config'] = ConfigList([], session=session)
        if self.showSteps:
            self['step'] = Label()
        if self.showStepSlider:
            self['stepslider'] = Slider(1, self.numSteps)
        if self.showList:
            self.list = []
            self['list'] = List(self.list, enableWrapAround=True)
            self['list'].onSelectionChanged.append(self.selChanged)
        self.onShown.append(self.updateValues)
        self.configInstance = None
        self.currentConfigIndex = None
        Wizard.instance = self
        self.lcdCallbacks = []
        self.first = False
        self.disableKeys = False
        self['actions'] = NumberActionMap(
            [
                'WizardActions', 'DirectionActions', 'NumberActions',
                'ColorActions', 'SetupActions', 'InputAsciiActions',
                'KeyboardInputActions'
            ], {
                'gotAsciiCode': self.keyGotAscii,
                'ok': self.ok,
                'back': self.back,
                'left': self.left,
                'right': self.right,
                'up': self.up,
                'down': self.down,
                'red': self.red,
                'green': self.green,
                'yellow': self.yellow,
                'blue': self.blue,
                'deleteBackward': self.deleteBackward,
                'deleteForward': self.deleteForward,
                '1': self.keyNumberGlobal,
                '2': self.keyNumberGlobal,
                '3': self.keyNumberGlobal,
                '4': self.keyNumberGlobal,
                '5': self.keyNumberGlobal,
                '6': self.keyNumberGlobal,
                '7': self.keyNumberGlobal,
                '8': self.keyNumberGlobal,
                '9': self.keyNumberGlobal,
                '0': self.keyNumberGlobal
            }, -1)
        self['VirtualKB'] = NumberActionMap(
            ['VirtualKeyboardActions'], {'showVirtualKeyboard': self.KeyText},
            -2)
        self['VirtualKB'].setEnabled(False)
        return
Exemplo n.º 28
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        list = []

        menuID = None
        count = 0
        for x in parent:  #walk through the actual nodelist
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                self.addMenu(list, x)
                count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            description = x.get("description",
                                                "").encode("UTF-8") or None
                            description = description and _(description)
                            menupng = MenuEntryPixmap(menuID, self.png_cache,
                                                      lastMenuID)
                            list.append((x[0],
                                         boundFunction(self.runScreen,
                                                       (x[2], x[3] + ", ")),
                                         x[4], description, menupng))
                            count += 1

        if menuID is not None:
            # plugins
            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break
                description = plugins.getDescriptionForMenuEntryID(
                    menuID, plugin_menuid)
                menupng = MenuEntryPixmap(l[2], self.png_cache, lastMenuID)
                list.append((l[0], boundFunction(l[1],
                                                 self.session), l[2], l[3]
                             or 50, description, menupng))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")

        # Sort by Weight
        list.sort(key=lambda x: int(x[3]))

        self._list = List(list)
        self._list.onSelectionChanged.append(self._onSelectionChanged)
        self["menu"] = self._list
        self["pixmap"] = Pixmap()
        self["description"] = StaticText()

        self["actions"] = NumberActionMap(
            ["OkCancelActions", "MenuActions", "NumberActions"], {
                "ok": self.okbuttonClick,
                "cancel": self.closeNonRecursive,
                "menu": self.closeRecursive,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal
            })

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a)
        if a is None:
            a = _(parent.get("text", "").encode("UTF-8"))
        self["title"] = StaticText(a)
        self.menu_title = a
        self.onLayoutFinish.append(self._onLayoutFinish)
Exemplo n.º 29
0
	def __init__(self, session, startList, currentList):
		Screen.__init__(self, session)
		self.session = session

		self.currentList =[]
		self.currentList.append(currentList)

		skin = skin_path + 'catchup.xml'

		with open(skin, 'r') as f:
			self.skin = f.read()

		self.setup_title = (_('Catch Up TV'))
		self.main_title = self.currentList[-1]["title"]

		self["channel"] = StaticText(self.main_title)

		self.list1 = []
		self.channelList = []
		self["channel_list"] = List(self.channelList, enableWrapAround=True)
		self["channel_list"].onSelectionChanged.append(self.selectionChanged)
		self.selectedlist = self["channel_list"]

		#epg variables
		self["epg_bg"] = Pixmap()
		self["epg_bg"].hide()
		self["epg_title"] = StaticText()
		self["epg_description"] = StaticText()
		self["epg_picon"] = Pixmap()
		self["epg_picon"].hide()
		
		self.catchup_all = []
		self["catchup_list"] = List(self.catchup_all, enableWrapAround=True)
		self["catchup_list"].onSelectionChanged.append(self.selectionChanged)
		


		self["key_red"] = StaticText(_('Back'))
		self["key_green"] = StaticText(_('OK'))
		self["key_yellow"] = StaticText('')
		self["key_blue"] = StaticText('')

		self.isStream = False
		self.pin = False

		self.protocol = glob.current_playlist['playlist_info']['protocol']
		self.domain = glob.current_playlist['playlist_info']['domain']
		self.host = glob.current_playlist['playlist_info']['host']
		self.username = glob.current_playlist['playlist_info']['username']
		self.password = glob.current_playlist['playlist_info']['password']
		self.live_categories = "%s/player_api.php?username=%s&password=%s&action=get_live_streams" % (self.host, self.username, self.password)
		self.simpledatatable = "%s/player_api.php?username=%s&password=%s&action=get_simple_data_table&stream_id=" % (self.host, self.username, self.password)
		
		self.downloadingpicon = False

		self["actions"] = ActionMap(["XStreamityActions"], {
			'red': self.back,
			'cancel': self.back,
			'ok' :  self.next,
			'green' : self.next,
			"left": self.pageUp,
			"right": self.pageDown,
			"up": self.goUp,
			"down": self.goDown,
			"channelUp": self.pageUp,
			"channelDown": self.pageDown,
			"0": self.reset,
			}, -2)

		glob.nextlist = []
		glob.nextlist.append({"playlist_url": self.currentList[-1]["playlist_url"], "index": 0})

		self.onFirstExecBegin.append(self.createSetup)
		self.onLayoutFinish.append(self.__layoutFinished)
Exemplo n.º 30
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)

        self.sort_mode = False
        self.selected_entry = None
        self.sub_menu_sort = None

        self["green"] = Label()
        self["yellow"] = Label()
        self["blue"] = Label()

        m_list = []

        menuID = None
        for x in parent:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(m_list, x)
                    count += 1
            elif x.tag == 'menu':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addMenu(m_list, x)
                    count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            m_list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1
        self.menuID = menuID

        if menuID is not None:
            # plugins
            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in m_list:
                    if x[2] == plugin_menuid:
                        m_list.remove(x)
                        break
                if len(l) > 4 and l[4]:
                    m_list.append(
                        (l[0], boundFunction(l[1], self.session,
                                             self.close), l[2], l[3] or 50))
                else:
                    m_list.append(
                        (l[0], boundFunction(l[1], self.session), l[2], l[3]
                         or 50))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")
        self.menuID = menuID
        ProtectedScreen.__init__(self)

        if config.plugins.infopanel_usermenus is not None and menuID == "mainmenu":
            plugin_list = []
            id_list = []
            for l in plugins.getPlugins([
                    PluginDescriptor.WHERE_PLUGINMENU,
                    PluginDescriptor.WHERE_EXTENSIONSMENU,
                    PluginDescriptor.WHERE_EVENTINFO
            ]):
                l.id = (l.name.lower()).replace(' ', '_')
                if l.id not in id_list:
                    id_list.append(l.id)
                    plugin_list.append(
                        (l.name, boundFunction(l.__call__,
                                               session), l.id, 200))
            addlist = config.plugins.infopanel_usermenus.value
            addlist = addlist.split(',')
            for entry in plugin_list:
                if entry[2] in addlist:
                    list.append(entry)

        self.list = list

        # Sort by Weight
        #if config.usage.sort_menus.value:
        #	list.sort()
        #else:
        if config.usage.menu_sort_mode.value == "user" and menuID == "mainmenu":
            plugin_list = []
            id_list = []
            for l in plugins.getPlugins([
                    PluginDescriptor.WHERE_PLUGINMENU,
                    PluginDescriptor.WHERE_EXTENSIONSMENU,
                    PluginDescriptor.WHERE_EVENTINFO
            ]):
                l.id = (l.name.lower()).replace(' ', '_')
                if l.id not in id_list:
                    id_list.append(l.id)
                    plugin_list.append(
                        (l.name, boundFunction(l.__call__,
                                               session), l.id, 200))

        self.list = m_list

        if menuID is not None and config.usage.menu_sort_mode.value == "user":
            self.sub_menu_sort = NoSave(ConfigDictionarySet())
            self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue(
                self.menuID, "submenu") or {}
            idx = 0
            for x in self.list:
                entry = list(self.list.pop(idx))
                m_weight = self.sub_menu_sort.getConfigValue(
                    entry[2], "sort") or entry[3]
                entry.append(m_weight)
                self.list.insert(idx, tuple(entry))
                self.sub_menu_sort.changeConfigValue(entry[2], "sort",
                                                     m_weight)
                idx += 1
            self.full_list = list(m_list)

        if config.usage.menu_sort_mode.value == "a_z":
            # Sort by Name
            m_list.sort(key=self.sortByName)
        elif config.usage.menu_sort_mode.value == "user":
            self["blue"].setText(_("Edit mode on"))
            self.hide_show_entries()
            m_list = self.list
        else:
            # Sort by Weight
            m_list.sort(key=lambda x: int(x[3]))

        self["menu"] = List(m_list)
        self["menu"].enableWrapAround = True
        if config.usage.menu_sort_mode.value == "user":
            self["menu"].onSelectionChanged.append(self.selectionChanged)

        self["actions"] = NumberActionMap(
            ["OkCancelActions", "MenuActions", "NumberActions"], {
                "ok": self.okbuttonClick,
                "cancel": self.closeNonRecursive,
                "menu": self.closeRecursive,
                "0": self.resetSortOrder,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal
            })
        if config.usage.menu_sort_mode.value == "user":
            self["MoveActions"] = ActionMap(
                ["WizardActions"], {
                    "left": self.keyLeft,
                    "right": self.keyRight,
                    "up": self.keyUp,
                    "down": self.keyDown,
                }, -1)

            self["EditActions"] = ActionMap(
                ["ColorActions"], {
                    "green": self.keyGreen,
                    "yellow": self.keyYellow,
                    "blue": self.keyBlue,
                })

        a = six.ensure_str(parent.get("title", "")) or None
        a = a and _(a)
        if a is None:
            a = _(six.ensure_str(parent.get("text", "")))
        else:
            t_history.reset()
        self["title"] = StaticText(a)
        Screen.setTitle(self, a)
        self.menu_title = a
        self["thistory"] = StaticText(t_history.thistory)
        history_len = len(t_history.thistory)
        self["title0"] = StaticText('')
        self["title1"] = StaticText('')
        self["title2"] = StaticText('')
        if history_len < 13:
            self["title0"] = StaticText(a)
        elif history_len < 21:
            self["title0"] = StaticText('')
            self["title1"] = StaticText(a)
        else:
            self["title0"] = StaticText('')
            self["title1"] = StaticText('')
            self["title2"] = StaticText(a)

        if (t_history.thistory == ''):
            t_history.thistory = str(a) + ' > '
        else:
            t_history.thistory = t_history.thistory + str(a) + ' > '
Exemplo n.º 31
0
    def __init__(self,
                 session,
                 menumode,
                 mselection,
                 mlist,
                 service,
                 selections,
                 currentPath,
                 playlist=False):
        Screen.__init__(self, session)
        self.mode = menumode
        self.mselection = mselection
        self.mlist = mlist
        self.service = service
        self.selections = selections
        self.currentPath = currentPath
        self.plist = playlist
        self.reloadafterclose = False

        self.menu = []
        if menumode == "normal":
            self["title"] = StaticText(_("Choose operation"))

            if os.path.realpath(self.currentPath) != os.path.realpath(
                    config.EMC.movie_homepath.value):
                self.menu.append(
                    (_("Movie home"), boundFunction(self.close, "Movie home")))

            if currentPath == config.EMC.movie_pathlimit.value:
                self.menu.append(
                    (_("Directory up"), boundFunction(self.close, "dirup")))

            self.menu.append((_("Reload current directory"),
                              boundFunction(self.close, "reloadwithoutcache")))

            self.menu.append(
                (_("Playlist Options"), boundFunction(self.close,
                                                      "emcPlaylist")))
            if service is not None:
                ext = os.path.splitext(service.getPath())[1].lower()
                if ext in extMedia:
                    self.menu.append((_("Add to current Playlist"),
                                      boundFunction(self.close,
                                                    "addPlaylist")))

            self.menu.append(
                (_("Play last"), boundFunction(self.close, "Play last")))

            self.menu.append(
                (_("Play All"), boundFunction(self.close, "playall")))
            self.menu.append(
                (_("Shuffle All"), boundFunction(self.close, "shuffleall")))

            self.menu.append(
                (_("Cover search"), boundFunction(self.close, "imdb")))
            if service is not None:
                path = service.getPath()
                if os.path.isdir(
                        path
                ) and not path == config.EMC.movie_trashcan_path.value and not path.endswith(
                        os.sep + '..'):
                    self.menu.append((_("Directory-Cover search"),
                                      boundFunction(self.close,
                                                    "imdbdirectory")))
            if self.selections:
                self.menu.append((_("Delete"),
                                  boundFunction(self.close, "del",
                                                self.selections)))
            else:
                self.menu.append(
                    (_("Delete"), boundFunction(self.close, "del")))

            if config.EMC.movie_trashcan_enable.value and os.path.exists(
                    config.EMC.movie_trashcan_path.value):
                if service is not None:
                    if self.selections:
                        self.menu.append(
                            (_("Delete permanently"),
                             boundFunction(self.close, "delete",
                                           self.selections)))
                    else:
                        self.menu.append((_("Delete permanently"),
                                          boundFunction(self.close, "delete")))
                self.menu.append(
                    (_("Empty trashcan"), boundFunction(self.emptyTrash)))
                self.menu.append(
                    (_("Go to trashcan"), boundFunction(self.close, "trash")))

            self.menu.append(
                (_("Mark all movies"), boundFunction(self.close, "markall")))
            self.menu.append(
                (_("Remove rogue files"), boundFunction(self.remRogueFiles)))

            self.menu.append(
                (_("Delete cut file(s)"), boundFunction(self.deleteCutFileQ)))

            self.menu.append(
                (_("Create link"), boundFunction(self.createLink,
                                                 currentPath)))
            self.menu.append((_("Create directory"),
                              boundFunction(self.createDir, currentPath)))

            self.menu.append((_("(Un-)Lock Directory"),
                              boundFunction(self.lockDir, currentPath)))

            if service is not None:
                if os.path.isfile(service.getPath()):
                    # can we use it for both ?
                    # selections comes also with one file !!! so we can it use.
                    if self.selections:
                        self.menu.append(
                            (_("Copy Files"),
                             boundFunction(self.close, "Copy Movie",
                                           self.selections)))
                        self.menu.append(
                            (_("Move Files"),
                             boundFunction(self.close, "Move Movie",
                                           self.selections)))
                    else:
                        self.menu.append(
                            (_("Copy File"),
                             boundFunction(self.close, "Copy Movie")))
                        self.menu.append(
                            (_("Move File"),
                             boundFunction(self.close, "Move Movie")))
                    #self.menu.append((_("Download Movie Information"), boundFunction(self.close, "Movie Information")))
                if service.getPath() != config.EMC.movie_trashcan_path.value:
                    if not service.getPath().endswith(
                            "/..") and not service.getPath().endswith(
                                "/Latest Recordings"):
                        self.menu.append(
                            (_("Download Movie Information"),
                             boundFunction(self.close, "Movie Information")))
                        #self.menu.append((_("Download Movie Cover"), boundFunction(self.close, "dlcover")))

            if self.service is not None or self.selections:
                self.menu.append((_("Rename selected movie(s)"),
                                  boundFunction(self.renameMovies)))
                self.menu.append((_("Remove cut list marker"),
                                  boundFunction(self.remCutListMarker)))
                self.menu.append((_("Reset marker from selected movie(s)"),
                                  boundFunction(self.resMarker)))
                show_plugins = True
                if self.selections:
                    for service in self.selections:
                        ext = os.path.splitext(service.getPath())[1].lower()
                        if ext not in extTS:
                            show_plugins = False
                            break
                else:
                    ext = os.path.splitext(self.service.getPath())[1].lower()
                    if ext not in extTS:
                        show_plugins = False
                if show_plugins:
                    # Only valid for ts files: CutListEditor, DVDBurn, ...
                    self.menu.extend([(p.description,
                                       boundFunction(self.execPlugin, p))
                                      for p in plugins.getPlugins(
                                          PluginDescriptor.WHERE_MOVIELIST)])

            self.menu.append((_("Open E2 Bookmark path"),
                              boundFunction(self.close, "openE2Bookmarks")))
            if not self.isE2Bookmark(currentPath):
                self.menu.append((_("Add directory to E2 Bookmarks"),
                                  boundFunction(self.addDirToE2Bookmarks,
                                                currentPath)))
            else:
                self.menu.append((_("Remove directory from E2 Bookmarks"),
                                  boundFunction(self.removeDirFromE2Bookmarks,
                                                currentPath)))
            if service is not None:
                if self.isE2Bookmark(service.getPath()):
                    self.menu.append(
                        (_("Remove selected E2 Bookmark"),
                         boundFunction(self.close, "removeE2Bookmark",
                                       service)))

            self.menu.append((_("Open EMC Bookmark path"),
                              boundFunction(self.close, "openEMCBookmarks")))
            if not self.isEMCBookmark(currentPath):
                self.menu.append((_("Add directory to EMC Bookmarks"),
                                  boundFunction(self.addDirToEMCBookmarks,
                                                currentPath)))
            else:
                self.menu.append((_("Remove directory from EMC Bookmarks"),
                                  boundFunction(self.removeDirFromEMCBookmarks,
                                                currentPath)))
            if service is not None:
                if self.isEMCBookmark(service.getPath()):
                    self.menu.append(
                        (_("Remove selected EMC Bookmark"),
                         boundFunction(self.close, "removeEMCBookmark",
                                       service)))

            self.menu.append((_("Set permanent sort"),
                              boundFunction(self.setPermanentSort, currentPath,
                                            mlist.actualSort)))
            if mlist.hasFolderPermanentSort(currentPath):
                self.menu.append((_("Remove permanent sort"),
                                  boundFunction(self.removePermanentSort,
                                                currentPath)))
            else:
                path = mlist.hasParentPermanentSort(currentPath)
                if path:
                    self.menu.append((_("Remove permanent sort from parent"),
                                      boundFunction(self.removePermanentSort,
                                                    path)))

            #self.menu.append((_("Open shell script menu"), boundFunction(self.close, "oscripts")))
            self.menu.append(
                (_("EMC Setup"), boundFunction(self.execPlugin, emcsetup)))

        elif menumode == "plugins":
            self["title"] = StaticText(_("Choose plugin"))
            if self.service is not None:
                for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST):
                    self.menu.append(
                        (p.description, boundFunction(self.execPlugin, p)))

        elif menumode == "emcBookmarks":
            self["title"] = StaticText(_("Choose bookmark"))
            bm = self.getEMCBookmarks()
            if bm:
                for line in bm:
                    self.menu.append((line, boundFunction(self.close, line)))

        elif menumode == "emcPlaylist":
            self["title"] = StaticText(_("Playlist Options"))
            self.menu.append((_("Show current Playlist"),
                              boundFunction(self.close, "showPlaylist")))
            if service is not None:
                ext = os.path.splitext(service.getPath())[1].lower()
                if ext in extMedia:
                    self.menu.append((_("Add to current Playlist"),
                                      boundFunction(self.close,
                                                    "addPlaylist")))
            if self.plist:
                self.menu.append((_("Play current Playlist"),
                                  boundFunction(self.close, "playPlaylist")))
                self.menu.append((_("Play random current Playlist"),
                                  boundFunction(self.close,
                                                "playPlaylistRandom")))
                self.menu.append((_("Delete current Playlist"),
                                  boundFunction(self.close, "delPlaylist")))
            self.menu.append(
                (_("Playlist Setup"), boundFunction(self.close,
                                                    "setupPlaylist")))

        self["menu"] = List(self.menu)
        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "ok": self.okButton,
            "cancel": self.close,
            "red": self.redButton,
        })
        self.onShow.append(self.onDialogShow)
Exemplo n.º 32
0
    def __init__(self,
                 session,
                 showSteps=True,
                 showStepSlider=True,
                 showList=True,
                 showConfig=True):
        Screen.__init__(self, session)

        self.isLastWizard = False  # can be used to skip a "goodbye"-screen in a wizard

        self.stepHistory = []

        self.wizard = {}
        parser = make_parser()
        if not isinstance(self.xmlfile, list):
            self.xmlfile = [self.xmlfile]
# 		print "Reading ", self.xmlfile
        wizardHandler = self.parseWizard(self.wizard)
        parser.setContentHandler(wizardHandler)
        for xmlfile in self.xmlfile:
            if xmlfile[0] != '/':
                parser.parse(eEnv.resolve('${datadir}/enigma2/') + xmlfile)
            else:
                parser.parse(xmlfile)

        self.showSteps = showSteps
        self.showStepSlider = showStepSlider
        self.showList = showList
        self.showConfig = showConfig
        self.doingVKeyCallback = False

        self.numSteps = len(self.wizard)
        self.currStep = self.getStepWithID("start") + 1

        self.timeoutTimer = eTimer()
        self.timeoutTimer.callback.append(self.timeoutCounterFired)

        self["text"] = Label()

        if showConfig:
            self["config"] = ConfigList([], session=session)

        if self.showSteps:
            self["step"] = Label()

        if self.showStepSlider:
            self["stepslider"] = Slider(1, self.numSteps)

        if self.showList:
            self.list = []
            self["list"] = List(self.list, enableWrapAround=True)
            self["list"].onSelectionChanged.append(self.selChanged)
            #self["list"] = MenuList(self.list, enableWrapAround = True)

        self.onShown.append(self.updateValues)

        self.configInstance = None
        self.currentConfigIndex = None

        Wizard.instance = self

        self.lcdCallbacks = []

        self.disableKeys = False

        self["actions"] = NumberActionMap(
            [
                "WizardActions", "DirectionActions", "NumberActions",
                "ColorActions", "SetupActions", "InputAsciiActions",
                "KeyboardInputActions"
            ], {
                "gotAsciiCode": self.keyGotAscii,
                "ok": self.ok,
                "back": self.back,
                "left": self.left,
                "right": self.right,
                "up": self.up,
                "down": self.down,
                "red": self.red,
                "green": self.green,
                "yellow": self.yellow,
                "blue": self.blue,
                "deleteBackward": self.deleteBackward,
                "deleteForward": self.deleteForward,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
                "0": self.keyNumberGlobal
            }, -1)

        self["VirtualKB"] = NumberActionMap(
            ["VirtualKeyboardActions"], {
                "showVirtualKeyboard": self.KeyText,
            }, -2)

        self["VirtualKB"].setEnabled(False)
Exemplo n.º 33
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        list = []
        menuID = None
        for x in parent:
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get('level', 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                self.addMenu(list, x)
                count += 1
            elif x.tag == 'id':
                menuID = x.get('val')
                count = 0
            if menuID is not None:
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ', ')), x[4]))
                            count += 1

        self.menuID = menuID
        if config.ParentalControl.configured.value:
            ProtectedScreen.__init__(self)
        if menuID is not None:
            for l in plugins.getPluginsForMenu(menuID):
                plugin_menuid = l[2]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break

                if len(l) > 4 and l[4]:
                    list.append(
                        (l[0], boundFunction(l[1], self.session,
                                             self.close), l[2], l[3] or 50))
                else:
                    list.append((l[0], boundFunction(l[1],
                                                     self.session), l[2], l[3]
                                 or 50))

        self.skinName = []
        if menuID is not None:
            self.skinName.append('menu_' + menuID)
        self.skinName.append('Menu')
        self.menuID = menuID
        ProtectedScreen.__init__(self)
        if config.usage.sort_menus.value:
            list.sort()
        else:
            list.sort(key=lambda x: int(x[3]))
        self['menu'] = List(list)
        self['actions'] = NumberActionMap(
            ['OkCancelActions', 'MenuActions', 'NumberActions'], {
                'ok': self.okbuttonClick,
                'cancel': self.closeNonRecursive,
                'menu': self.closeRecursive,
                '1': self.keyNumberGlobal,
                '2': self.keyNumberGlobal,
                '3': self.keyNumberGlobal,
                '4': self.keyNumberGlobal,
                '5': self.keyNumberGlobal,
                '6': self.keyNumberGlobal,
                '7': self.keyNumberGlobal,
                '8': self.keyNumberGlobal,
                '9': self.keyNumberGlobal
            })
        a = parent.get('title', '').encode('UTF-8') or None
        a = a and _(a)
        if a is None:
            a = _(parent.get('text', '').encode('UTF-8'))
        self['title'] = StaticText(a)
        Screen.setTitle(self, a)
        self.menu_title = a
        return
Exemplo n.º 34
0
Arquivo: Menu.py Projeto: vuteam/bbh
    def __init__(self, session, parent):
        Screen.__init__(self, session)

        list = []

        menuID = None
        for x in parent:  #walk through the actual nodelist
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(list, x)
                    count += 1
            elif x.tag == 'menu':
                self.addMenu(list, x)
                count += 1
            elif x.tag == "id":
                menuID = x.get("val")
                count = 0

            if menuID is not None:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(menuID):
                    for x in menuupdater.getUpdatedMenu(menuID):
                        if x[1] == count:
                            list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1

        if menuID is not None:
            # plugins
            bhorder = []
            if fileExists(resolveFilename(SCOPE_SKIN, 'menuorder.bh')):
                file = open(resolveFilename(SCOPE_SKIN, 'menuorder.bh'), 'r')
                for line in file.readlines():
                    parts = line.strip().split()
                    res = (parts[0], parts[1])
                    bhorder.append(res)
                    file.close()

            for l in plugins.getPluginsForMenu(menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                weight = l[3]
                for x in list:
                    if x[2] == plugin_menuid:
                        list.remove(x)
                        break
                    for y in bhorder:
                        if y[0] == plugin_menuid:
                            weight = int(y[1])

                list.append((l[0], boundFunction(l[1],
                                                 self.session), l[2], weight
                             or 50))

        # for the skin: first try a menu_<menuID>, then Menu
        self.skinName = []
        if menuID is not None:
            self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")

        # Sort by Weight
        list.sort(key=lambda x: int(x[3]))

        self["menu"] = List(list)

        self["actions"] = NumberActionMap(
            ["OkCancelActions", "MenuActions", "NumberActions"], {
                "ok": self.okbuttonClick,
                "cancel": self.closeNonRecursive,
                "menu": self.closeRecursive,
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal
            })

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a)
        if a is None:
            a = _(parent.get("text", "").encode("UTF-8"))
        self["title"] = StaticText(a)
        self.menu_title = a
Exemplo n.º 35
0
		def __init__(self, session):
			self.entriesWidth = DESKTOP_WIDTH * scaleH(75, 85) / 100
			self.height = DESKTOP_HEIGHT * 0.75
			numberFieldWidth = scaleH(220, 160)
			fieldWidth = self.entriesWidth - 5 - numberFieldWidth - 10
			fontSize = scaleV(22, 18)
			fontHeight = scaleV(24, 20)
			buttonGap = (self.entriesWidth - 4 * 140) / 5
			debug("[NcidDisplayPhonebook] width: " + str(self.entriesWidth))
			self.skin = """
				<screen name="NcidDisplayPhonebook" position="center,center" size="%d,%d" title="Phonebook" >
					<eLabel position="0,0" size="%d,2" backgroundColor="#aaaaaa" />
					<widget source="entries" render="Listbox" position="%d,%d" size="%d,%d" scrollbarMode="showOnDemand" transparent="1">
						<convert type="TemplatedMultiContent">
							{"template": [
									MultiContentEntryText(pos = (%d,%d), size = (%d,%d), font=0, flags = RT_HALIGN_LEFT, text = 1), # index 0 is the name, index 1 is shortname
									MultiContentEntryText(pos = (%d,%d), size = (%d,%d), font=0, flags = RT_HALIGN_LEFT, text = 2), # index 2 is number
								],
							"fonts": [gFont("Regular", %d)],
							"itemHeight": %d
							}
						</convert>
					</widget>
					<eLabel position="0,%d" size="%d,2" backgroundColor="#aaaaaa" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<ePixmap position="%d,%d" zPosition="4" size="140,40" pixmap="%s" transparent="1" alphatest="on" />
					<widget name="key_red" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_green" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_yellow" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
					<widget name="key_blue" position="%d,%d" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;%d" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
				</screen>""" % (
						# scaleH(90, 75), scaleV(100, 73), # position
						self.entriesWidth, self.height, # size
						self.entriesWidth, # eLabel width
						scaleH(40, 5), scaleV(20, 5), # entries position
						self.entriesWidth - scaleH(40, 5), self.height - scaleV(20, 5) - 5 - 5 - 40, # entries size
						0, 0, fieldWidth, scaleH(24, 20), # name pos/size
						fieldWidth + 5, 0, numberFieldWidth, scaleH(24, 20), # dir pos/size
						fontSize, # fontsize
						fontHeight, # itemHeight
						self.height - 40 - 5, # eLabel position vertical
						self.entriesWidth, # eLabel width
						buttonGap, self.height - 40, "buttons/red.png", # ePixmap red
						2 * buttonGap + 140, self.height - 40, "buttons/green.png", # ePixmap green
						3 * buttonGap + 2 * 140, self.height - 40, "buttons/yellow.png", # ePixmap yellow
						4 * buttonGap + 3 * 140, self.height - 40, "buttons/blue.png", # ePixmap blue
						buttonGap, self.height - 40, scaleV(22, 21), # widget red
						2 * buttonGap + 140, self.height - 40, scaleV(22, 21), # widget green
						3 * buttonGap + 2 * 140, self.height - 40, scaleV(22, 21), # widget yellow
						4 * buttonGap + 3 * 140, self.height - 40, scaleV(22, 21), # widget blue
						)

			# debug("[NcidDisplayCalls] skin: " + self.skin)
			Screen.__init__(self, session)
			NumericalTextInput.__init__(self)
			HelpableScreen.__init__(self)

			# TRANSLATORS: keep it short, this is a button
			self["key_red"] = Button(_("Delete"))
			# TRANSLATORS: keep it short, this is a button
			self["key_green"] = Button(_("New"))
			# TRANSLATORS: keep it short, this is a button
			self["key_yellow"] = Button(_("Edit"))
			# TRANSLATORS: keep it short, this is a button
			self["key_blue"] = Button(_("Search"))

			self["setupActions"] = ActionMap(["OkCancelActions", "ColorActions"],
			{
				"red": self.delete,
				"green": self.add,
				"yellow": self.edit,
				"blue": self.search,
				"cancel": self.exit,
				"ok": self.showEntry, }, -2)

			self["entries"] = List([])
			debug("[NcidClientPhonebook] displayPhonebook init")
			self.help_window = None
			self.sortlist = []
			self.onLayoutFinish.append(self.setWindowTitle)
			self.display()
    def __init__(self, session):
        self.session = session
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        self.setTitle(_("Quad PiP Channel Selection"))

        dw = self.session.desktop.size().width()
        dh = self.session.desktop.size().height()
        pw, ph = {
            1080: ("center", "center"),
            720: ("center", "center"),
            576: ("center", "20%")
        }.get(dh, ("center", "center"))
        (sw, sh) = {
            1080: (dw / 3, dh / 2),
            720: (int(dw / 2), int(dh / 1.5)),
            576: (int(dw / 1.3), int(dh / 1.5))
        }.get(dh, (28, 24))
        button_margin = 5
        button_h = 40
        list_y = 40 + button_margin * 3
        self.fontSize = {
            1080: (28, 24),
            720: (24, 20),
            576: (20, 18)
        }.get(dh, (28, 24))
        self.skin = QuadPiPChannelSelection.skin % (pw, ph, \
                    sw, sh+list_y, \
                    sw/8-70, button_margin, \
                    sw/8-70+sw/4, button_margin, \
                    sw/8-70+sw/4*2, button_margin, \
                    sw/8-70+sw/4*3, button_margin, \
                    sw/8-70, button_margin, \
                    sw/8-70+sw/4, button_margin, \
                    sw/8-70+sw/4*2, button_margin, \
                    sw/8-70+sw/4*3, button_margin, \
                    0, list_y, sw, sh, \
                    sw/16, 1, sw-sw/16*2, sh/13, \
                    sw/11, 1+sh/13,    sw-sw/16*2-sw/8, sh/18, \
                    sw/11, 1+sh/13+sh/18,  sw-sw/16*2-sw/8, sh/18, \
                    sw/11, 1+sh/13+sh/18*2,  sw-sw/16*2-sw/8, sh/18, \
                    sw/11, 1+sh/13+sh/18*3,  sw-sw/16*2-sw/8, sh/18, \
                    self.fontSize[0], self.fontSize[1], \
                    sh/3)
        self["key_red"] = Label(_("Select"))
        self["key_green"] = Label(_("Add"))
        self["key_yellow"] = Label(_("Remove"))
        self["key_blue"] = Label(_("Edit"))

        self.PipChannelListApply = []
        self["ChannelList"] = List(self.PipChannelListApply)

        self["qpipActions"] = HelpableActionMap(
            self, "QuadPipSetupActions", {
                "red": (self.keyRed, _("Select Quad Channels")),
                "green": (self.keyGreen, _("Add New Quad Channel Entry")),
                "yellow": (self.keyYellow, _("Remove Quad Channel Entry")),
                "blue": (self.keyBlue, _("Edit Quad Channel Entry")),
            }, -2)

        self["OkCancelActions"] = HelpableActionMap(
            self, "OkCancelActions", {
                "ok": (self.keyOk, _("Select Quad Channels")),
                "cancel": (self.keyCancel, _("Exit Quad Channel Selection")),
            }, -2)

        self.oldPosition = None

        global quad_pip_channel_list_instance
        self.qpipChannelList = quad_pip_channel_list_instance

        self.oldPosition = self.qpipChannelList.getIdx() - 1

        self.onLayoutFinish.append(self.layoutFinishedCB)
Exemplo n.º 37
0
	def __init__(self, list, enableWrapAround=False):
		List.__init__(self, list, enableWrapAround, item_height = 50 )