Exemplo n.º 1
0
 def addMenu(self, destList, node):
     requires = node.get('requires')
     if requires:
         if requires[0] == '!':
             if SystemInfo.get(requires[1:], False):
                 return
         elif not SystemInfo.get(requires, False):
             return
     MenuTitle = _(node.get('text', '??').encode('UTF-8'))
     entryID = node.get('entryID', 'undefined')
     weight = node.get('weight', 50)
     description = node.get('description', '').encode('UTF-8') or None
     description = description and _(description)
     menupng = MenuEntryPixmap(entryID, self.png_cache, lastMenuID)
     x = node.get('flushConfigOnClose')
     if x:
         a = boundFunction(self.session.openWithCallback, self.menuClosedWithConfigFlush, Menu, node)
     else:
         a = boundFunction(self.session.openWithCallback, self.menuClosed, Menu, node)
     destList.append((MenuTitle,
      a,
      entryID,
      weight,
      description,
      menupng))
Exemplo n.º 2
0
	def layoutFinishedCB(self):
		if not os.access(ENABLE_QPIP_PROCPATH, os.F_OK):
			self.notSupportTimer.start(100, True)
			return

		self.onClose.append(self.__onClose)

		if self.session.pipshown: # try to disable pip
			self.session.pipshown = False
			del self.session.pip

		self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
		self.session.nav.stopService()

		if SystemInfo.get("FastChannelChange", False):
			self.disableFCC()

		if SystemInfo.get("MiniTV", False):
			self.disableMiniTV()

		ret = setDecoderMode("mosaic")
		if ret is not True:
			self.forceToExitTimer.start(0, True)
			return

		self.moveLabel()

		if self.qpipChannelList.length() == 0:
			self.noChannelTimer.start(10, True)
		else:
			self.playLastChannel()
Exemplo n.º 3
0
	def addItems(self, parentNode):
		for x in parentNode:
			if not x.tag:
				continue
			if x.tag == 'item':
				item_level = int(x.get("level", 0))

				if item_level > config.usage.setup_level.index:
					continue

				requires = x.get("requires")
				if requires:
					if requires[0] == '!':
						if SystemInfo.get(requires[1:], False):
							continue
					elif not SystemInfo.get(requires, False):
						continue
				configCondition = x.get("configcondition")
				if configCondition and not eval(configCondition + ".value"):
					continue

				item_text = _(x.get("text", "??").encode("UTF-8"))
				item_description = _(x.get("description", " ").encode("UTF-8"))
				b = eval(x.text or "");
				if b == "":
					continue
				#add to configlist
				item = b
				# the first b is the item itself, ignored by the configList.
				# the second one is converted to string.
				if not isinstance(item, ConfigNothing):
					self.list.append((item_text, item, item_description))
Exemplo n.º 4
0
    def searchMenu(self, parent, name):
        menuID = None
        ret = None
        for x in parent:
            if x.tag == "item":
                requires = x.get("requires")
                if requires:
                    if requires[0] == "!":
                        if SystemInfo.get(requires[1:], False):
                            continue
                    elif not SystemInfo.get(requires, False):
                        continue

                item_text = x.get("text", "").encode("UTF-8")
                entryID = x.get("entryID", "")

                if entryID == name:
                    for z in x:
                        if z.tag == "screen":
                            module = z.get("module")
                            screen = z.get("screen")

                            if screen is None:
                                screen = module

                            print module, screen
                            if module[:7] == "SIFTeam":
                                pass  # we don't need any change to module
                            elif module:
                                module = "Screens." + module
                            else:
                                module = ""

                                # check for arguments. they will be appended to the
                                # openDialog call
                            args = z.text or ""
                            screen += ", " + args

                            ret = boundFunction(self.runScreen, (module, screen))
                        elif z.tag == "code":
                            ret = boundFunction(self.execText, z.text)
                        elif z.tag == "setup":
                            id = z.get("id")
                            ret = boundFunction(self.openSetup, id)

            elif x.tag == "menu":
                if ret is None:
                    ret = self.searchMenu(x, name)

            elif x.tag == "id":
                menuID = x.get("val")

        if menuID is not None:
            for l in plugins.getPluginsForMenu(menuID):
                if l[2] == name:
                    ret = boundFunction(l[1], self.session)

        return ret
Exemplo n.º 5
0
	def __onClose(self):
		self.disableQuadPip()
		setDecoderMode("normal")

		if SystemInfo.get("FastChannelChange", False):
			self.enableFCC()

		if SystemInfo.get("MiniTV", False):
			self.enableMiniTV()

		self.qpipChannelList.saveAll()
		self.session.nav.playService(self.oldService)
Exemplo n.º 6
0
    def addItem(self, destList, node):
        requires = node.get('requires')
        if requires:
            if requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return
        configCondition = node.get('configcondition')
        if configCondition and not eval(configCondition + '.value'):
            return
        item_text = node.get('text', '').encode('UTF-8')
        entryID = node.get('entryID', 'undefined')
        weight = node.get('weight', 50)
        for x in node:
            if x.tag == 'screen':
                module = x.get('module')
                screen = x.get('screen')
                if screen is None:
                    screen = module
                if module:
                    module = 'Screens.' + module
                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                destList.append((_(item_text or '??'),
                 boundFunction(self.runScreen, (module, screen)),
                 entryID,
                 weight))
                return
            if x.tag == 'code':
                destList.append((_(item_text or '??'),
                 boundFunction(self.execText, x.text),
                 entryID,
                 weight))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    item_text = _(getSetupTitle(id))
                else:
                    item_text = _(item_text)
                destList.append((item_text,
                 boundFunction(self.openSetup, id),
                 entryID,
                 weight))
                return

        destList.append((item_text,
         self.nothing,
         entryID,
         weight))
Exemplo n.º 7
0
	def createSetupList(self):
		currentItem = self["config"].getCurrent()
		self.list = []
		for x in self.setup:
			if not x.tag:
				continue
			if x.tag == 'item':
				item_level = int(x.get("level", 0))

				if item_level > config.usage.setup_level.index:
					continue

				requires = x.get("requires")
				if requires and not requires.startswith('config.'):
					if requires.startswith('!'):
						if SystemInfo.get(requires[1:], False):
							continue
					elif not SystemInfo.get(requires, False):
						continue
				conditional = x.get("conditional")
				if conditional and not eval(conditional):
					continue

				# this block is just for backwards compatibility
				if requires and requires.startswith('config.'):
					item = eval(requires)
					if not (item.value and not item.value == "0"):
						continue

				if self.PluginLanguageDomain:
					item_text = dgettext(self.PluginLanguageDomain, x.get("text", "??").encode("UTF-8"))
					item_description = dgettext(self.PluginLanguageDomain, x.get("description", " ").encode("UTF-8"))
				else:
					item_text = _(x.get("text", "??").encode("UTF-8"))
					item_description = _(x.get("description", " ").encode("UTF-8"))

				item_text = item_text.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
				item_description = item_description.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
				b = eval(x.text or "")
				if b == "":
					continue
				#add to configlist
				item = b
				# the first b is the item itself, ignored by the configList.
				# the second one is converted to string.
				if not isinstance(item, ConfigNothing):
					self.list.append((item_text, item, item_description))
		self["config"].setList(self.list)
		if config.usage.sort_settings.value:
			self["config"].list.sort()
		self.moveToItem(currentItem)
Exemplo n.º 8
0
	def addItem(self, destList, node):
		requires = node.get("requires")
		if requires:
			if requires[0] == '!':
				if SystemInfo.get(requires[1:], False):
					return
			elif not SystemInfo.get(requires, False):
				return
		conditional = node.get("conditional")
		if conditional and not eval(conditional):
			return
		item_text = node.get("text", "").encode("UTF-8")
		entryID = node.get("entryID", "undefined")
		weight = node.get("weight", 50)
		for x in node:
			if x.tag == 'screen':
				module = x.get("module")
				screen = x.get("screen")

				if screen is None:
					screen = module

				# print module, screen
				if module:
					module = "Screens." + module
				else:
					module = ""

				# check for arguments. they will be appended to the
				# openDialog call
				args = x.text or ""
				screen += ", " + args

				destList.append((_(item_text or "??"), boundFunction(self.runScreen, (module, screen)), entryID, weight))
				return
			elif x.tag == 'code':
				destList.append((_(item_text or "??"), boundFunction(self.execText, x.text), entryID, weight))
				return
			elif x.tag == 'setup':
				id = x.get("id")
				if item_text == "":
					if getSetupTitleLevel(id) > config.usage.setup_level.index:
						return
					item_text = _(getSetupTitle(id))
				else:
					item_text = _(item_text)
				destList.append((item_text, boundFunction(self.openSetup, id), entryID, weight))
				return
		destList.append((item_text, self.nothing, entryID, weight))
Exemplo n.º 9
0
    def addItem(self, destList, node):
        requires = node.get('requires')
        if requires:
            if requires.startswith('config.'):
                if configfile.getResolvedKey(requires) == 'False':
                    return
            elif requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return
        item_text = node.get('text', '').encode('UTF-8')
        entryID = node.get('entryID', 'undefined')
        weight = node.get('weight', 50)
        end_text = node.get('endtext', '>').encode('UTF-8')
        for x in node:
            if x.tag == 'screen':
                module = x.get('module')
                screen = x.get('screen')
                if screen is None:
                    screen = module
                print module, screen
                if module:
                    if module.find('.') == -1:
                        module = 'Screens.' + module
                    else:
                        try:
                            exec 'from ' + module + ' import *'
                        except:
                            module = None

                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                if module is not None:
                    destList.append((_(item_text or '??'), boundFunction(self.runScreen, (module, screen)), entryID, weight, end_text))
                return
            if x.tag == 'code':
                destList.append((_(item_text or '??'), boundFunction(self.execText, x.text), entryID, weight, end_text))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    item_text = getSetupTitle(id)
                destList.append((_(item_text), boundFunction(self.openSetup, id), entryID, weight, end_text))
                return

        destList.append((_(item_text), self.nothing, entryID, weight, end_text))
Exemplo n.º 10
0
 def addItems(self, list, parentNode):
     for x in parentNode:
         if not x.tag:
             continue
         if x.tag == 'item':
             item_level = int(x.get('level', 0))
             if self.levelChanged not in config.usage.setup_level.notifiers:
                 config.usage.setup_level.notifiers.append(self.levelChanged)
                 self.onClose.append(self.removeNotifier)
             if item_level > config.usage.setup_level.index:
                 continue
             requires = x.get('requires')
             if requires and requires.startswith('config.'):
                 item = eval(requires or '')
                 if item.value and not item.value == '0':
                     SystemInfo[requires] = True
                 else:
                     SystemInfo[requires] = False
             if requires and not SystemInfo.get(requires, False):
                 continue
             item_text = _(x.get('text', '??').encode('UTF-8'))
             item_description = _(x.get('description', ' ').encode('UTF-8'))
             b = eval(x.text or '')
             if b == '':
                 continue
             item = b
             if not isinstance(item, ConfigNothing):
                 list.append((item_text, item, item_description))
Exemplo n.º 11
0
def getConfigs(key):
	configs = []
	title = ""
	
	setupfile = file(eEnv.resolve('${datadir}/enigma2/setup.xml'), 'r')
	setupdom = xml.etree.cElementTree.parse(setupfile)
	setupfile.close()
	xmldata = setupdom.getroot()
	for section in xmldata.findall("setup"):
		if section.get("key") != key:
			continue
			
		for entry in section:
			if entry.tag == "item":
				requires = entry.get("requires")
				if requires and not SystemInfo.get(requires, False):
					continue;
				
				if int(entry.get("level", 0)) > config.usage.setup_level.index:
					continue
				
				try:
					configs.append({
						"description": entry.get("text", ""),
						"path": entry.text or "",
						"data": getJsonFromConfig(eval(entry.text or ""))
					})		
				except Exception, e:
					pass
				
		title = section.get("title", "")
		break
Exemplo n.º 12
0
	def __init__(self):
		Renderer.__init__(self)
		global fbtool
		fbtool=KravenFBHelper()
		self.Position=self.Size=None
		self.decoder=0
		if SystemInfo.get("NumVideoDecoders",1)>1:
			self.decoder=1
		self.fb_w=getDesktop(0).size().width()
		self.fb_h=getDesktop(0).size().height()
		self.fb_size=None
		self._del_pip=False
		self._can_extended_PiG=False
		self.first_PiG=False
		self.is_channelselection=False

		self.x2=103
		self.y2=523
		self.w2=544
		self.h2=306
		self.x2=format(int(float(self.x2)/self.fb_w*720.0),'x').zfill(8)
		self.y2=format(int(float(self.y2)/self.fb_h*576.0),'x').zfill(8)
		self.w2=format(int(float(self.w2)/self.fb_w*720.0),'x').zfill(8)
		self.h2=format(int(float(self.h2)/self.fb_h*576.0),'x').zfill(8)
		self.fb_size2=[self.w2,self.h2,self.x2,self.y2]
Exemplo n.º 13
0
	def addItems(self, list, parentNode):
		for x in parentNode:
			if x.tag == 'item':
				item_level = int(x.get("level", 0))

				if not self.levelChanged in config.usage.setup_level.notifiers:
					config.usage.setup_level.addNotifier(self.levelChanged, initial_call = False)
					self.onClose.append(self.removeNotifier)

				if item_level > config.usage.setup_level.index:
					continue

				requires = x.get("requires")
				if requires and not SystemInfo.get(requires, False):
					continue;

				item_text = _(x.get("text", "??").encode("UTF-8"))
				b = eval(x.text or "");
				if b == "":
					continue
				#add to configlist
				item = b
				# the first b is the item itself, ignored by the configList.
				# the second one is converted to string.
				if not isinstance(item, ConfigNothing):
					list.append( (item_text, item) )
Exemplo n.º 14
0
	def __init__(self):
		Renderer.__init__(self)

		global KravenFBTool
		KravenFBTool = KravenFBHelper()
		
		self.Position = self.Size = None
		
		self.timer = eTimer()
		self.timer.callback.append(self.showpip)

		self.pipCreated = False
		self.pipRemoved = False
		self.Initialized = False

		self.PigStyle = config.plugins.KravenFHD.PigStyle.value
		if SystemInfo.get("NumVideoDecoders", 1) > 1 and not self.PigStyle == "Preview":
			self.decoder = 1
		else:
			self.decoder = 0

		self.fb_w = getDesktop(0).size().width()
		self.fb_h = getDesktop(0).size().height()
		self.fb_size = None

		self.x2 = 103
		self.y2 = 530
		self.w2 = 544
		self.h2 = 306
		self.x2 = format(int(float(self.x2) / self.fb_w * 720.0), 'x').zfill(8)
		self.y2 = format(int(float(self.y2) / self.fb_h * 576.0), 'x').zfill(8)
		self.w2 = format(int(float(self.w2) / self.fb_w * 720.0), 'x').zfill(8)
		self.h2 = format(int(float(self.h2) / self.fb_h * 576.0), 'x').zfill(8)
		self.fb_size2 = [self.w2, self.h2, self.x2, self.y2]
	def _getConfig(self):
		# Name, configElement, HelpTxt, reloadConfig
		self.list = [] 
		self.list.append(getConfigListEntry(_("Refresh EPG automatically"), config.plugins.epgrefresh.enabled, _("Unless this is enabled, EPGRefresh won't automatically run but needs to be explicitly started by the yellow button in this menu."), True))
		if config.plugins.epgrefresh.enabled.value:
			self.list.append(getConfigListEntry(_("Duration to stay on service (seconds)"), config.plugins.epgrefresh.interval_seconds, _("This is the duration each service/channel will stay active during a refresh."), False))
			self.list.append(getConfigListEntry(_("EPG refresh auto-start earliest (hh:mm)"), config.plugins.epgrefresh.begin, _("An automated refresh will start after this time of day, but before the time specified in next setting."), False))
			self.list.append(getConfigListEntry(_("EPG refresh auto-start latest (hh:mm)"), config.plugins.epgrefresh.end, _("An automated refresh will start before this time of day, but after the time specified in previous setting."), False))
			self.list.append(getConfigListEntry(_("Delay if not in standby (minutes)"), config.plugins.epgrefresh.delay_standby, _("If the receiver currently isn't in standby, this is the duration which EPGRefresh will wait before retry."), False))
			if SystemInfo.get("NumVideoDecoders", 1) > 1:
				self.list.append(getConfigListEntry(_("Refresh EPG using"), config.plugins.epgrefresh.adapter, _("If you want to refresh the EPG in background, you can choose the method which best suits your needs here, e.g. hidden, fake reocrding or regular Picture in Picture."), False))
			self.list.append(getConfigListEntry(_("Show Advanced Options"), NoSave(config.plugins.epgrefresh.showadvancedoptions), _("Display more Options"), True))
			if config.plugins.epgrefresh.showadvancedoptions.value:
				if config.ParentalControl.servicepinactive.value:
					self.list.append(getConfigListEntry(_("Skip protected Services"), config.plugins.epgrefresh.skipProtectedServices, _("Should protected services be skipped if refresh was started in interactive-mode?"), False))
				self.list.append(getConfigListEntry(_("Show Setup in extension menu"), config.plugins.epgrefresh.show_in_extensionsmenu, _("Enable this to be able to access the EPGRefresh configuration from within the extension menu."), False))
				self.list.append(getConfigListEntry(_("Show 'EPGRefresh Start now' in extension menu"), config.plugins.epgrefresh.show_run_in_extensionsmenu, _("Enable this to be able to start the EPGRefresh from within the extension menu."), False))
				self.list.append(getConfigListEntry(_("Show popup when refresh starts and ends"), config.plugins.epgrefresh.enablemessage, _("This setting controls whether or not an informational message will be shown at start and completion of refresh."), False))
				self.list.append(getConfigListEntry(_("Wake up from standby for EPG refresh"), config.plugins.epgrefresh.wakeup, _("If this is enabled, the plugin will wake up the receiver from standby if possible. Otherwise it needs to be switched on already."), False))
				self.list.append(getConfigListEntry(_("Force scan even if receiver is in use"), config.plugins.epgrefresh.force, _("This setting controls whether or not the refresh will be initiated even though the receiver is active (either not in standby or currently recording)."), False))
				self.list.append(getConfigListEntry(_("Shutdown after EPG refresh"), config.plugins.epgrefresh.afterevent, _("This setting controls whether the receiver should be set to standby after refresh is completed."), False))
				try:
					# try to import autotimer module to check for its existence
					from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
		
					self.list.append(getConfigListEntry(_("Inherit Services from AutoTimer"), config.plugins.epgrefresh.inherit_autotimer, _("Extend the list of services to refresh by those your AutoTimers use?"), True))
					self.list.append(getConfigListEntry(_("Run AutoTimer after refresh"), config.plugins.epgrefresh.parse_autotimer, _("After a successful refresh the AutoTimer will automatically search for new matches if this is enabled. The options 'Ask*' has only affect on a manually refresh. If EPG-Refresh was called in background the default-Answer will be executed!"), False))
				except ImportError as ie:
					print("[EPGRefresh] AutoTimer Plugin not installed:", ie)
			
		self["config"].list = self.list
		self["config"].setList(self.list)
Exemplo n.º 16
0
Arquivo: Menu.py Projeto: popazerty/12
	def addItem(self, destList, node):
		requires = node.get("requires")
		if requires:
			if requires[0] == '!':
				if SystemInfo.get(requires[1:], False):
					return
			elif not SystemInfo.get(requires, False):
				return
		item_text = node.get("text", "").encode("UTF-8")
		entryID = node.get("entryID", "undefined")
		weight = node.get("weight", 50)
		description = node.get("description", "").encode("UTF-8") or None
		description = description and _(description)
		menupng = MenuEntryPixmap(entryID, self.png_cache, lastMenuID)
		for x in node:
			if x.tag == 'screen':
				module = x.get("module")
				screen = x.get("screen")

				if screen is None:
					screen = module

				print module, screen
				if module:
					module = "Screens." + module
				else:
					module = ""

				# check for arguments. they will be appended to the
				# openDialog call
				args = x.text or ""
				screen += ", " + args

				destList.append((_(item_text or "??"), boundFunction(self.runScreen, (module, screen)), entryID, weight, description, menupng))
				return
			elif x.tag == 'code':
				destList.append((_(item_text or "??"), boundFunction(self.execText, x.text), entryID, weight, description, menupng))
				return
			elif x.tag == 'setup':
				id = x.get("id")
				if item_text == "":
					item_text = _(getSetupTitle(id))
				else:
					item_text = _(item_text)
				destList.append((item_text, boundFunction(self.openSetup, id), entryID, weight, description, menupng))
				return
		destList.append((item_text, self.nothing, entryID, weight, description, menupng))
Exemplo n.º 17
0
	def createScreen(self):
		self.list = [ ]
		self.audio_cfg = [ ]

		for x in self.avSetupItems:
			item_level = int(x.get("level", 0))
			if item_level > config.usage.setup_level.index:
				continue

			requires = x.get("requires")
			if requires and not SystemInfo.get(requires, False):
				continue

			item_text = _(x.get("text", "??").encode("UTF-8"))

			item_str = x.get("item", None)
			if item_str is None:
				continue
			item = eval(item_str)

			idx = x.get("idx", 0)
			if idx > 0:
				if idx == 1: # Video Output
					current_port = item.value
				elif idx == 2: # Mode
					item = config.av.videomode[current_port]
					current_mode = item.value
					# some modes (720p, 1080i, 1080p) are always widescreen.
					force_wide = self.video_cfg.isWidescreenMode(current_mode)
				elif idx == 3: # Refresh Rate
					item = config.av.videorate[current_mode]
					current_rate = item.value
					if current_mode == "PC":
						item_text = _("Resolution")
				elif idx == 4: # Aspect Ratio
					current_aspect = item.value
					if force_wide:
						continue
				elif idx == 5: # Display 4:3 content as
					if current_aspect == "auto" and not force_wide:
						continue
					elif current_aspect == "4_3":
						continue
				elif idx == 6: # Display 16:9 > content as
					if current_aspect == "auto" and not force_wide:
						continue
				# Color Format, WSS on 4:3, Auto scart switching
				elif (idx == 7 or idx == 8 or idx == 9) and not current_port == "Scart":
					continue
				elif (idx == 10) and not current_port == "DVI": # HDMI Colorspace
					continue
			if idx == 0 and item_level == 1: # audio
				self.audio_cfg.append(item_text)

			# add to configlist
			if not isinstance(item, ConfigNothing):
				self.list.append(getConfigListEntry(item_text, item))

		self["config"].setList(self.list)
Exemplo n.º 18
0
def InfoBarPiP__init__(self):
    baseMethods.InfoBarPiP__init__(self)
    if SystemInfo.get("NumVideoDecoders", 1) > 1 and self.allowPiP:
        self.addExtension((self.getTogglePipzapName, self.togglePipzap, self.pipzapAvailable), "red")
        if config.plugins.pipzap.enable_hotkey.value:
            self["pipzapActions"] = HelpableActionMap(
                self, "pipzapActions", {"switchPiP": (self.togglePipzap, _("zap in pip window..."))}
            )
Exemplo n.º 19
0
	def __init__(self, session, hide=True):
		if SystemInfo.get("NumVideoDecoders", 1) < 2:
			self.pipAvail = False
			return

		self.hide = hide
		self.session = session
		self.pipAvail = True
Exemplo n.º 20
0
	def __init__(self, session):
		if SystemInfo.get("NumVideoDecoders", 1) < 2:
			self.backgroundRefreshAvailable = False
			return

		self.backgroundRefreshAvailable = True
		self.__service = None
		self.navcore = session.nav
Exemplo n.º 21
0
	def addMenu(self, destList, node):
		requires = node.get("requires")
		if requires:
			if requires[0] == '!':
				if SystemInfo.get(requires[1:], False):
					return
			elif not SystemInfo.get(requires, False):
				return
		MenuTitle = _(node.get("text", "??").encode("UTF-8"))
		entryID = node.get("entryID", "undefined")
		weight = node.get("weight", 50)
		x = node.get("flushConfigOnClose")
		if x:
			a = boundFunction(self.session.openWithCallback, self.menuClosedWithConfigFlush, Menu, node)
		else:
			a = boundFunction(self.session.openWithCallback, self.menuClosed, Menu, node)
		#TODO add check if !empty(node.childNodes)
		destList.append((MenuTitle, a, entryID, weight))
Exemplo n.º 22
0
	def addItems(self, list, parentNode):
		for x in parentNode:
			if not x.tag:
				continue
			if x.tag == 'item':
				item_level = int(x.get("level", 0))
				item_tunerlevel = int(x.get("tunerlevel", 0))
				item_rectunerlevel = int(x.get("rectunerlevel", 0))
				item_tuxtxtlevel = int(x.get("tt_level", 0))

				if not self.onNotifiers:
					self.onNotifiers.append(self.levelChanged)
					self.onClose.append(self.removeNotifier)

				if item_level > config.usage.setup_level.index:
					continue
				if (item_tuxtxtlevel == 1) and (config.usage.tuxtxt_font_and_res.value != "expert_mode"):
					continue
				if item_tunerlevel == 1 and not config.usage.frontend_priority.value in ("expert_mode", "experimental_mode"):
					continue
				if item_tunerlevel == 2 and not config.usage.frontend_priority.value == "experimental_mode":
					continue
				if item_rectunerlevel == 1 and not config.usage.recording_frontend_priority.value in ("expert_mode", "experimental_mode"):
					continue
				if item_rectunerlevel == 2 and not config.usage.recording_frontend_priority.value == "experimental_mode":
					continue

				requires = x.get("requires")
				if requires and requires.startswith('config.'):
					item = eval(requires or "")
					if item.value and not item.value == "0":
						SystemInfo[requires] = True
					else:
						SystemInfo[requires] = False

				if requires and not SystemInfo.get(requires, False):
					continue

				if self.PluginLanguageDomain:
					item_text = dgettext(self.PluginLanguageDomain, x.get("text", "??").encode("UTF-8"))
					item_description = dgettext(self.PluginLanguageDomain, x.get("description", " ").encode("UTF-8"))
				else:
					item_text = _(x.get("text", "??").encode("UTF-8"))
					item_description = _(x.get("description", " ").encode("UTF-8"))

				item_text = item_text.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
				item_description = item_description.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
				b = eval(x.text or "")
				if b == "":
					continue
				#add to configlist
				item = b
				# the first b is the item itself, ignored by the configList.
				# the second one is converted to string.
				if not isinstance(item, ConfigNothing):
					list.append((item_text, item, item_description))
Exemplo n.º 23
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self["CurrentService"] = CurrentService(session.nav)
		self["CurrentTime"] = Clock()
		self["Event_Now"] = EventInfo(session.nav, EventInfo.NOW)
		self["Event_Next"] = EventInfo(session.nav, EventInfo.NEXT)
		self["FrontendStatus"] = FrontendStatus(service_source = session.nav.getCurrentService)
		self["FrontendInfo"] = FrontendInfo(navcore = session.nav)
		self["VideoPicture"] = Source()
		self["TunerInfo"] = TunerInfo()
		self["RecordState"] = RecordState(session)
		self["Standby"] = Boolean(fixed = False)
		
		from Components.SystemInfo import SystemInfo
		
		combine = Combine(func = lambda s: {(False, False): 0, (False, True): 1, (True, False): 2, (True, True): 3}[(s[0].boolean, s[1].boolean)])
		combine.connect(self["Standby"])
		combine.connect(self["RecordState"])

		#                      |  two leds  | single led |
		# recordstate  standby   red green   
		#    false      false    off   on     off
		#    true       false    blnk  on     blnk
		#    false      true      on   off    off
		#    true       true     blnk  off    blnk
		
		PATTERN_ON     = (20, 0xffffffff, 0xffffffff)
		PATTERN_OFF    = (20, 0, 0)
		PATTERN_BLINK  = (20, 0x55555555, 0xa7fccf7a)

		have_display = SystemInfo.get("FrontpanelDisplay", False)
		have_touch_sensor = SystemInfo.get("HaveTouchSensor", False)
		nr_leds = SystemInfo.get("NumFrontpanelLEDs", 0)

		if nr_leds == 1:
			FrontpanelLed(which = 0, boolean = False, patterns = [PATTERN_OFF if have_display else PATTERN_ON, PATTERN_BLINK, PATTERN_OFF, PATTERN_BLINK]).connect(combine)
		elif nr_leds == 2:
			if have_touch_sensor:
				FrontpanelLed(which = 0, boolean = False, patterns = [PATTERN_ON, PATTERN_BLINK, PATTERN_OFF, PATTERN_BLINK]).connect(combine)
				FrontpanelLed(which = 1, boolean = False, patterns = [PATTERN_OFF, PATTERN_OFF, PATTERN_OFF, PATTERN_OFF]).connect(combine)
			else:
				FrontpanelLed(which = 0, boolean = False, patterns = [PATTERN_OFF, PATTERN_BLINK, PATTERN_ON, PATTERN_BLINK]).connect(combine)
				FrontpanelLed(which = 1, boolean = False, patterns = [PATTERN_ON, PATTERN_ON, PATTERN_OFF, PATTERN_OFF]).connect(combine)
Exemplo n.º 24
0
 def addMenu(self, destList, node):
     requires = node.get('requires')
     if requires:
         if requires[0] == '!':
             if SystemInfo.get(requires[1:], False):
                 return
         elif not SystemInfo.get(requires, False):
             return
     MenuTitle = _(node.get('text', '??').encode('UTF-8'))
     entryID = node.get('entryID', 'undefined')
     weight = node.get('weight', 50)
     x = node.get('flushConfigOnClose')
     if x:
         a = boundFunction(self.session.openWithCallback, self.menuClosedWithConfigFlush, Menu, node)
     else:
         a = boundFunction(self.session.openWithCallback, self.menuClosed, Menu, node)
     destList.append((MenuTitle,
      a,
      entryID,
      weight))
Exemplo n.º 25
0
	def __init__(self):
		Renderer.__init__(self)
		self.Position = self.Size = None
		self.pipavailable = (SystemInfo.get("NumVideoDecoders", 1) > 1)
		self.timer = eTimer()	        
		try:
			self.timer_connection = self.timer.timeout.connect(self.activatePiP)
		except AttributeError:
			self.timer.callback.append(self.activatePiP)
		self.currentPiPService = None
		self.currentPiPServicePath = None
Exemplo n.º 26
0
def newSessionGlobals__init__(self, session):
	baseSessionGlobals__init__(self, session)
	global SessionGlobals_instance
	SessionGlobals_instance = self
	from Components.Sources.CurrentService import CurrentService
	from Components.Sources.EventInfo import EventInfo
	from Components.Sources.FrontendStatus import FrontendStatus
	from Components.Sources.FrontendInfo import FrontendInfo
	from Components.Sources.Source import Source
	from Components.Sources.TunerInfo import TunerInfo
	from Components.Sources.Boolean import Boolean
	from Components.Sources.RecordState import RecordState
	from Components.Converter.Combine import Combine
	from Components.Renderer.FrontpanelLed import FrontpanelLed
	self["CurrentService"] = CurrentService(session.nav)
	self["Event_Now"] = EventInfo(session.nav, EventInfo.NOW)
	self["Event_Next"] = EventInfo(session.nav, EventInfo.NEXT)
	self["FrontendStatus"] = FrontendStatus(service_source = session.nav.getCurrentService)
	self["FrontendInfo"] = FrontendInfo(navcore = session.nav)
	self["VideoPicture"] = Source()
	self["TunerInfo"] = TunerInfo()
	self["RecordState"] = RecordState(session)
	self["Standby"] = Boolean(fixed = False)

	from Components.SystemInfo import SystemInfo

	combine = Combine(func = lambda s: {(False, False): 0, (False, True): 1, (True, False): 2, (True, True): 3}[(s[0].boolean, s[1].boolean)])
	combine.connect(self["Standby"])
	combine.connect(self["RecordState"])

	#                      |  two leds  | single led |
	# recordstate  standby   red green
	#    false      false    off   on     off
	#    true       false    blnk  on     blnk
	#    false      true      on   off    off
	#    true       true     blnk  off    blnk

	PATTERN_ON     = (20, 0xffffffff, 0xffffffff)
	PATTERN_OFF    = (20, 0, 0)
	PATTERN_BLINK  = (20, 0x55555555, 0xa7fccf7a)

	nr_leds = SystemInfo.get("NumFrontpanelLEDs", 0)

	if nr_leds == 1:
		FrontpanelLed(which = 0, boolean = False, patterns = [PATTERN_OFF, PATTERN_BLINK, PATTERN_OFF, PATTERN_BLINK]).connect(combine)
	elif nr_leds == 2:
		if config.plugins.VFD_spark.redLed.value == '1':
			FrontpanelLed(which = 0, boolean = False, patterns = [PATTERN_OFF, PATTERN_BLINK, PATTERN_ON, PATTERN_BLINK]).connect(combine)
		if config.plugins.VFD_spark.greenLed.value == '1':
			FrontpanelLed(which = 1, boolean = False, patterns = [PATTERN_OFF, PATTERN_OFF, PATTERN_ON, PATTERN_OFF]).connect(combine)
		else:
			FrontpanelLed(which = 0, boolean = False, patterns = [PATTERN_OFF, PATTERN_OFF, PATTERN_OFF, PATTERN_OFF]).connect(combine)
			FrontpanelLed(which = 1, boolean = False, patterns = [PATTERN_OFF, PATTERN_OFF, PATTERN_OFF, PATTERN_OFF]).connect(combine)
Exemplo n.º 27
0
Arquivo: Menu.py Projeto: popazerty/12
	def addMenu(self, destList, node):
		requires = node.get("requires")
		if requires:
			if requires[0] == '!':
				if SystemInfo.get(requires[1:], False):
					return
			elif not SystemInfo.get(requires, False):
				return
		MenuTitle = _(node.get("text", "??").encode("UTF-8"))
		entryID = node.get("entryID", "undefined")
		weight = node.get("weight", 50)
		description = node.get("description", "").encode("UTF-8") or None
		description = description and _(description)
		menupng = MenuEntryPixmap(entryID, self.png_cache, lastMenuID)
		x = node.get("flushConfigOnClose")
		if x:
			a = boundFunction(self.session.openWithCallback, self.menuClosedWithConfigFlush, Menu, node)
		else:
			a = boundFunction(self.session.openWithCallback, self.menuClosed, Menu, node)
		#TODO add check if !empty(node.childNodes)
		destList.append((MenuTitle, a, entryID, weight, description, menupng))
Exemplo n.º 28
0
	def __init__(self):
		Renderer.__init__(self)
		self.Position = self.Size = None
		self.decoder = 0
		if SystemInfo.get("NumVideoDecoders", 1) > 1:
			self.decoder = 1
		self.fb_w = getDesktop(0).size().width()
		self.fb_h = getDesktop(0).size().height()
		self.fb_size = None
		self._del_pip = False
		self._can_extended_PiG = False
		self.first_PiG = False
		self.is_channelselection = False
Exemplo n.º 29
0
	def parseConfigFiles(self):
		sections = []
		for setupfile in self.setupfiles:
			# print "[OpenWebif] loading configuration file :", setupfile
			setupfile = file(setupfile, 'r')
			setupdom = xml.etree.cElementTree.parse(setupfile)  # nosec
			setupfile.close()
			xmldata = setupdom.getroot()
			for section in xmldata.findall("setup"):
				configs = []
				requires = section.get("requires")
				if requires and not SystemInfo.get(requires, False):
					continue
				key = section.get("key")
				if key not in self.allowedsections:
					showOpenWebIF = section.get("showOpenWebIF")
					if showOpenWebIF == "1":
						self.allowedsections.append(key)
					else:
						continue
				# print "[OpenWebif] loading configuration section :", key
				for entry in section:
					if entry.tag == "item":
						requires = entry.get("requires")
						if requires and not SystemInfo.get(requires, False):
							continue

						if int(entry.get("level", 0)) > config.usage.setup_level.index:
							continue
						configs.append(entry)
				if len(configs):
					sections.append({
						"key": key,
						"description": _(section.get("title"))
					})
					title = _(section.get("title", ""))
					self.section_config[key] = (title, configs)
		sections = sorted(sections, key=lambda k: k['description'])
		self.sections = sections
Exemplo n.º 30
0
	def createSetupList(self):
		currentItem = self["config"].getCurrent()
		self.list = []
		for x in self.setup:
			if not x.tag:
				continue
			if x.tag == 'item':
				item_level = int(x.get("level", 0))

				if item_level > config.usage.setup_level.index:
					continue

				requires = x.get("requires")
				if requires:
					if requires.startswith('!'):
						if SystemInfo.get(requires[1:], False):
							continue
					elif not SystemInfo.get(requires, False):
						continue
				conditional = x.get("conditional")
				if conditional and not eval(conditional):
					continue

				item_text = _(x.get("text", "??").encode("UTF-8"))
				item_description = _(x.get("description", " ").encode("UTF-8"))
				b = eval(x.text or "");
				if b == "":
					continue
				#add to configlist
				item = b
				# the first b is the item itself, ignored by the configList.
				# the second one is converted to string.
				if not isinstance(item, ConfigNothing):
					self.list.append((item_text, item, item_description))
		self["config"].setList(self.list)
		if config.usage.sort_settings.value:
			self["config"].list.sort()
		self.moveToItem(currentItem)
Exemplo n.º 31
0
Arquivo: plugin.py Projeto: ostende/bh
    def createScreen(self):
        self.list = []
        self.audio_cfg = []

        for x in self.avSetupItems:
            item_level = int(x.get("level", 0))
            if item_level > config.usage.setup_level.index:
                continue

            requires = x.get("requires")
            if requires and not SystemInfo.get(requires, False):
                continue

            item_text = _(x.get("text", "??").encode("UTF-8"))

            item_str = x.get("item", None)
            if item_str is None:
                continue
            item = eval(item_str)

            idx = x.get("idx", 0)
            if idx > 0:
                if idx == 1:  # Video Output
                    current_port = item.value
                elif idx == 2:  # Mode
                    item = config.av.videomode[current_port]
                    current_mode = item.value
                    # some modes (720p, 1080i, 1080p) are always widescreen.
                    force_wide = self.video_cfg.isWidescreenMode(current_mode)
                elif idx == 3:  # Refresh Rate
                    item = config.av.videorate[current_mode]
                    current_rate = item.value
                    if current_mode == "PC":
                        item_text = _("Resolution")
                elif idx == 4:  # Aspect Ratio
                    current_aspect = item.value
                    if force_wide:
                        continue
                elif idx == 5:  # Display 4:3 content as
                    if current_aspect == "auto" and not force_wide:
                        continue
                    elif current_aspect == "4_3":
                        continue
                elif idx == 6:  # Display 16:9 > content as
                    if current_aspect == "auto" and not force_wide:
                        continue
                # Color Format, WSS on 4:3, Auto scart switching
                elif (idx == 7 or idx == 8
                      or idx == 9) and not current_port == "Scart":
                    continue
                elif (
                        idx == 10 or idx == 11
                ) and not current_port == "DVI":  # HDMI Colorspace/Colordepth
                    continue
            if idx == 0 and item_level == 1:  # audio
                self.audio_cfg.append(item_text)

            # add to configlist
            if not isinstance(item, ConfigNothing):
                self.list.append(getConfigListEntry(item_text, item))

        self["config"].setList(self.list)
Exemplo n.º 32
0
    def addItem(self, destList, node):
        requires = node.get('requires')
        if requires:
            if requires[0] == '!':
                if SystemInfo.get(requires[1:], False):
                    return
            elif not SystemInfo.get(requires, False):
                return
        configCondition = node.get('configcondition')
        if configCondition and not eval(configCondition + '.value'):
            return
        item_text = node.get('text', '').encode('UTF-8')
        entryID = node.get('entryID', 'undefined')
        weight = node.get('weight', 50)
        description = node.get('description', '').encode('UTF-8') or ''
        description = description and _(description)
        menupng = MenuEntryPixmap(entryID, self.png_cache, lastMenuID)
        for x in node:
            if x.tag == 'screen':
                module = x.get('module')
                screen = x.get('screen')
                if screen is None:
                    screen = module
                if module:
                    module = 'Screens.' + module
                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                destList.append(
                    (_(item_text
                       or '??'), boundFunction(self.runScreen,
                                               (module, screen)), entryID,
                     weight, description, menupng))
                return
            if x.tag == 'plugin':
                extensions = x.get('extensions')
                system = x.get('system')
                screen = x.get('screen')
                if extensions:
                    module = extensions
                elif system:
                    module = system
                if screen is None:
                    screen = module
                if extensions:
                    module = 'Plugins.Extensions.' + extensions + '.plugin'
                elif system:
                    module = 'Plugins.SystemPlugins.' + system + '.plugin'
                else:
                    module = ''
                args = x.text or ''
                screen += ', ' + args
                destList.append(
                    (_(item_text
                       or '??'), boundFunction(self.runScreen,
                                               (module, screen)), entryID,
                     weight, description, menupng))
                return
            if x.tag == 'code':
                destList.append(
                    (_(item_text
                       or '??'), boundFunction(self.execText, x.text), entryID,
                     weight, description, menupng))
                return
            if x.tag == 'setup':
                id = x.get('id')
                if item_text == '':
                    if getSetupTitleLevel(id) > config.usage.setup_level.index:
                        return
                    item_text = _(getSetupTitle(id))
                else:
                    item_text = _(item_text)
                destList.append((item_text, boundFunction(self.openSetup, id),
                                 entryID, weight, description, menupng))
                return

        destList.append(
            (item_text, self.nothing, entryID, weight, description, menupng))
 def disableLcdLiveTV(self):
     if SystemInfo.get("LcdLiveTV", False):
         self.oldLcdLiveTVEnable = config.lcd.showTv.value
         config.lcd.showTv.value = False
 def restoreLcdLiveTV(self):
     if SystemInfo.get("LcdLiveTV", False):
         config.lcd.showTv.value = self.oldLcdLiveTVEnable
Exemplo n.º 35
0
	def render(self, req):
		req.setResponseCode(http.OK)
		req.setHeader('Content-type', 'application; xhtml+xml')
		req.setHeader('charset', 'UTF-8')

		from time import time, localtime, mktime
		now = localtime()
		begin_h = config.plugins.epgrefresh.begin.value
		begin = mktime((
			now.tm_year, now.tm_mon, now.tm_mday, begin_h[0], begin_h[1],
			0, now.tm_wday, now.tm_yday, now.tm_isdst)
		)
		end_h = config.plugins.epgrefresh.end.value
		end = mktime((
			now.tm_year, now.tm_mon, now.tm_mday, end_h[0], end_h[1],
			0, now.tm_wday, now.tm_yday, now.tm_isdst)
		)

		canDoBackgroundRefresh = SystemInfo.get("NumVideoDecoders", 1) > 1
		hasAutoTimer = False
		try:
			from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
			hasAutoTimer = True
		except ImportError, ie: pass

		return """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<e2settings>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.enabled</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.enablemessage</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.begin</e2settingname>
  <e2settingvalue>%d</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.end</e2settingname>
  <e2settingvalue>%d</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.interval</e2settingname>
  <e2settingvalue>%d</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.delay_standby</e2settingname>
  <e2settingvalue>%d</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.inherit_autotimer</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.afterevent</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.force</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.wakeup</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.parse_autotimer</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <!-- deprecated, pending removal -->
  <e2settingname>config.plugins.epgrefresh.background</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>config.plugins.epgrefresh.adapter</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>canDoBackgroundRefresh</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
 <e2setting>
  <e2settingname>hasAutoTimer</e2settingname>
  <e2settingvalue>%s</e2settingvalue>
 </e2setting>
</e2settings>""" % (
				config.plugins.epgrefresh.enabled.value,
				config.plugins.epgrefresh.enablemessage.value,
				begin,
				end,
				config.plugins.epgrefresh.interval.value,
				config.plugins.epgrefresh.delay_standby.value,
				config.plugins.epgrefresh.inherit_autotimer.value,
				config.plugins.epgrefresh.afterevent.value,
				config.plugins.epgrefresh.force.value,
				config.plugins.epgrefresh.wakeup.value,
				config.plugins.epgrefresh.parse_autotimer.value,
				config.plugins.epgrefresh.adapter.value in ("pip", "pip_hidden"),
				config.plugins.epgrefresh.adapter.value,
				canDoBackgroundRefresh,
				hasAutoTimer,
			)
Exemplo n.º 36
0
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Components.MenuList import MenuList
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigNumber, ConfigSelection, ConfigSelectionNumber, getConfigListEntry
from Plugins.Plugin import PluginDescriptor

from enigma import setAnimation_current, setAnimation_speed, setAnimation_current_listbox
from Components.SystemInfo import SystemInfo

# default = slide to left
g_default = {
    "current": 6,
    "speed": SystemInfo.get("DefaultAniSpeed", 20),
    "listbox": "0",
}
g_max_speed = 30

g_animation_paused = False
g_orig_show = None
g_orig_doClose = None

config.misc.window_animation_default = ConfigNumber(
    default=g_default["current"])
config.misc.window_animation_speed = ConfigSelectionNumber(
    1, g_max_speed, 1, default=g_default["speed"])
config.misc.listbox_animation_default = ConfigSelection(
    default=g_default["listbox"],
    choices=[("0", _("Disable")), ("1", _("Enable")),
Exemplo n.º 37
0
from Components.ConfigList import ConfigListScreen
from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigYesNo, ConfigSelection
from Components.Network import iNetwork

import os

_deviseWOL = "/proc/stb/fp/wol"

_flagForceEnable = False
_flagSupportWol = _flagForceEnable and True or os.path.exists(_deviseWOL)

_tryQuitTable = {"deepstandby":1, "reboot":2, "guirestart":3}

_ethDevice = "eth0"
if SystemInfo.get("WOWLSupport", False):
	_ethDevice = "wlan3"

config.plugins.wolconfig = ConfigSubsection()
config.plugins.wolconfig.activate = ConfigYesNo(default = False)
config.plugins.wolconfig.location = ConfigSelection(default = "menu", choices = [("menu", _("Show on the Standby Menu")), ("deepstandby", _("Run at the Deep Standby"))])

import socket
class NetTool:
	@staticmethod
	def GetHardwareAddr(ethname):
		macaddr = ""
		try:
			sock = socket.socket(socket.AF_PACKET, socket.SOCK_RAW)
			sock.bind((ethname, 9999))
Exemplo n.º 38
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self["CurrentService"] = CurrentService(session.nav)
        self["Event_Now"] = EventInfo(session.nav, EventInfo.NOW)
        self["Event_Next"] = EventInfo(session.nav, EventInfo.NEXT)
        self["FrontendStatus"] = FrontendStatus(
            service_source=session.nav.getCurrentService)
        self["FrontendInfo"] = FrontendInfo(navcore=session.nav)
        self["VideoPicture"] = Source()
        self["TunerInfo"] = TunerInfo()
        self["RecordState"] = RecordState(session)
        self["Standby"] = Boolean(fixed=False)
        self["HddSleepingState"] = HddState(session)

        from Components.SystemInfo import SystemInfo

        combine = Combine(func=lambda s: {
            (False, False): 0,
            (False, True): 1,
            (True, False): 2,
            (True, True): 3
        }[(s[0].boolean, s[1].boolean)])
        combine.connect(self["Standby"])
        combine.connect(self["RecordState"])
        combine.connect(self["HddSleepingState"])

        #                      |  two leds  | single led |
        # recordstate  standby   red green
        #    false      false    off   on     off
        #    true       false    blnk  on     blnk
        #    false      true      on   off    off
        #    true       true     blnk  off    blnk

        PATTERN_ON = (20, 0xffffffff, 0xffffffff)
        PATTERN_OFF = (20, 0, 0)
        PATTERN_BLINK = (20, 0x55555555, 0xa7fccf7a)

        NormalLed0 = PATTERN_OFF
        NormalLed1 = PATTERN_OFF
        if config.usage.frontled_color.value == "1":
            NormalLed0 = PATTERN_ON
        if config.usage.frontled_color.value == "2":
            NormalLed1 = PATTERN_ON
        if config.usage.frontled_color.value == "3":
            NormalLed0 = PATTERN_BLINK
        if config.usage.frontled_color.value == "4":
            NormalLed1 = PATTERN_BLINK

        RecLed0 = PATTERN_OFF
        RecLed1 = PATTERN_OFF
        if config.usage.frontledrec_color.value == "1":
            RecLed0 = PATTERN_ON
        if config.usage.frontledrec_color.value == "2":
            RecLed1 = PATTERN_ON
        if config.usage.frontledrec_color.value == "3":
            RecLed0 = PATTERN_BLINK
        if config.usage.frontledrec_color.value == "4":
            RecLed1 = PATTERN_BLINK

        StandbyLed0 = PATTERN_OFF
        StandbyLed1 = PATTERN_OFF
        if config.usage.frontledstdby_color.value == "1":
            StandbyLed0 = PATTERN_ON
        if config.usage.frontledstdby_color.value == "2":
            StandbyLed1 = PATTERN_ON
        if config.usage.frontledstdby_color.value == "3":
            StandbyLed0 = PATTERN_BLINK
        if config.usage.frontledstdby_color.value == "4":
            StandbyLed1 = PATTERN_BLINK

        RecstdbyLed0 = PATTERN_OFF
        RecstdbyLed1 = PATTERN_OFF
        if config.usage.frontledrecstdby_color.value == "1":
            RecstdbyLed0 = PATTERN_ON
        if config.usage.frontledrecstdby_color.value == "2":
            RecstdbyLed1 = PATTERN_ON
        if config.usage.frontledrecstdby_color.value == "3":
            RecstdbyLed0 = PATTERN_BLINK
        if config.usage.frontledrecstdby_color.value == "4":
            RecstdbyLed1 = PATTERN_BLINK

        nr_leds = SystemInfo.get("NumFrontpanelLEDs", 0)

        if nr_leds == 1:
            FrontpanelLed(which=0,
                          boolean=False,
                          patterns=[
                              PATTERN_OFF, PATTERN_BLINK, PATTERN_OFF,
                              PATTERN_BLINK
                          ]).connect(combine)
        elif nr_leds == 2:
            FrontpanelLed(which=0,
                          boolean=False,
                          patterns=[
                              PATTERN_OFF, PATTERN_BLINK, PATTERN_ON,
                              PATTERN_BLINK
                          ]).connect(combine)
            FrontpanelLed(
                which=1,
                boolean=False,
                patterns=[PATTERN_ON, PATTERN_ON, PATTERN_OFF,
                          PATTERN_OFF]).connect(combine)
Exemplo n.º 39
0
def InitEPGConfig():
    config.epgselection = ConfigSubsection()
    config.epgselection.sort = ConfigSelection(default="0",
                                               choices=[("0", _("Time")),
                                                        ("1",
                                                         _("Alphanumeric"))])
    config.epgselection.overjump = ConfigYesNo(default=False)

    serviceTitleChoices = [
        ("servicename", _("Service Name")), ("picon", _("Picon")),
        ("picon+servicename", _("Picon and Service Name")),
        ("servicenumber+picon", _("Service Number and Picon")),
        ("picon+servicenumber", _("Picon and Service Number")),
        ("servicenumber+servicename", _("Service Number and Service Name")),
        ("picon+servicenumber+servicename",
         _("Picon, Service Number and Service Name")),
        ("servicenumber+picon+servicename",
         _("Service Number, Picon and Service Name"))
    ]

    singleBrowseModeChoices = [("currentservice", _("Select current service")),
                               ("lastepgservice",
                                _("Select last browsed service"))]

    multiBrowseModeChoices = [
        ("currentservice", _("Select current service")),
        ("firstservice", _("Select first service in bouquet")),
        ("lastepgservice", _("Select last browsed service"))
    ]

    okButtonChoices = [("zap", _("Zap")), ("zapExit", _("Zap + Exit"))]
    infoButtonChoices = [("openEventView", _("Event Info")),
                         ("openSingleEPG", _("Single EPG"))]

    config.epgselection.infobar = ConfigSubsection()
    config.epgselection.infobar.browse_mode = ConfigSelection(
        default="currentservice", choices=singleBrowseModeChoices)
    config.epgselection.infobar.type_mode = ConfigSelection(
        default="graphics",
        choices=[("text", _("Text Grid EPG")),
                 ("graphics", _("Graphics Grid EPG")),
                 ("single", _("Single EPG"))])
    if SystemInfo.get("NumVideoDecoders", 1) > 1:
        config.epgselection.infobar.preview_mode = ConfigSelection(choices=[
            ("0", _("Disabled")), ("1", _("Full screen")), ("2", _("PiP"))
        ],
                                                                   default="1")
    else:
        config.epgselection.infobar.preview_mode = ConfigSelection(choices=[
            ("0", _("Disabled")), ("1", _("Full screen"))
        ],
                                                                   default="1")
    config.epgselection.infobar.btn_ok = ConfigSelection(
        choices=okButtonChoices, default="zap")
    config.epgselection.infobar.btn_oklong = ConfigSelection(
        choices=okButtonChoices, default="zapExit")
    config.epgselection.infobar.itemsperpage = ConfigSelectionNumber(
        default=2, stepwidth=1, min=1, max=4, wraparound=True)
    config.epgselection.infobar.roundto = ConfigSelection(
        default="15",
        choices=[("15", _("%d minutes") % 15), ("30", _("%d minutes") % 30),
                 ("60", _("%d minutes") % 60)])
    config.epgselection.infobar.prevtimeperiod = ConfigSelection(
        default="180",
        choices=[
            ("60", _("%d minutes") % 60), ("90", _("%d minutes") % 90),
            ("120", _("%d minutes") % 120), ("150", _("%d minutes") % 150),
            ("180", _("%d minutes") % 180), ("210", _("%d minutes") % 210),
            ("240", _("%d minutes") % 240), ("270", _("%d minutes") % 270),
            ("300", _("%d minutes") % 300)
        ])
    config.epgselection.infobar.primetime = ConfigClock(default=20 * 60)
    config.epgselection.infobar.servicetitle_mode = ConfigSelection(
        default="servicename", choices=serviceTitleChoices)
    config.epgselection.infobar.servfs = ConfigSelectionNumber(default=0,
                                                               stepwidth=1,
                                                               min=-8,
                                                               max=10,
                                                               wraparound=True)
    config.epgselection.infobar.eventfs = ConfigSelectionNumber(
        default=0, stepwidth=1, min=-8, max=10, wraparound=True)
    config.epgselection.infobar.timelinefs = ConfigSelectionNumber(
        default=0, stepwidth=1, min=-8, max=10, wraparound=True)
    config.epgselection.infobar.timeline24h = ConfigYesNo(default=True)
    config.epgselection.infobar.servicewidth = ConfigSelectionNumber(
        default=250, stepwidth=1, min=70, max=500, wraparound=True)
    config.epgselection.infobar.piconwidth = ConfigSelectionNumber(
        default=100, stepwidth=1, min=50, max=500, wraparound=True)
    config.epgselection.infobar.infowidth = ConfigSelectionNumber(
        default=50, stepwidth=25, min=0, max=150, wraparound=True)
    config.epgselection.single = ConfigSubsection()
    config.epgselection.single.browse_mode = ConfigSelection(
        default="lastepgservice", choices=singleBrowseModeChoices)
    config.epgselection.single.preview_mode = ConfigYesNo(default=True)
    config.epgselection.single.btn_ok = ConfigSelection(
        choices=okButtonChoices, default="zap")
    config.epgselection.single.btn_oklong = ConfigSelection(
        choices=okButtonChoices, default="zapExit")
    config.epgselection.single.eventfs = ConfigSelectionNumber(default=0,
                                                               stepwidth=1,
                                                               min=-8,
                                                               max=10,
                                                               wraparound=True)
    config.epgselection.single.itemsperpage = ConfigSelectionNumber(
        default=18, stepwidth=1, min=1, max=40, wraparound=True)
    config.epgselection.multi = ConfigSubsection()
    config.epgselection.multi.showbouquet = ConfigYesNo(default=False)
    config.epgselection.multi.browse_mode = ConfigSelection(
        default="currentservice", choices=multiBrowseModeChoices)
    config.epgselection.multi.preview_mode = ConfigYesNo(default=True)
    config.epgselection.multi.btn_ok = ConfigSelection(choices=okButtonChoices,
                                                       default="zap")
    config.epgselection.multi.btn_oklong = ConfigSelection(
        choices=okButtonChoices, default="zapExit")
    config.epgselection.multi.eventfs = ConfigSelectionNumber(default=0,
                                                              stepwidth=1,
                                                              min=-8,
                                                              max=10,
                                                              wraparound=True)
    config.epgselection.multi.itemsperpage = ConfigSelectionNumber(
        default=18, stepwidth=1, min=12, max=40, wraparound=True)
    config.epgselection.multi.servicewidth = ConfigSelectionNumber(
        default=7, stepwidth=1, min=5, max=20, wraparound=True)
    config.epgselection.grid = ConfigSubsection()
    config.epgselection.grid.showbouquet = ConfigYesNo(default=False)
    config.epgselection.grid.browse_mode = ConfigSelection(
        default="currentservice", choices=multiBrowseModeChoices)
    config.epgselection.grid.preview_mode = ConfigYesNo(default=True)
    config.epgselection.grid.type_mode = ConfigSelection(choices=[
        ("graphics", _("Graphics")), ("text", _("Text"))
    ],
                                                         default="graphics")
    config.epgselection.grid.highlight_current_events = ConfigYesNo(
        default=True)
    config.epgselection.grid.btn_ok = ConfigSelection(choices=okButtonChoices,
                                                      default="zap")
    config.epgselection.grid.btn_oklong = ConfigSelection(
        choices=okButtonChoices, default="zapExit")
    config.epgselection.grid.btn_info = ConfigSelection(
        choices=infoButtonChoices, default="openEventView")
    config.epgselection.grid.btn_infolong = ConfigSelection(
        choices=infoButtonChoices, default="openSingleEPG")
    config.epgselection.grid.roundto = ConfigSelection(
        default="15",
        choices=[("15", _("%d minutes") % 15), ("30", _("%d minutes") % 30),
                 ("60", _("%d minutes") % 60)])
    config.epgselection.grid.prevtimeperiod = ConfigSelection(
        default="180",
        choices=[
            ("60", _("%d minutes") % 60), ("90", _("%d minutes") % 90),
            ("120", _("%d minutes") % 120), ("150", _("%d minutes") % 150),
            ("180", _("%d minutes") % 180), ("210", _("%d minutes") % 210),
            ("240", _("%d minutes") % 240), ("270", _("%d minutes") % 270),
            ("300", _("%d minutes") % 300)
        ])
    config.epgselection.grid.primetime = ConfigClock(default=20 * 60)
    config.epgselection.grid.servicetitle_mode = ConfigSelection(
        default="servicename", choices=serviceTitleChoices)
    possibleAlignmentChoices = [
        (str(RT_HALIGN_LEFT | RT_VALIGN_CENTER), _("left")),
        (str(RT_HALIGN_CENTER | RT_VALIGN_CENTER), _("centered")),
        (str(RT_HALIGN_RIGHT | RT_VALIGN_CENTER), _("right")),
        (str(RT_HALIGN_LEFT | RT_VALIGN_CENTER | RT_WRAP), _("left, wrapped")),
        (str(RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP),
         _("centered, wrapped")),
        (str(RT_HALIGN_RIGHT | RT_VALIGN_CENTER | RT_WRAP),
         _("right, wrapped"))
    ]
    config.epgselection.grid.servicename_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.servicenumber_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.event_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.timelinedate_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.servfs = ConfigSelectionNumber(default=0,
                                                            stepwidth=1,
                                                            min=-8,
                                                            max=10,
                                                            wraparound=True)
    config.epgselection.grid.eventfs = ConfigSelectionNumber(default=0,
                                                             stepwidth=1,
                                                             min=-8,
                                                             max=10,
                                                             wraparound=True)
    config.epgselection.grid.timelinefs = ConfigSelectionNumber(
        default=0, stepwidth=1, min=-8, max=10, wraparound=True)
    config.epgselection.grid.timeline24h = ConfigYesNo(default=True)
    config.epgselection.grid.itemsperpage = ConfigSelectionNumber(
        default=8, stepwidth=1, min=3, max=20, wraparound=True)
    config.epgselection.grid.pig = ConfigYesNo(default=True)
    config.epgselection.grid.heightswitch = NoSave(ConfigYesNo(default=False))
    config.epgselection.grid.servicewidth = ConfigSelectionNumber(
        default=250, stepwidth=1, min=70, max=500, wraparound=True)
    config.epgselection.grid.piconwidth = ConfigSelectionNumber(
        default=100, stepwidth=1, min=50, max=500, wraparound=True)
    config.epgselection.grid.infowidth = ConfigSelectionNumber(default=50,
                                                               stepwidth=25,
                                                               min=0,
                                                               max=150,
                                                               wraparound=True)
    config.epgselection.grid.rec_icon_height = ConfigSelection(
        choices=[("bottom", _("bottom")), ("top", _("top")),
                 ("middle", _("middle")), ("hide", _("hide"))],
        default="bottom")
Exemplo n.º 40
0
def newSessionGlobals__init__(self, session):
    baseSessionGlobals__init__(self, session)
    global SessionGlobals_instance
    SessionGlobals_instance = self
    from Components.Sources.CurrentService import CurrentService
    from Components.Sources.EventInfo import EventInfo
    from Components.Sources.FrontendStatus import FrontendStatus
    from Components.Sources.FrontendInfo import FrontendInfo
    from Components.Sources.Source import Source
    from Components.Sources.TunerInfo import TunerInfo
    from Components.Sources.Boolean import Boolean
    from Components.Sources.RecordState import RecordState
    from Components.Converter.Combine import Combine
    from Components.Renderer.FrontpanelLed import FrontpanelLed
    self["CurrentService"] = CurrentService(session.nav)
    self["Event_Now"] = EventInfo(session.nav, EventInfo.NOW)
    self["Event_Next"] = EventInfo(session.nav, EventInfo.NEXT)
    self["FrontendStatus"] = FrontendStatus(
        service_source=session.nav.getCurrentService)
    self["FrontendInfo"] = FrontendInfo(navcore=session.nav)
    self["VideoPicture"] = Source()
    self["TunerInfo"] = TunerInfo()
    self["RecordState"] = RecordState(session)
    self["Standby"] = Boolean(fixed=False)

    from Components.SystemInfo import SystemInfo

    combine = Combine(func=lambda s: {
        (False, False): 0,
        (False, True): 1,
        (True, False): 2,
        (True, True): 3
    }[(s[0].boolean, s[1].boolean)])
    combine.connect(self["Standby"])
    combine.connect(self["RecordState"])

    #                      |  two leds  | single led |
    # recordstate  standby   red green
    #    false      false    off   on     off
    #    true       false    blnk  on     blnk
    #    false      true      on   off    off
    #    true       true     blnk  off    blnk

    PATTERN_ON = (20, 0xffffffff, 0xffffffff)
    PATTERN_OFF = (20, 0, 0)
    PATTERN_BLINK = (20, 0x55555555, 0xa7fccf7a)

    nr_leds = SystemInfo.get("NumFrontpanelLEDs", 0)

    if nr_leds == 1:
        FrontpanelLed(
            which=0,
            boolean=False,
            patterns=[PATTERN_OFF, PATTERN_BLINK, PATTERN_OFF,
                      PATTERN_BLINK]).connect(combine)
    elif nr_leds == 2:
        if config.plugins.VFD_spark.redLed.value == '1':
            FrontpanelLed(which=0,
                          boolean=False,
                          patterns=[
                              PATTERN_OFF, PATTERN_BLINK, PATTERN_ON,
                              PATTERN_BLINK
                          ]).connect(combine)
        if config.plugins.VFD_spark.greenLed.value == '1':
            FrontpanelLed(
                which=1,
                boolean=False,
                patterns=[PATTERN_OFF, PATTERN_OFF, PATTERN_ON,
                          PATTERN_OFF]).connect(combine)
        else:
            FrontpanelLed(
                which=0,
                boolean=False,
                patterns=[PATTERN_OFF, PATTERN_OFF, PATTERN_OFF,
                          PATTERN_OFF]).connect(combine)
            FrontpanelLed(
                which=1,
                boolean=False,
                patterns=[PATTERN_OFF, PATTERN_OFF, PATTERN_OFF,
                          PATTERN_OFF]).connect(combine)
Exemplo n.º 41
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self['CurrentService'] = CurrentService(session.nav)
     self['CurrentTime'] = Clock()
     self['Event_Now'] = EventInfo(session.nav, EventInfo.NOW)
     self['Event_Next'] = EventInfo(session.nav, EventInfo.NEXT)
     self['FrontendStatus'] = FrontendStatus(
         service_source=session.nav.getCurrentService)
     self['FrontendInfo'] = FrontendInfo(navcore=session.nav)
     self['VideoPicture'] = Source()
     self['TunerInfo'] = TunerInfo()
     self['RecordState'] = RecordState(session)
     self['Standby'] = Boolean(fixed=False)
     from Components.SystemInfo import SystemInfo
     combine = Combine(func=lambda s: {
         (False, False): 0,
         (False, True): 1,
         (True, False): 2,
         (True, True): 3
     }[s[0].boolean, s[1].boolean])
     combine.connect(self['Standby'])
     combine.connect(self['RecordState'])
     PATTERN_ON = (20, 4294967295, 4294967295)
     PATTERN_OFF = (20, 0, 0)
     PATTERN_BLINK = (20, 1431655765, 2818363258)
     have_display = SystemInfo.get('FrontpanelDisplay', False)
     have_touch_sensor = SystemInfo.get('HaveTouchSensor', False)
     nr_leds = SystemInfo.get('NumFrontpanelLEDs', 0)
     if nr_leds == 1:
         FrontpanelLed(which=0,
                       boolean=False,
                       patterns=[
                           PATTERN_OFF if have_display else PATTERN_ON,
                           PATTERN_BLINK, PATTERN_OFF, PATTERN_BLINK
                       ]).connect(combine)
     elif nr_leds == 2:
         if have_touch_sensor:
             FrontpanelLed(which=0,
                           boolean=False,
                           patterns=[
                               PATTERN_ON, PATTERN_BLINK, PATTERN_OFF,
                               PATTERN_BLINK
                           ]).connect(combine)
             FrontpanelLed(which=1,
                           boolean=False,
                           patterns=[
                               PATTERN_OFF, PATTERN_OFF, PATTERN_OFF,
                               PATTERN_OFF
                           ]).connect(combine)
         else:
             FrontpanelLed(which=0,
                           boolean=False,
                           patterns=[
                               PATTERN_OFF, PATTERN_BLINK, PATTERN_ON,
                               PATTERN_BLINK
                           ]).connect(combine)
             FrontpanelLed(which=1,
                           boolean=False,
                           patterns=[
                               PATTERN_ON, PATTERN_ON, PATTERN_OFF,
                               PATTERN_OFF
                           ]).connect(combine)
Exemplo n.º 42
0
def readSkin(screen, skin, names, desktop):
    if not isinstance(names, list):
        names = [names]

    name = "<embedded-in-'%s'>" % screen.__class__.__name__

    # try all skins, first existing one have priority
    for n in names:
        myscreen, path = lookupScreen(n)
        if myscreen is not None:
            # use this name for debug output
            name = n
            break

    # otherwise try embedded skin
    if myscreen is None:
        myscreen = getattr(screen, "parsedSkin", None)

    # try uncompiled embedded skin
    if myscreen is None and getattr(screen, "skin", None):
        print "Looking for embedded skin"
        myscreen = screen.parsedSkin = xml.etree.cElementTree.fromstring(
            screen.skin)

    #assert myscreen is not None, "no skin for screen '" + repr(names) + "' found!"
    if myscreen is None:
        print "No skin to read..."
        emptySkin = "<screen></screen>"
        myscreen = screen.parsedSkin = xml.etree.cElementTree.fromstring(
            emptySkin)

    screen.skinAttributes = []

    skin_path_prefix = getattr(screen, "skin_path", path)

    collectAttributes(screen.skinAttributes,
                      myscreen,
                      skin_path_prefix,
                      ignore=["name"])

    screen.additionalWidgets = []
    screen.renderer = []

    visited_components = set()

    # now walk all widgets
    for widget in myscreen.findall("widget"):
        get_attr = widget.attrib.get
        # ok, we either have 1:1-mapped widgets ('old style'), or 1:n-mapped
        # widgets (source->renderer).

        wname = get_attr('name')
        wsource = get_attr('source')

        if QBOXHD:
            requires = get_attr('requires')

            if requires and not SystemInfo.get(requires, False):
                continue

        if wname is None and wsource is None:
            print "widget has no name and no source!"
            continue

        if wname:
            #print "Widget name=", wname
            visited_components.add(wname)

            # get corresponding 'gui' object
            try:
                attributes = screen[wname].skinAttributes = []
            except:
                if QBOXHD:
                    print SkinError("component with name '" + wname +
                                    "' was not found in skin of screen '" +
                                    name + "'!")
                    continue

                raise SkinError("component with name '" + wname +
                                "' was not found in skin of screen '" + name +
                                "'!")
                #print "WARNING: component with name '" + wname + "' was not found in skin of screen '" + name + "'!"

#			assert screen[wname] is not Source

# and collect attributes for this
            collectAttributes(attributes,
                              widget,
                              skin_path_prefix,
                              ignore=['name'])
        elif wsource:
            # get corresponding source
            #print "Widget source=", wsource

            while True:  # until we found a non-obsolete source

                # parse our current "wsource", which might specifiy a "related screen" before the dot,
                # for example to reference a parent, global or session-global screen.
                scr = screen

                # resolve all path components
                path = wsource.split('.')
                while len(path) > 1:
                    scr = screen.getRelatedScreen(path[0])
                    if scr is None:
                        #print wsource
                        #print name
                        if QBOXHD:
                            print SkinError("specified related screen '" +
                                            wsource +
                                            "' was not found in screen '" +
                                            name + "'!")
                            continue

                        raise SkinError("specified related screen '" +
                                        wsource +
                                        "' was not found in screen '" + name +
                                        "'!")
                    path = path[1:]

                # resolve the source.
                source = scr.get(path[0])
                if isinstance(source, ObsoleteSource):
                    # however, if we found an "obsolete source", issue warning, and resolve the real source.
                    print "WARNING: SKIN '%s' USES OBSOLETE SOURCE '%s', USE '%s' INSTEAD!" % (
                        name, wsource, source.new_source)
                    print "OBSOLETE SOURCE WILL BE REMOVED %s, PLEASE UPDATE!" % (
                        source.removal_date)
                    if source.description:
                        print source.description

                    wsource = source.new_source
                else:
                    # otherwise, use that source.
                    break

            if source is None:
                if QBOXHD:
                    print SkinError("source '" + wsource +
                                    "' was not found in screen '" + name +
                                    "'!")
                    continue

                raise SkinError("source '" + wsource +
                                "' was not found in screen '" + name + "'!")

            wrender = get_attr('render')

            if not wrender:
                if QBOXHD:
                    print SkinError(
                        "you must define a renderer with render= for source '%s'"
                        % (wsource))
                    continue

                raise SkinError(
                    "you must define a renderer with render= for source '%s'" %
                    (wsource))

            for converter in widget.findall("convert"):
                ctype = converter.get('type')
                assert ctype, "'convert'-tag needs a 'type'-attribute"
                #print "Converter:", ctype
                try:
                    parms = converter.text.strip()
                except:
                    parms = ""
                #print "Params:", parms
                converter_class = my_import('.'.join(
                    ("Components", "Converter", ctype))).__dict__.get(ctype)

                c = None

                for i in source.downstream_elements:
                    if isinstance(i, converter_class
                                  ) and i.converter_arguments == parms:
                        c = i

                if c is None:
                    if not QBOXHD:
                        print "allocating new converter!"
                    c = converter_class(parms)
                    c.connect(source)
                else:
                    if not QBOXHD:
                        print "reused converter!"

                source = c

            renderer_class = my_import('.'.join(
                ("Components", "Renderer", wrender))).__dict__.get(wrender)

            renderer = renderer_class()  # instantiate renderer

            renderer.connect(source)  # connect to source
            attributes = renderer.skinAttributes = []
            collectAttributes(attributes,
                              widget,
                              skin_path_prefix,
                              ignore=['render', 'source'])

            screen.renderer.append(renderer)

    from Components.GUIComponent import GUIComponent
    nonvisited_components = [
        x for x in set(screen.keys()) - visited_components
        if isinstance(x, GUIComponent)
    ]
    assert not nonvisited_components, "the following components in %s don't have a skin entry: %s" % (
        name, ', '.join(nonvisited_components))

    # now walk additional objects
    for widget in myscreen.getchildren():
        w_tag = widget.tag

        if w_tag == "widget":
            continue

        if w_tag == "applet":
            try:
                codeText = widget.text.strip()
            except:
                codeText = ""

            #print "Found code:"
            #print codeText
            widgetType = widget.attrib.get('type')

            code = compile(codeText, "skin applet", "exec")

            if widgetType == "onLayoutFinish":
                screen.onLayoutFinish.append(code)
                #print "onLayoutFinish = ", codeText
            else:
                if QBOXHD:
                    print SkinError("applet type '%s' unknown!" % type)
                    continue

                raise SkinError("applet type '%s' unknown!" % type)
                #print "applet type '%s' unknown!" % type

            continue

        w = additionalWidget()

        if w_tag == "eLabel":
            w.widget = eLabel
        elif w_tag == "ePixmap":
            w.widget = ePixmap
        else:
            if QBOXHD:
                print SkinError("unsupported stuff : %s" % w_tag)
                continue

            raise SkinError("unsupported stuff : %s" % w_tag)
            #print "unsupported stuff : %s" % widget.tag

        w.skinAttributes = []
        collectAttributes(w.skinAttributes,
                          widget,
                          skin_path_prefix,
                          ignore=['name'])

        # applyAttributes(guiObject, widget, desktop)
        # guiObject.thisown = 0
        screen.additionalWidgets.append(w)
Exemplo n.º 43
0
    def createSetupList(self):
        currentItem = self["config"].getCurrent()
        self.list = []
        for x in self.setup:
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                item_tuxtxtlevel = int(x.get("tt_level", 0))

                if item_level > config.usage.setup_level.index:
                    continue
                if (item_tuxtxtlevel
                        == 1) and (config.usage.tuxtxt_font_and_res.value !=
                                   "expert_mode"):
                    continue

                requires = x.get("requires")
                if requires:
                    meets = True
                    for requires in requires.split(';'):
                        negate = requires.startswith('!')
                        if negate:
                            requires = requires[1:]
                        if requires.startswith('config.'):
                            try:
                                item = eval(requires)
                                SystemInfo[
                                    requires] = True if item.value and item.value not in (
                                        "0", "False", "false",
                                        "off") else False
                            except AttributeError:
                                print(
                                    '[Setup] unknown "requires" config element:',
                                    requires)

                        if requires:
                            if not SystemInfo.get(requires, False):
                                if not negate:
                                    meets = False
                                    break
                            else:
                                if negate:
                                    meets = False
                                    break
                    if not meets:
                        continue

                item_text = _(x.get("text", "??").encode("UTF-8"))
                item_description = _(
                    x.get("description", " ").encode("UTF-8"))  # don't change
                b = eval(x.text or "")
                if b == "":
                    continue
                #add to configlist
                item = b
                # the first b is the item itself, ignored by the configList.
                # the second one is converted to string.
                if not isinstance(item, ConfigNothing):
                    self.list.append((item_text, item, item_description))
        self["config"].setList(self.list)
        if config.usage.sort_settings.value:
            self["config"].list.sort()
        self.moveToItem(currentItem)
Exemplo n.º 44
0
	def addItem(self, destList, node):
		requires = node.get("requires")
		if requires:
			if requires[0] == '!':
				if SystemInfo.get(requires[1:], False):
					return
			elif not SystemInfo.get(requires, False):
				return
		conditional = node.get("conditional")
		if conditional and not eval(conditional):
			return
		# print("[Menu][addItem] item text=", node.get("text", "* Undefined *"))
		item_text = str(node.get("text", "* Undefined *"))
		
		if item_text:
			item_text = _(item_text)
		entryID = node.get("entryID", "undefined")
		weight = node.get("weight", 50)
		for x in node:
			if x.tag == 'screen':
				module = x.get("module")
				screen = x.get("screen")

				if screen is None:
					screen = module

				# print module, screen
				if module:
					module = "Screens." + module
				else:
					module = ""

				# check for arguments. they will be appended to the
				# openDialog call
				args = x.text or ""
				screen += ", " + args

				destList.append((item_text, boundFunction(self.runScreen, (module, screen)), entryID, weight))
				return
			elif x.tag == 'plugin':
				extensions = x.get("extensions")
				system = x.get("system")
				screen = x.get("screen")

				if extensions:
					module = extensions
				elif system:
					module = system

				if screen is None:
					screen = module

				if extensions:
					module = "Plugins.Extensions." + extensions + '.plugin'
				elif system:
					module = "Plugins.SystemPlugins." + system + '.plugin'
				else:
					module = ""

				# check for arguments. they will be appended to the
				# openDialog call
				args = x.text or ""
				screen += ", " + args

				destList.append((item_text, boundFunction(self.runScreen, (module, screen)), entryID, weight))
				return
			elif x.tag == 'code':
				destList.append((item_text, boundFunction(self.execText, x.text), entryID, weight))
				return
			elif x.tag == 'setup':
				id = x.get("id")
				destList.append((item_text, boundFunction(self.openSetup, id), entryID, weight))
				return
		destList.append((item_text, self.nothing, entryID, weight))
Exemplo n.º 45
0
    def addItems(self, list, parentNode):
        for x in parentNode:
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                item_tunerlevel = int(x.get("tunerlevel", 0))
                item_rectunerlevel = int(x.get("rectunerlevel", 0))
                item_tuxtxtlevel = int(x.get("tt_level", 0))

                if not self.onNotifiers:
                    self.onNotifiers.append(self.levelChanged)
                    self.onClose.append(self.removeNotifier)

                if item_level > config.usage.setup_level.index:
                    continue
                if (item_tuxtxtlevel
                        == 1) and (config.usage.tuxtxt_font_and_res.value !=
                                   "expert_mode"):
                    continue
                if item_tunerlevel == 1 and not config.usage.frontend_priority.value in (
                        "expert_mode", "experimental_mode"):
                    continue
                if item_tunerlevel == 2 and not config.usage.frontend_priority.value == "experimental_mode":
                    continue
                if item_rectunerlevel == 1 and not config.usage.recording_frontend_priority.value in (
                        "expert_mode", "experimental_mode"):
                    continue
                if item_rectunerlevel == 2 and not config.usage.recording_frontend_priority.value == "experimental_mode":
                    continue

                requires = x.get("requires")
                if requires and requires.startswith('config.'):
                    item = eval(requires or "")
                    if item.value and not item.value == "0":
                        SystemInfo[requires] = True
                    else:
                        SystemInfo[requires] = False

                if requires and not SystemInfo.get(requires, False):
                    continue

                if self.PluginLanguageDomain:
                    item_text = dgettext(self.PluginLanguageDomain,
                                         x.get("text", "??").encode("UTF-8"))
                    item_description = dgettext(
                        self.PluginLanguageDomain,
                        x.get("description", " ").encode("UTF-8"))
                else:
                    item_text = _(x.get("text", "??").encode("UTF-8"))
                    item_description = _(
                        x.get("description", " ").encode("UTF-8"))

                item_text = item_text.replace(
                    "%s %s", "%s %s" % (getMachineBrand(), getMachineName()))
                item_description = item_description.replace(
                    "%s %s", "%s %s" % (getMachineBrand(), getMachineName()))
                b = eval(x.text or "")
                if b == "":
                    continue
                #add to configlist
                item = b
                # the first b is the item itself, ignored by the configList.
                # the second one is converted to string.
                if not isinstance(item, ConfigNothing):
                    list.append((item_text, item, item_description))
Exemplo n.º 46
0
	def __init__(self, session):
		Screen.__init__(self, session)

		# Summary
		self.setup_title = _("EPGRefresh Configuration")
		self.onChangedEntry = []

		# Although EPGRefresh keeps services in a Set we prefer a list
		self.services = (
			[x for x in epgrefresh.services[0]],
			[x for x in epgrefresh.services[1]]
		)

		self.list = [
			getConfigListEntry(_("Refresh automatically"), config.plugins.epgrefresh.enabled, _("Unless this is enabled EPGRefresh won't automatically run but has to be explicitely started through the yellow button from this menu.")),
			getConfigListEntry(_("Wakeup from Deep-Standby to refresh EPG"), config.plugins.epgrefresh.wakeup, _("If this is enabled, the plugin will wake the receiver up from deep-standby if possible. Otherwise it has to be turned on already.")),
			getConfigListEntry(_("Time to stay on service (in m)"), config.plugins.epgrefresh.interval, _("This is the ammount of time a channel will be active during a refresh.")),
			getConfigListEntry(_("Refresh EPG after"), config.plugins.epgrefresh.begin, _("An automated refresh will happen after this time of day, but before the next setting.")),
			getConfigListEntry(_("Refresh EPG before"), config.plugins.epgrefresh.end, _("An automated refresh will happen before this time of day, but after the previous setting.")),
			getConfigListEntry(_("Delay when not in Standby (in m)"), config.plugins.epgrefresh.delay_standby, _("If the receiver is currently not in standby this is the amount of time EPGRefresh will wait before trying again.")),
			getConfigListEntry(_("Force scan even if receiver is in use"), config.plugins.epgrefresh.force, _("This setting controls whether or not the refresh will also be initiated when the receiver is being used (namely not in standby or currently recording).")),
			getConfigListEntry(_("Inherit Services from AutoTimer if available"), config.plugins.epgrefresh.inherit_autotimer, _("If you're also using the AutoTimer plugin this allows to extend the list of services to refresh by the services your AutoTimers are restricted to.")),
			getConfigListEntry(_("Make AutoTimer parse EPG if available"), config.plugins.epgrefresh.parse_autotimer, _("If you're also using the AutoTimer plugin this will initiate a scan of the EPG after a completed refresh.")),
			getConfigListEntry(_("Shutdown after refresh"), config.plugins.epgrefresh.afterevent, _("This setting controls if the receiver should be sent to deep-standby after a completed refresh.")),
		]
		if SystemInfo.get("NumVideoDecoders", 1) > 1:
			self.list.insert(1, getConfigListEntry(_("Refresh in Background"), config.plugins.epgrefresh.background, _("Use Picture In Picture to refresh EPG?")))

		ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
		def selectionChanged():
			if self["config"].current:
				self["config"].current[1].onDeselect(self.session)
			self["config"].current = self["config"].getCurrent()
			if self["config"].current:
				self["config"].current[1].onSelect(self.session)
			for x in self["config"].onSelectionChanged:
				x()
		self["config"].selectionChanged = selectionChanged
		self["config"].onSelectionChanged.append(self.updateHelp)

		# Initialize Buttons
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		self["key_yellow"] = StaticText(_("Refresh now"))
		self["key_blue"] = StaticText(_("Edit Services"))

		self["help"] = StaticText()

		# Define Actions
		self["actions"] = ActionMap(["SetupActions", "ColorActions", "ChannelSelectEPGActions"],
			{
				"cancel": self.keyCancel,
				"save": self.keySave,
				"yellow": self.forceRefresh,
				"blue": self.editServices,
				"showEPGList": self.keyInfo,
			}
		)

		# Trigger change
		self.changed()

		self.onLayoutFinish.append(self.setCustomTitle)
Exemplo n.º 47
0
def InitEPGConfig():
    config.epgselection = ConfigSubsection()
    config.epgselection.sort = ConfigSelection(default="0",
                                               choices=[("0", _("Time")),
                                                        ("1",
                                                         _("Alphanumeric"))])
    config.epgselection.overjump = ConfigYesNo(default=False)

    serviceTitleChoices = [
        ("servicename", _("Service Name")), ("picon", _("Picon")),
        ("picon+servicename", _("Picon and Service Name")),
        ("servicenumber+picon", _("Service Number and Picon")),
        ("picon+servicenumber", _("Picon and Service Number")),
        ("servicenumber+servicename", _("Service Number and Service Name")),
        ("picon+servicenumber+servicename",
         _("Picon, Service Number and Service Name")),
        ("servicenumber+picon+servicename",
         _("Service Number, Picon and Service Name"))
    ]

    singleBrowseModeChoices = [("currentservice", _("Select current service")),
                               ("lastepgservice",
                                _("Select last browsed service"))]

    multiBrowseModeChoices = [
        ("currentservice", _("Select current service")),
        ("firstservice", _("Select first service in bouquet")),
        ("lastepgservice", _("Select last browsed service"))
    ]

    config.epgselection.infobar = ConfigSubsection()
    config.epgselection.infobar.browse_mode = ConfigSelection(
        default="currentservice", choices=singleBrowseModeChoices)
    config.epgselection.infobar.type_mode = ConfigSelection(
        default="graphics",
        choices=[("text", _("Text Grid EPG")),
                 ("graphics", _("Graphics Grid EPG")),
                 ("single", _("Single EPG"))])
    if SystemInfo.get("NumVideoDecoders", 1) > 1:
        config.epgselection.infobar.preview_mode = ConfigSelection(choices=[
            ("0", _("Disabled")), ("1", _("Full screen")), ("2", _("PiP"))
        ],
                                                                   default="1")
    else:
        config.epgselection.infobar.preview_mode = ConfigSelection(choices=[
            ("0", _("Disabled")), ("1", _("Full screen"))
        ],
                                                                   default="1")
    choices = [(0, _("Use skin default"))] + [(i, _("%d") % i)
                                              for i in range(1, 5)]
    config.epgselection.infobar.itemsperpage = ConfigSelection(default=0,
                                                               choices=choices)
    config.epgselection.infobar.roundto = ConfigSelection(
        default="15",
        choices=[("15", _("%d minutes") % 15), ("30", _("%d minutes") % 30),
                 ("60", _("%d minutes") % 60)])
    config.epgselection.infobar.prevtimeperiod = ConfigSelection(
        default="180",
        choices=[
            ("60", _("%d minutes") % 60), ("90", _("%d minutes") % 90),
            ("120", _("%d minutes") % 120), ("150", _("%d minutes") % 150),
            ("180", _("%d minutes") % 180), ("210", _("%d minutes") % 210),
            ("240", _("%d minutes") % 240), ("270", _("%d minutes") % 270),
            ("300", _("%d minutes") % 300)
        ])
    config.epgselection.infobar.primetime = ConfigClock(default=20 * 60)
    config.epgselection.infobar.servicetitle_mode = ConfigSelection(
        default="servicename", choices=serviceTitleChoices)
    config.epgselection.infobar.servfs = ConfigSelectionNumber(default=0,
                                                               stepwidth=1,
                                                               min=-8,
                                                               max=10,
                                                               wraparound=True)
    config.epgselection.infobar.eventfs = ConfigSelectionNumber(
        default=0, stepwidth=1, min=-8, max=10, wraparound=True)
    config.epgselection.infobar.timelinefs = ConfigSelectionNumber(
        default=0, stepwidth=1, min=-8, max=10, wraparound=True)
    config.epgselection.infobar.timeline24h = ConfigYesNo(default=True)
    config.epgselection.infobar.servicewidth = ConfigSelectionNumber(
        default=250, stepwidth=1, min=70, max=500, wraparound=True)
    config.epgselection.infobar.piconwidth = ConfigSelectionNumber(
        default=100, stepwidth=1, min=50, max=500, wraparound=True)
    config.epgselection.infobar.infowidth = ConfigSelectionNumber(
        default=50, stepwidth=25, min=0, max=150, wraparound=True)
    config.epgselection.infobar.btn_ok = ConfigSelection(choices=okActions,
                                                         default="zap")
    config.epgselection.infobar.btn_oklong = ConfigSelection(choices=okActions,
                                                             default="zapExit")
    config.epgselection.infobar.btn_epg = ConfigSelection(
        choices=infoActions, default="openSingleEPG")
    config.epgselection.infobar.btn_epglong = ConfigSelection(
        choices=infoActions, default="")
    config.epgselection.infobar.btn_info = ConfigSelection(
        choices=infoActions, default="openEventView")
    config.epgselection.infobar.btn_infolong = ConfigSelection(
        choices=infoActions, default="openSingleEPG")
    config.epgselection.infobar.btn_red = ConfigSelection(choices=epgActions,
                                                          default="openIMDb")
    config.epgselection.infobar.btn_redlong = ConfigSelection(
        choices=epgActions, default="sortEPG")
    config.epgselection.infobar.btn_green = ConfigSelection(
        choices=epgActions, default="addEditTimer")
    config.epgselection.infobar.btn_greenlong = ConfigSelection(
        choices=epgActions, default="openTimerList")
    config.epgselection.infobar.btn_yellow = ConfigSelection(
        choices=epgActions, default="openEPGSearch")
    config.epgselection.infobar.btn_yellowlong = ConfigSelection(
        choices=epgActions, default="")
    config.epgselection.infobar.btn_blue = ConfigSelection(
        choices=epgActions, default="addEditAutoTimer")
    config.epgselection.infobar.btn_bluelong = ConfigSelection(
        choices=epgActions, default="openAutoTimerList")
    config.epgselection.infobar.btn_rec = ConfigSelection(
        choices=recActions, default="addEditTimerMenu")
    config.epgselection.infobar.btn_reclong = ConfigSelection(
        choices=recActions, default="addEditZapTimerSilent")

    config.epgselection.single = ConfigSubsection()
    config.epgselection.single.browse_mode = ConfigSelection(
        default="currentservice", choices=singleBrowseModeChoices)
    config.epgselection.single.preview_mode = ConfigYesNo(default=True)
    config.epgselection.single.eventfs = ConfigSelectionNumber(default=0,
                                                               stepwidth=1,
                                                               min=-8,
                                                               max=10,
                                                               wraparound=True)
    choices = [(0, _("Use skin default"))] + [(i, _("%d") % i)
                                              for i in range(1, 41)]
    config.epgselection.single.itemsperpage = ConfigSelection(default=0,
                                                              choices=choices)
    config.epgselection.single.btn_red = ConfigSelection(choices=epgActions,
                                                         default="openIMDb")
    config.epgselection.single.btn_redlong = ConfigSelection(
        choices=epgActions, default="sortEPG")
    config.epgselection.single.btn_green = ConfigSelection(
        choices=epgActions, default="addEditTimer")
    config.epgselection.single.btn_greenlong = ConfigSelection(
        choices=epgActions, default="openTimerList")
    config.epgselection.single.btn_yellow = ConfigSelection(
        choices=epgActions, default="openEPGSearch")
    config.epgselection.single.btn_yellowlong = ConfigSelection(
        choices=epgActions, default="")
    config.epgselection.single.btn_blue = ConfigSelection(
        choices=epgActions, default="addEditAutoTimer")
    config.epgselection.single.btn_bluelong = ConfigSelection(
        choices=epgActions, default="openAutoTimerList")
    config.epgselection.single.btn_ok = ConfigSelection(choices=okActions,
                                                        default="zap")
    config.epgselection.single.btn_oklong = ConfigSelection(choices=okActions,
                                                            default="zapExit")
    config.epgselection.single.btn_epg = ConfigSelection(
        choices=infoActions, default="openSingleEPG")
    config.epgselection.single.btn_epglong = ConfigSelection(
        choices=infoActions, default="")
    config.epgselection.single.btn_info = ConfigSelection(
        choices=infoActions, default="openEventView")
    config.epgselection.single.btn_infolong = ConfigSelection(
        choices=infoActions, default="openSingleEPG")
    config.epgselection.single.btn_rec = ConfigSelection(
        choices=recActions, default="addEditTimerMenu")
    config.epgselection.single.btn_reclong = ConfigSelection(
        choices=recActions, default="addEditZapTimerSilent")

    config.epgselection.multi = ConfigSubsection()
    config.epgselection.multi.showbouquet = ConfigYesNo(default=False)
    config.epgselection.multi.browse_mode = ConfigSelection(
        default="currentservice", choices=multiBrowseModeChoices)
    config.epgselection.multi.preview_mode = ConfigYesNo(default=True)
    config.epgselection.multi.eventfs = ConfigSelectionNumber(default=0,
                                                              stepwidth=1,
                                                              min=-8,
                                                              max=10,
                                                              wraparound=True)
    choices = [(0, _("Use skin default"))] + [(i, _("%d") % i)
                                              for i in range(12, 41)]
    config.epgselection.multi.itemsperpage = ConfigSelection(default=0,
                                                             choices=choices)
    config.epgselection.multi.servicewidth = ConfigSelectionNumber(
        default=7, stepwidth=1, min=5, max=20, wraparound=True)
    config.epgselection.multi.btn_ok = ConfigSelection(choices=okActions,
                                                       default="zap")
    config.epgselection.multi.btn_oklong = ConfigSelection(choices=okActions,
                                                           default="zapExit")
    config.epgselection.multi.btn_epg = ConfigSelection(
        choices=infoActions, default="openSingleEPG")
    config.epgselection.multi.btn_epglong = ConfigSelection(
        choices=infoActions, default="")
    config.epgselection.multi.btn_info = ConfigSelection(
        choices=infoActions, default="openEventView")
    config.epgselection.multi.btn_infolong = ConfigSelection(
        choices=infoActions, default="openSingleEPG")
    config.epgselection.multi.btn_rec = ConfigSelection(
        choices=recActions, default="addEditTimerMenu")
    config.epgselection.multi.btn_reclong = ConfigSelection(
        choices=recActions, default="addEditZapTimerSilent")
    config.epgselection.multi.btn_red = ConfigSelection(choices=epgActions,
                                                        default="openIMDb")
    config.epgselection.multi.btn_redlong = ConfigSelection(choices=epgActions,
                                                            default="sortEPG")
    config.epgselection.multi.btn_green = ConfigSelection(
        choices=epgActions, default="addEditTimer")
    config.epgselection.multi.btn_greenlong = ConfigSelection(
        choices=epgActions, default="openTimerList")
    config.epgselection.multi.btn_yellow = ConfigSelection(
        choices=epgActions, default="openEPGSearch")
    config.epgselection.multi.btn_yellowlong = ConfigSelection(
        choices=epgActions, default="")
    config.epgselection.multi.btn_blue = ConfigSelection(
        choices=epgActions, default="addEditAutoTimer")
    config.epgselection.multi.btn_bluelong = ConfigSelection(
        choices=epgActions, default="openAutoTimerList")

    config.epgselection.grid = ConfigSubsection()
    config.epgselection.grid.showbouquet = ConfigYesNo(default=False)
    config.epgselection.grid.browse_mode = ConfigSelection(
        default="currentservice", choices=multiBrowseModeChoices)
    config.epgselection.grid.preview_mode = ConfigYesNo(default=True)
    config.epgselection.grid.type_mode = ConfigSelection(choices=[
        ("graphics", _("Graphics")), ("text", _("Text"))
    ],
                                                         default="graphics")
    config.epgselection.grid.highlight_current_events = ConfigYesNo(
        default=True)
    config.epgselection.grid.roundto = ConfigSelection(
        default="15",
        choices=[("15", _("%d minutes") % 15), ("30", _("%d minutes") % 30),
                 ("60", _("%d minutes") % 60)])
    config.epgselection.grid.prevtimeperiod = ConfigSelection(
        default="180",
        choices=[
            ("60", _("%d minutes") % 60), ("90", _("%d minutes") % 90),
            ("120", _("%d minutes") % 120), ("150", _("%d minutes") % 150),
            ("180", _("%d minutes") % 180), ("210", _("%d minutes") % 210),
            ("240", _("%d minutes") % 240), ("270", _("%d minutes") % 270),
            ("300", _("%d minutes") % 300)
        ])
    config.epgselection.grid.primetime = ConfigClock(default=20 * 60)
    config.epgselection.grid.servicetitle_mode = ConfigSelection(
        default="servicename", choices=serviceTitleChoices)
    possibleAlignmentChoices = [
        (str(RT_HALIGN_LEFT | RT_VALIGN_CENTER), _("left")),
        (str(RT_HALIGN_CENTER | RT_VALIGN_CENTER), _("centered")),
        (str(RT_HALIGN_RIGHT | RT_VALIGN_CENTER), _("right")),
        (str(RT_HALIGN_LEFT | RT_VALIGN_CENTER | RT_WRAP), _("left, wrapped")),
        (str(RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP),
         _("centered, wrapped")),
        (str(RT_HALIGN_RIGHT | RT_VALIGN_CENTER | RT_WRAP),
         _("right, wrapped"))
    ]
    config.epgselection.grid.servicename_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.servicenumber_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.event_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.timelinedate_alignment = ConfigSelection(
        default=possibleAlignmentChoices[0][0],
        choices=possibleAlignmentChoices)
    config.epgselection.grid.servfs = ConfigSelectionNumber(default=0,
                                                            stepwidth=1,
                                                            min=-8,
                                                            max=10,
                                                            wraparound=True)
    config.epgselection.grid.eventfs = ConfigSelectionNumber(default=0,
                                                             stepwidth=1,
                                                             min=-8,
                                                             max=10,
                                                             wraparound=True)
    config.epgselection.grid.timelinefs = ConfigSelectionNumber(
        default=0, stepwidth=1, min=-8, max=10, wraparound=True)
    config.epgselection.grid.timeline24h = ConfigYesNo(default=True)
    choices = [(0, _("Use skin default"))] + [(i, _("%d") % i)
                                              for i in range(3, 21)]
    config.epgselection.grid.itemsperpage = ConfigSelection(default=0,
                                                            choices=choices)
    config.epgselection.grid.pig = ConfigYesNo(default=True)
    config.epgselection.grid.heightswitch = NoSave(ConfigYesNo(default=False))
    config.epgselection.grid.servicewidth = ConfigSelectionNumber(
        default=250, stepwidth=1, min=70, max=500, wraparound=True)
    config.epgselection.grid.piconwidth = ConfigSelectionNumber(
        default=100, stepwidth=1, min=50, max=500, wraparound=True)
    config.epgselection.grid.infowidth = ConfigSelectionNumber(default=50,
                                                               stepwidth=25,
                                                               min=0,
                                                               max=150,
                                                               wraparound=True)
    config.epgselection.grid.rec_icon_height = ConfigSelection(
        choices=[("bottom", _("bottom")), ("top", _("top")),
                 ("middle", _("middle")), ("hide", _("hide"))],
        default="bottom")
    config.epgselection.grid.number_buttons_mode = ConfigSelection(
        choices=[("paging", _("Standard")),
                 ("service", _("Enter service number"))],
        default="paging")
    config.epgselection.grid.btn_ok = ConfigSelection(choices=okActions,
                                                      default="zap")
    config.epgselection.grid.btn_oklong = ConfigSelection(choices=okActions,
                                                          default="zapExit")
    config.epgselection.grid.btn_epg = ConfigSelection(choices=infoActions,
                                                       default="openSingleEPG")
    config.epgselection.grid.btn_epglong = ConfigSelection(choices=infoActions,
                                                           default="")
    config.epgselection.grid.btn_info = ConfigSelection(
        choices=infoActions, default="openEventView")
    config.epgselection.grid.btn_infolong = ConfigSelection(
        choices=infoActions, default="openSingleEPG")
    config.epgselection.grid.btn_rec = ConfigSelection(
        choices=recActions, default="addEditTimerMenu")
    config.epgselection.grid.btn_reclong = ConfigSelection(
        choices=recActions, default="addEditZapTimerSilent")
    config.epgselection.grid.btn_channelup = ConfigSelection(
        choices=channelUpActions, default="forward24Hours")
    config.epgselection.grid.btn_channeldown = ConfigSelection(
        choices=channelDownActions, default="back24Hours")
    config.epgselection.grid.btn_red = ConfigSelection(choices=epgActions,
                                                       default="openIMDb")
    config.epgselection.grid.btn_redlong = ConfigSelection(choices=epgActions,
                                                           default="sortEPG")
    config.epgselection.grid.btn_green = ConfigSelection(
        choices=epgActions, default="addEditTimer")
    config.epgselection.grid.btn_greenlong = ConfigSelection(
        choices=epgActions, default="openTimerList")
    config.epgselection.grid.btn_yellow = ConfigSelection(
        choices=epgActions, default="openEPGSearch")
    config.epgselection.grid.btn_yellowlong = ConfigSelection(
        choices=epgActions, default="")
    config.epgselection.grid.btn_blue = ConfigSelection(
        choices=epgActions, default="addEditAutoTimer")
    config.epgselection.grid.btn_bluelong = ConfigSelection(
        choices=epgActions, default="openAutoTimerList")
Exemplo n.º 48
0
    def __init__(self, session):
        Screen.__init__(self, session)

        # Summary
        self.setup_title = _("EPGRefresh Configuration")
        self.onChangedEntry = []

        # Although EPGRefresh keeps services in a Set we prefer a list
        self.services = ([x for x in epgrefresh.services[0]],
                         [x for x in epgrefresh.services[1]])

        self.list = [
            getConfigListEntry(
                _("Refresh EPG automatically"),
                config.plugins.epgrefresh.enabled,
                _("Unless this is enabled, EPGRefresh won't automatically run but needs to be explicitly started by the yellow button in this menu."
                  )),
            getConfigListEntry(
                _("Show in extension menu"),
                config.plugins.epgrefresh.show_in_extensionsmenu,
                _("Enable this to be able to access the EPGRefresh configuration from within the extension menu."
                  )),
            getConfigListEntry(
                _("Show popup when refresh starts and ends"),
                config.plugins.epgrefresh.enablemessage,
                _("This setting controls whether or not an informational message will be shown at start and completion of refresh."
                  )),
            getConfigListEntry(
                _("Wake up from deep standby for EPG refresh"),
                config.plugins.epgrefresh.wakeup,
                _("If this is enabled, the plugin will wake up the receiver from deep standby if possible. Otherwise it needs to be switched on already."
                  )),
            getConfigListEntry(
                _("Duration to stay on service-channels (minutes)"),
                config.plugins.epgrefresh.interval,
                _("This is the duration each service/channel will stay active during a refresh."
                  )),
            getConfigListEntry(
                _("EPG refresh auto-start earliest (hh:mm)"),
                config.plugins.epgrefresh.begin,
                _("An automated refresh will start after this time of day, but before the time specified in next setting."
                  )),
            getConfigListEntry(
                _("EPG refresh auto-start latest (hh:mm)"),
                config.plugins.epgrefresh.end,
                _("An automated refresh will start before this time of day, but after the time specified in previous setting."
                  )),
            getConfigListEntry(
                _("Delay if not in standby (minutes)"),
                config.plugins.epgrefresh.delay_standby,
                _("If the receiver currently isn't in standby, this is the duration which EPGRefresh will wait before retry."
                  )),
            getConfigListEntry(
                _("Force scan even if receiver is in use"),
                config.plugins.epgrefresh.force,
                _("This setting controls whether or not the refresh will be initiated even though the receiver is active (either not in standby or currently recording)."
                  )),
            getConfigListEntry(
                _("Shutdown after EPG refresh"),
                config.plugins.epgrefresh.afterevent,
                _("This setting controls whether the receiver should be set to deep standby after refresh is completed."
                  )),
        ]
        if SystemInfo.get("NumVideoDecoders", 1) > 1:
            self.list.insert(
                3,
                getConfigListEntry(
                    _("Refresh EPG using"), config.plugins.epgrefresh.adapter,
                    _("If you want to refresh the EPG in background, you can choose the method which best suits your needs here, e.g. hidden, fake reocrding or regular Picture in Picture."
                      )))

        try:
            # try to import autotimer module to check for its existence
            from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer

            self.list.append(
                getConfigListEntry(
                    _("Inherit Services from AutoTimer"),
                    config.plugins.epgrefresh.inherit_autotimer,
                    _("Extend the list of services to refresh by those your AutoTimers use?"
                      )))
            self.list.append(
                getConfigListEntry(
                    _("Run AutoTimer after refresh"),
                    config.plugins.epgrefresh.parse_autotimer,
                    _("After a successful refresh the AutoTimer will automatically search for new matches if this is enabled."
                      )))
        except ImportError, ie:
            print "[EPGRefresh] AutoTimer Plugin not installed:", ie
Exemplo n.º 49
0
    def __init__(self, session):
        Screen.__init__(self, session)

        # Summary
        self.setup_title = _("EPGRefresh Configuration")
        self.onChangedEntry = []

        # Although EPGRefresh keeps services in a Set we prefer a list
        self.services = ([x for x in epgrefresh.services[0]],
                         [x for x in epgrefresh.services[1]])

        self.list = [
            getConfigListEntry(
                _("Refresh EPG automatically"),
                config.plugins.epgrefresh.enabled,
                _("Unless this is enabled, EPGRefresh won't automatically run but needs to be explicitly started by the yellow button in this menu."
                  )),
            getConfigListEntry(
                _("Show in extension menu"),
                config.plugins.epgrefresh.show_in_extensionsmenu,
                _("Enable this to be able to access the EPGRefresh configuration from within the extension menu."
                  )),
            getConfigListEntry(
                _("Show popup when refresh starts and ends"),
                config.plugins.epgrefresh.enablemessage,
                _("This setting controls whether or not an informational message will be shown at start and completion of refresh."
                  )),
            getConfigListEntry(
                _("Wake up from deep standby for EPG refresh"),
                config.plugins.epgrefresh.wakeup,
                _("If this is enabled, the plugin will wake up the receiver from deep standby if possible. Otherwise it needs to be switched on already."
                  )),
            getConfigListEntry(
                _("Duration to stay on service-channels (minutes)"),
                config.plugins.epgrefresh.interval,
                _("This is the duration each service/channel will stay active during a refresh."
                  )),
            getConfigListEntry(
                _("EPG refresh auto-start earliest (hh:mm)"),
                config.plugins.epgrefresh.begin,
                _("An automated refresh will start after this time of day, but before the time specified in next setting."
                  )),
            getConfigListEntry(
                _("EPG refresh auto-start latest (hh:mm)"),
                config.plugins.epgrefresh.end,
                _("An automated refresh will start before this time of day, but after the time specified in previous setting."
                  )),
            getConfigListEntry(
                _("Delay if not in standby (minutes)"),
                config.plugins.epgrefresh.delay_standby,
                _("If the receiver currently isn't in standby, this is the duration which EPGRefresh will wait before retry."
                  )),
            getConfigListEntry(
                _("Force scan even if receiver is in use"),
                config.plugins.epgrefresh.force,
                _("This setting controls whether or not the refresh will be initiated even though the receiver is active (either not in standby or currently recording)."
                  )),
            getConfigListEntry(
                _("Shutdown after EPG refresh"),
                config.plugins.epgrefresh.afterevent,
                _("This setting controls whether the receiver should be set to deep standby after refresh is completed."
                  )),
        ]
        if SystemInfo.get("NumVideoDecoders", 1) > 1:
            self.list.insert(
                3,
                getConfigListEntry(
                    _("Refresh EPG using"), config.plugins.epgrefresh.adapter,
                    _("If you want to refresh the EPG in background, you can choose the method which best suits your needs here, e.g. hidden, fake reocrding or regular Picture in Picture."
                      )))

        try:
            # try to import autotimer module to check for its existence
            from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer

            self.list.append(
                getConfigListEntry(
                    _("Inherit Services from AutoTimer"),
                    config.plugins.epgrefresh.inherit_autotimer,
                    _("Extend the list of services to refresh by those your AutoTimers use?"
                      )))
            self.list.append(
                getConfigListEntry(
                    _("Run AutoTimer after refresh"),
                    config.plugins.epgrefresh.parse_autotimer,
                    _("After a successful refresh the AutoTimer will automatically search for new matches if this is enabled."
                      )))
        except ImportError as ie:
            print("[EPGRefresh] AutoTimer Plugin not installed:", ie)

        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changed)

        def selectionChanged():
            if self["config"].current:
                self["config"].current[1].onDeselect(self.session)
            self["config"].current = self["config"].getCurrent()
            if self["config"].current:
                self["config"].current[1].onSelect(self.session)
            for x in self["config"].onSelectionChanged:
                x()

        self["config"].selectionChanged = selectionChanged
        self["config"].onSelectionChanged.append(self.updateHelp)

        # Initialize Buttons
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_yellow"] = StaticText(_("Refresh now"))
        self["key_blue"] = StaticText(_("Edit Services"))

        self["help"] = StaticText()

        # Define Actions
        self["actions"] = ActionMap(
            [
                "SetupActions", "ColorActions", "ChannelSelectEPGActions",
                "HelpActions"
            ], {
                "cancel": self.keyCancel,
                "save": self.keySave,
                "yellow": self.forceRefresh,
                "blue": self.editServices,
                "showEPGList": self.keyInfo,
                "displayHelp": self.showHelp,
            })

        # Trigger change
        self.changed()

        self.onLayoutFinish.append(self.setCustomTitle)
        self.onFirstExecBegin.append(self.firstExec)
Exemplo n.º 50
0
class MediaPlayer(Screen, InfoBarBase, InfoBarScreenSaver, InfoBarSeek, InfoBarAudioSelection, InfoBarCueSheetSupport, InfoBarNotifications, InfoBarSubtitleSupport, InfoBarAspectSelection, HelpableScreen):
	ALLOW_SUSPEND = True
	ENABLE_RESUME_SUPPORT = True
	FLAG_CENTER_DVB_SUBS = 2048

	def __init__(self, session, args = None):
		Screen.__init__(self, session)
		InfoBarAudioSelection.__init__(self)
		InfoBarCueSheetSupport.__init__(self, actionmap = "MediaPlayerCueSheetActions")
		InfoBarNotifications.__init__(self)
		InfoBarBase.__init__(self)
		InfoBarScreenSaver.__init__(self)
		InfoBarSubtitleSupport.__init__(self)
		InfoBarAspectSelection.__init__(self)
		HelpableScreen.__init__(self)
		self.summary = None
		self.oldService = self.session.nav.getCurrentlyPlayingServiceOrGroup()
		self.session.nav.stopService()

		self.setTitle(_("Media player"))

		self.playlistparsers = {}
		self.addPlaylistParser(PlaylistIOM3U, "m3u")
		self.addPlaylistParser(PlaylistIOPLS, "pls")
		self.addPlaylistParser(PlaylistIOInternal, "e2pls")

		# 'None' is magic to start at the list of mountpoints
		defaultDir = config.mediaplayer.defaultDir.getValue()
		self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(dts|mp3|wav|wave|wv|oga|ogg|flac|m4a|mp2|m2a|wma|ac3|mka|aac|ape|alac|mpg|vob|m4v|mkv|avi|divx|dat|flv|mp4|mov|wmv|asf|3gp|3g2|mpeg|mpe|rm|rmvb|ogm|ogv|m2ts|mts|ts|m3u|e2pls|pls|amr|au|mid|pva|wtv)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
		self["filelist"] = self.filelist

		self.playlist = MyPlayList()
		self.is_closing = False
		self.delname = ""
		self.playlistname = ""
		self["playlist"] = self.playlist

		self["PositionGauge"] = ServicePositionGauge(self.session.nav)

		self["currenttext"] = Label("")

		self["artisttext"] = Label(_("Artist")+':')
		self["artist"] = Label("")
		self["titletext"] = Label(_("Title")+':')
		self["title"] = Label("")
		self["albumtext"] = Label(_("Album")+':')
		self["album"] = Label("")
		self["yeartext"] = Label(_("Year")+':')
		self["year"] = Label("")
		self["genretext"] = Label(_("Genre")+':')
		self["genre"] = Label("")
		self["coverArt"] = MediaPixmap()
		self["repeat"] = MultiPixmap()

		self.seek_target = None

		try:
			from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
			hotplugNotifier.append(self.hotplugCB)
		except Exception, ex:
			print "[MediaPlayer] No hotplug support", ex

		class MoviePlayerActionMap(NumberActionMap):
			def __init__(self, player, contexts = [ ], actions = { }, prio=0):
				NumberActionMap.__init__(self, contexts, actions, prio)
				self.player = player

			def action(self, contexts, action):
				self.player.show()
				return NumberActionMap.action(self, contexts, action)

		self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
			{
				"ok": (self.ok, _("Add file to playlist")),
				"cancel": (self.exit, _("Exit mediaplayer")),
			}, -2)

		self["MediaPlayerActions"] = HelpableActionMap(self, "MediaPlayerActions",
			{
				"play": (self.xplayEntry, _("Play entry")),
				"pause": (self.pauseEntry, _("Pause")),
				"stop": (self.stopEntry, _("Stop entry")),
				"previous": (self.previousMarkOrEntry, _("Play from previous mark or playlist entry")),
				"next": (self.nextMarkOrEntry, _("Play from next mark or playlist entry")),
				"menu": (self.showMenu, _("Menu")),
				"skipListbegin": (self.skip_listbegin, _("Jump to beginning of list")),
				"skipListend": (self.skip_listend, _("Jump to end of list")),
				"prevBouquet": (self.prevBouquet, self.prevBouquetHelpText),
				"nextBouquet": (self.nextBouquet, self.nextBouquetHelptext),
				"delete": (self.deletePlaylistEntry, _("Delete playlist entry")),
				"shift_stop": (self.clear_playlist, _("Clear playlist")),
				"shift_record": (self.playlist.PlayListShuffle, _("Shuffle playlist")),
				"subtitles": (self.subtitleSelection, _("Subtitle selection")),
			}, -2)

		self["InfobarEPGActions"] = HelpableActionMap(self, "InfobarEPGActions",
			{
				"showEventInfo": (self.showEventInformation, _("show event details")),
			})

		self["actions"] = MoviePlayerActionMap(self, ["DirectionActions"],
		{
			"right": self.rightDown,
			"rightRepeated": self.doNothing,
			"rightUp": self.rightUp,
			"left": self.leftDown,
			"leftRepeated": self.doNothing,
			"leftUp": self.leftUp,

			"up": self.up,
			"upRepeated": self.up,
			"upUp": self.doNothing,
			"down": self.down,
			"downRepeated": self.down,
			"downUp": self.doNothing,
		}, -2)

		InfoBarSeek.__init__(self, actionmap = "MediaPlayerSeekActions")

		self.mediaPlayerInfoBar = self.session.instantiateDialog(MediaPlayerInfoBar)

		self.onClose.append(self.delMPTimer)
		self.onClose.append(self.__onClose)
		self.onShow.append(self.timerHideMediaPlayerInfoBar)

		self.righttimer = False
		self.rightKeyTimer = eTimer()
		self.rightKeyTimer.callback.append(self.rightTimerFire)

		self.lefttimer = False
		self.leftKeyTimer = eTimer()
		self.leftKeyTimer.callback.append(self.leftTimerFire)

		self.hideMediaPlayerInfoBar = eTimer()
		self.hideMediaPlayerInfoBar.callback.append(self.timerHideMediaPlayerInfoBar)

		self.currList = "filelist"
		self.isAudioCD = False
		self.ext = None
		self.AudioCD_albuminfo = {}
		self.cdAudioTrackFiles = []
		self.onShown.append(self.applySettings)

		self.playlistIOInternal = PlaylistIOInternal()
		list = self.playlistIOInternal.open(resolveFilename(SCOPE_CONFIG, "playlist.e2pls"))
		if list:
			for x in list:
				self.playlist.addFile(x.ref)
			self.playlist.updateList()

		self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
			{
				iPlayableService.evUpdatedInfo: self.__evUpdatedInfo,
				iPlayableService.evUser+10: self.__evAudioDecodeError,
				iPlayableService.evUser+11: self.__evVideoDecodeError,
				iPlayableService.evUser+12: self.__evPluginError,
				iPlayableService.evUser+13: self["coverArt"].embeddedCoverArt
			})

		self.servicelist = None
		self.pipZapAvailable = False
		if InfoBar.instance is not None:
			self.servicelist = InfoBar.instance.servicelist
			if self.servicelist and hasattr(self.servicelist, 'dopipzap'):
				self.pipZapAvailable = SystemInfo.get("NumVideoDecoders", 1) > 1
Exemplo n.º 51
0
    def addItems(self, listItems, parentNode):
        for x in parentNode:
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                item_tunerlevel = int(x.get("tunerlevel", 0))
                item_rectunerlevel = int(x.get("rectunerlevel", 0))
                item_tuxtxtlevel = int(x.get("tt_level", 0))

                if not self.onNotifiers:
                    self.onNotifiers.append(self.levelChanged)
                    self.onClose.append(self.removeNotifier)

                if item_level > config.usage.setup_level.index:
                    continue
                if (item_tuxtxtlevel
                        == 1) and (config.usage.tuxtxt_font_and_res.value !=
                                   "expert_mode"):
                    continue
                if item_tunerlevel == 1 and not config.usage.frontend_priority.value in (
                        "expert_mode", "experimental_mode"):
                    continue
                if item_tunerlevel == 2 and not config.usage.frontend_priority.value == "experimental_mode":
                    continue
                if item_rectunerlevel == 1 and not config.usage.recording_frontend_priority.value in (
                        "expert_mode", "experimental_mode"):
                    continue
                if item_rectunerlevel == 2 and not config.usage.recording_frontend_priority.value == "experimental_mode":
                    continue

                requires = x.get("requires")
                if requires:
                    meets = True
                    for requires in requires.split(';'):
                        negate = requires.startswith('!')
                        if negate:
                            requires = requires[1:]
                        if requires.startswith('config.'):
                            try:
                                item = eval(requires)
                                SystemInfo[
                                    requires] = True if item.value and item.value not in (
                                        "0", "False", "false",
                                        "off") else False
                            except AttributeError:
                                print(
                                    '[Setup] unknown "requires" config element:',
                                    requires)

                        if requires:
                            if not SystemInfo.get(requires, False):
                                if not negate:
                                    meets = False
                                    break
                            else:
                                if negate:
                                    meets = False
                                    break
                    if not meets:
                        continue

                if self.PluginLanguageDomain:
                    item_text = dgettext(self.PluginLanguageDomain,
                                         six.ensure_str(x.get("text", "??")))
                    item_description = dgettext(
                        self.PluginLanguageDomain,
                        six.ensure_str(x.get("description", " ")))
                else:
                    item_text = _(six.ensure_str(x.get("text", "??")))
                    item_description = _(
                        six.ensure_str(x.get("description", " ")))

                item_text = item_text.replace(
                    "%s %s", "%s %s" % (getMachineBrand(), getMachineName()))
                item_description = item_description.replace(
                    "%s %s", "%s %s" % (getMachineBrand(), getMachineName()))
                b = eval(x.text or "")
                if b == "":
                    continue
                #add to configlist
                item = b
                # the first b is the item itself, ignored by the configList.
                # the second one is converted to string.
                if not isinstance(item, ConfigNothing):
                    listItems.append((item_text, item, item_description))
Exemplo n.º 52
0
    def _getConfig(self):
        # Name, configElement, HelpTxt, reloadConfig
        self.list = []
        self.list.append(
            getConfigListEntry(
                _("Refresh EPG automatically"),
                config.plugins.epgrefresh.enabled,
                _("Unless this is enabled, EPGRefresh won't automatically run but needs to be explicitly started by the yellow button in this menu."
                  ), True))
        if config.plugins.epgrefresh.enabled.value:
            # temporary until new mode is successfully tested
            self.list.append(
                getConfigListEntry(
                    _("Use time-based duration to stay on service"),
                    config.plugins.epgrefresh.usetimebased,
                    _("Duration to stay can be automatically detected by enigma2 or manually set by the user"
                      ), True))
            if config.plugins.epgrefresh.usetimebased.value:
                self.list.append(
                    getConfigListEntry(
                        _("Duration to stay on service (seconds)"),
                        config.plugins.epgrefresh.interval_seconds,
                        _("This is the duration each service/channel will stay active during a refresh."
                          ), False))
            self.list.append(
                getConfigListEntry(
                    _("EPG refresh auto-start earliest (hh:mm)"),
                    config.plugins.epgrefresh.begin,
                    _("An automated refresh will start after this time of day, but before the time specified in next setting."
                      ), False))
            self.list.append(
                getConfigListEntry(
                    _("EPG refresh auto-start latest (hh:mm)"),
                    config.plugins.epgrefresh.end,
                    _("An automated refresh will start before this time of day, but after the time specified in previous setting."
                      ), False))
            self.list.append(
                getConfigListEntry(
                    _("Delay if not in standby (minutes)"),
                    config.plugins.epgrefresh.delay_standby,
                    _("If the receiver currently isn't in standby, this is the duration which EPGRefresh will wait before retry."
                      ), False))
            if SystemInfo.get("NumVideoDecoders", 1) > 1:
                self.list.append(
                    getConfigListEntry(
                        _("Refresh EPG using"),
                        config.plugins.epgrefresh.adapter,
                        _("If you want to refresh the EPG in background, you can choose the method which best suits your needs here, e.g. hidden, fake reocrding or regular Picture in Picture."
                          ), False))
            self.list.append(
                getConfigListEntry(
                    _("Show Advanced Options"),
                    NoSave(config.plugins.epgrefresh.showadvancedoptions),
                    _("Display more Options"), True))
            if config.plugins.epgrefresh.showadvancedoptions.value:
                if config.ParentalControl.configured.value and config.ParentalControl.servicepinactive.value:
                    self.list.append(
                        getConfigListEntry(
                            _("Skip protected Services"),
                            config.plugins.epgrefresh.skipProtectedServices,
                            _("Should protected services be skipped if refresh was started in interactive-mode?"
                              ), False))
                self.list.append(
                    getConfigListEntry(
                        _("Show Setup in extension menu"),
                        config.plugins.epgrefresh.show_in_extensionsmenu,
                        _("Enable this to be able to access the EPGRefresh configuration from within the extension menu."
                          ), False))
                self.list.append(
                    getConfigListEntry(
                        _("Show 'EPGRefresh Start now' in extension menu"),
                        config.plugins.epgrefresh.show_run_in_extensionsmenu,
                        _("Enable this to be able to start the EPGRefresh from within the extension menu."
                          ), False))
                self.list.append(
                    getConfigListEntry(
                        _("Show popup when refresh starts and ends"),
                        config.plugins.epgrefresh.enablemessage,
                        _("This setting controls whether or not an informational message will be shown at start and completion of refresh."
                          ), False))
                self.list.append(
                    getConfigListEntry(
                        _("Wake up from standby for EPG refresh"),
                        config.plugins.epgrefresh.wakeup,
                        _("If this is enabled, the plugin will wake up the receiver from standby if possible. Otherwise it needs to be switched on already."
                          ), False))
                self.list.append(
                    getConfigListEntry(
                        _("Force scan even if receiver is in use"),
                        config.plugins.epgrefresh.force,
                        _("This setting controls whether or not the refresh will be initiated even though the receiver is active (either not in standby or currently recording)."
                          ), False))
                self.list.append(
                    getConfigListEntry(
                        _("Shutdown after EPG refresh"),
                        config.plugins.epgrefresh.afterevent,
                        _("This setting controls whether the receiver should be set to standby after refresh is completed."
                          ), False))
                self.list.append(
                    getConfigListEntry(
                        _("Force save EPG.db"),
                        config.plugins.epgrefresh.epgsave,
                        _("If this is enabled, the Plugin save the epg.db /etc/enigma2/epg.db."
                          ), False))
                try:
                    # try to import autotimer module to check for its existence
                    from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer

                    self.list.append(
                        getConfigListEntry(
                            _("Inherit Services from AutoTimer"),
                            config.plugins.epgrefresh.inherit_autotimer,
                            _("Extend the list of services to refresh by those your AutoTimers use?"
                              ), True))
                    self.list.append(
                        getConfigListEntry(
                            _("Run AutoTimer after refresh"),
                            config.plugins.epgrefresh.parse_autotimer,
                            _("After a successful refresh the AutoTimer will automatically search for new matches if this is enabled. The options 'Ask*' has only affect on a manually refresh. If EPG-Refresh was called in background the default-Answer will be executed!"
                              ), False))
                except ImportError as ie:
                    print("[EPGRefresh] AutoTimer Plugin not installed:", ie)

        self["config"].list = self.list
        self["config"].setList(self.list)
Exemplo n.º 53
0
    dom_skins.append((mpath, xml.etree.cElementTree.parse(filename).getroot()))


# we do our best to always select the "right" value
# skins are loaded in order of priority: skin with
# highest priority is loaded last, usually the user-provided
# skin.

# currently, loadSingleSkinData (colors, bordersets etc.)
# are applied one-after-each, in order of ascending priority.
# the dom_skin will keep all screens in descending priority,
# so the first screen found will be used.

# example: loadSkin("nemesis_greenline/skin.xml")
from Components.SystemInfo import SystemInfo
DEFAULT_SKIN = SystemInfo.get(
    "DefaultFullHDSkin", False) and "Vu_HD_1080P/skin.xml" or "Vu_HD/skin.xml"

config.skin = ConfigSubsection()
config.skin.primary_skin = ConfigText(default=DEFAULT_SKIN)

profile("LoadSkin")
try:
    loadSkin('skin_user.xml', SCOPE_CONFIG)
except (SkinError, IOError, AssertionError), err:
    print "not loading user skin: ", err

try:
    loadSkin(config.skin.primary_skin.value)
except (SkinError, IOError, AssertionError), err:
    print "SKIN ERROR:", err
    print "defaulting to standard skin..."