def startActualUpgrade(self, answer):
		if not answer or not answer[1]:
			self.close()
			return
		if answer[1] == "cold":
			self.session.open(TryQuitMainloop,retvalue=42)
			self.close()
		elif answer[1] == "channels":
			self.channellist_only = 1
			self.slider.setValue(1)
			self.ipkg.startCmd(IpkgComponent.CMD_LIST, args = {'installed_only': True})
		elif answer[1] == "commits":
			self.session.openWithCallback(boundFunction(self.ipkgCallback, IpkgComponent.EVENT_DONE, None), CommitInfo)
		elif answer[1] == "disclaimer":
			self.showDisclaimer(justShow=True)
		elif answer[1] == "showlist":
			text = ""
			for i in [x[0] for x in sorted(self.ipkg.getFetchedList(), key=lambda d: d[0])]:
				text = text and text + "\n" + i or i
			self.session.openWithCallback(boundFunction(self.ipkgCallback, IpkgComponent.EVENT_DONE, None), TextBox, text, _("Packages to update"))
		elif answer[1] == "log":
			text = ""
			for i in open("/hdd/ipkgupgrade.log", "r").readlines():
				text += i
			self.session.openWithCallback(boundFunction(self.ipkgCallback, IpkgComponent.EVENT_DONE, None), TextBox, text, _("Packages to update"))
		else:
			self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args = {'test_only': False})
 def push(self, controller, subject, text="", attachments=[]):
     print "push"
     services = self.services
     if not services:
         # Fallback to PopUp
         module = self.servicemodules.get("PopUp", None)
         popup = self.instantiateModule(module)
         # Missing but not necessary: popup.begin() -> popup.push(...) -> popup.end()
         services = [popup]
     if services:
         for service in services:
             if service and service.getEnable():
                 try:
                     service.push(
                         boundFunction(self.pushcallback, service, controller),
                         boundFunction(self.pusherrback, service, controller),
                         controller.getName(),
                         subject,
                         text,
                         attachments,
                     )
                 except Exception, e:
                     print _("PushService Service push() exception")
                     exc_type, exc_value, exc_traceback = sys.exc_info()
                     traceback.print_exception(exc_type, exc_value, exc_traceback, file=sys.stdout)
Beispiel #3
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))
Beispiel #4
0
	def __init__(self, session, pin, pin_slot):
		Screen.__init__(self, session)
		self.skinName = ["ParentalControlChangePin", "Setup" ]
		self.setup_title = _("Enter pin code")
		self.onChangedEntry = [ ]

		self.slot = pin_slot
		self.pin = pin
		self.list = []
		self.pin1 = ConfigPIN(default = 0, censor = "*")
		self.pin2 = ConfigPIN(default = 0, censor = "*")
		self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
		self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
		self.list.append(getConfigListEntry(_("Enter PIN"), NoSave(self.pin1)))
		self.list.append(getConfigListEntry(_("Reenter PIN"), NoSave(self.pin2)))
		ConfigListScreen.__init__(self, self.list)

		self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions"],
		{
			"cancel": self.cancel,
			"red": self.cancel,
			"save": self.keyOK,
		}, -1)

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		self.onLayoutFinish.append(self.layoutFinished)
Beispiel #5
0
def filescan_open(items, session, **kwargs):
	if createSingleton(session) and ftpbrowser.ftpclient:
		from Screens.MessageBox import MessageBox
		from Tools.BoundFunction import boundFunction

		session.openWithCallback(
			boundFunction(filescan_open_connected, items, session, **kwargs),
			MessageBox,
			_("There already is an active connection.\nDo you want to abort it?"),
			type = MessageBox.TYPE_YESNO
		)
		return

	Len = len(items)
	if Len > 1:
		from Screens.ChoiceBox import ChoiceBox
		from Tools.BoundFunction import boundFunction

		session.openWithCallback(
			boundFunction(filescan_chosen, session),
			ChoiceBox,
			_("Which server do you want to connect to?"),
			[(item, item) for item in items]
		)
	elif Len:
		filescan_chosen(items[0])
Beispiel #6
0
	def __init__(self, *args, **kwargs):
		baseMethods.Menu__init__(self, *args, **kwargs) # using the base initializer saves us a few cycles
		HelpableScreen.__init__(self)
		self.skinName = "SortableMenu"
		self.setTitle(_("Main menu"))

		# XXX: not nice, but makes our life a little easier
		l = [(x[0], x[1], x[2], menuWeights.get(x, supportHiding=False), menuWeights.isHidden(x)) for x in self["menu"].list]
		l.sort(key=itemgetter(3))
		self["menu"] = SortableMenuList(l)
		self["key_blue"] = StaticText(_("hide entry"))

		self["DirectionActions"] = ActionMap(["DirectionActions"],
			{
				"left": boundFunction(self.doMove, self["menu"].pageUp),
				"right": boundFunction(self.doMove, self["menu"].pageDown),
				"up": boundFunction(self.doMove, self["menu"].up),
				"down": boundFunction(self.doMove, self["menu"].down),
			}, -1
		)

		self["MenuSortActions"] = HelpableActionMap(self, "MenuSortActions",
			{
				"ignore": lambda: None, # we need to overwrite some regular actions :-)
				"toggleSelection": (self.toggleSelection, _("toggle selection")),
				"selectEntry": (self.okbuttonClick, _("enter menu")),
				"hideEntry": (self.hideEntry, _("hide entry")),
			}, -1
		)
		self.selected = -1
	def __init__(self, session, *args):
		Screen.__init__(self, session)
		self.skinName = "SelectImage"
		self.session = session
		self.imagesList = None
		self.expanded = []
		self.setTitle(_("Select Multiboot"))
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("Reboot"))
		self["list"] = ChoiceList(list=[ChoiceEntryComponent('',((_("Retreiving image slots - Please wait...")), "Waiter"))])

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "KeyboardInputActions", "MenuActions"],
		{
			"ok": self.keyOk,
			"cancel": boundFunction(self.close, None),
			"red": boundFunction(self.close, None),
			"green": self.keyOk,
			"up": self.keyUp,
			"down": self.keyDown,
			"left": self.keyLeft,
			"right": self.keyRight,
			"upRepeated": self.keyUp,
			"downRepeated": self.keyDown,
			"leftRepeated": self.keyLeft,
			"rightRepeated": self.keyRight,
			"menu": boundFunction(self.close, True),
		}, -1)

		self.delay = eTimer()
		self.delay.callback.append(self.getImagesList)
		self.delay.start(0, True)
Beispiel #8
0
	def __init__(self, session):
		Screen.__init__(self, session)

		for btn in ("red","green","yellow","blue"):
			self["key_" + btn] = Button(" ")

		ConfigListScreen.__init__(self, [])
		self.defprofile = ConfigSelection([])
		self.updateConfigList()

		self.pfsList = []
		self["profiles"] = List(self.pfsList)
		self.updateProfileList()

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "ChannelSelectEPGActions"],
			{
				"cancel": self.keyExit,
				"ok": self.keyOk,
				"showEPGList": self.showExamples,
				"red": self.keyRed,
				"green": self.keyGreen,
				"yellow": boundFunction(self.moveEntry, -1),
				"blue": boundFunction(self.moveEntry, +1),
				"up": self.keyUp,
				"down": self.keyDown,
			}, -1)
		
		self.onClose.append(self.__closed)
		self.onLayoutFinish.append(self.__layoutFinished)
		self.onShown.append(self.updateButtonState)
		self.prev_ext_menu = config.plugins.VCS.ext_menu.value
Beispiel #9
0
	def isServicePlayable(self, ref, callback, session=None):
		if not config.ParentalControl.configured.value or not config.ParentalControl.servicepinactive.value:
			return True
		#Check if configuration has already been read or if the significant values have changed.
		#If true: read the configuration
		if self.configInitialized == False or self.storeServicePin != config.ParentalControl.storeservicepin.value:
			self.getConfigValues()
		service = ref.toCompareString()
		if (config.ParentalControl.type.value == LIST_WHITELIST and not self.whitelist.has_key(service)) or (config.ParentalControl.type.value == LIST_BLACKLIST and self.blacklist.has_key(service)):
			#Check if the session pin is cached
			if self.sessionPinCached == True:
				return True
			self.callback = callback
			#Someone started to implement different levels of protection. Seems they were never completed
			#I did not throw out this code, although it is of no use at the moment
			levelNeeded = 0
			if self.serviceLevel.has_key(service):
				levelNeeded = self.serviceLevel[service]
			pinList = self.getPinList()[:levelNeeded + 1]
			if not session:
				Notifications.AddNotificationParentalControl(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry = config.ParentalControl.retries.servicepin, pinList = pinList, service = ServiceReference(ref).getServiceName(), title = _("this service is protected by a parental control pin"), windowTitle = _("Parental control"))
			else:
				Notifications.RemovePopup("Parental control")
				if self.PinDlg:
					self.PinDlg.close()
				self.PinDlg = session.openWithCallback(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry = config.ParentalControl.retries.servicepin, pinList = pinList, service = ServiceReference(ref).getServiceName(), title = _("this service is protected by a parental control pin"), windowTitle = _("Parental control"))
			return False
		else:
			return True
Beispiel #10
0
	def isServicePlayable(self, ref, callback, session=None):
		self.session = session
		if not config.ParentalControl.servicepinactive.value:
			return True
		#Check if configuration has already been read or if the significant values have changed.
		#If true: read the configuration
		if self.storeServicePin != config.ParentalControl.storeservicepin.value:
			self.getConfigValues()
		service = ref.toCompareString()
		info = eServiceCenter.getInstance().info(ref)
		age = 0
		if service.startswith("1:") and service.rsplit(":", 1)[1].startswith("/"):
			refstr = info and info.getInfoString(ref, iServiceInformation.sServiceref)
			service = refstr and eServiceReference(refstr).toCompareString()
		elif int(config.ParentalControl.age.value):
			event = info and info.getEvent(ref)
			rating = event and event.getParentalData()
			age = rating and rating.getRating()
			age = age and age <= 15 and age + 3 or 0
		if (age and age >= int(config.ParentalControl.age.value)) or service and self.blacklist.has_key(service):
			#Check if the session pin is cached
			if self.sessionPinCached:
				return True
			self.callback = callback
			title = 'FROM BOUQUET "userbouquet.' in service and _("this bouquet is protected by a parental control pin") or _("this service is protected by a parental control pin")
			if session:
				Notifications.RemovePopup("Parental control")
				if self.PinDlg:
					self.PinDlg.close()
				self.PinDlg = session.openWithCallback(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control"), simple=False)
			else:
				Notifications.AddNotificationParentalControl(boundFunction(self.servicePinEntered, ref), PinInput, triesEntry=config.ParentalControl.retries.servicepin, pinList=self.getPinList(), service=ServiceReference(ref).getServiceName(), title=title, windowTitle=_("Parental control"))
			return False
		else:
			return True
Beispiel #11
0
	def finishedEdit(self, answer):
		if answer[0]:
			entry = answer[1]
			if entry.external_prev != entry.external:
				def removeEditTimer():
					entry.service_ref, entry.begin, entry.end, entry.external = entry.service_ref_prev, entry.begin_prev, entry.end_prev, entry.external_prev
					self.removeTimer(entry)
				def moveEditTimerError():
					entry.external = entry.external_prev
					self.onSelectionChanged()
				if entry.external:
					self.fallbackTimer.addTimer(entry, removeEditTimer, moveEditTimerError)
				else:
					newentry = createRecordTimerEntry(entry)
					entry.service_ref, entry.begin, entry.end = entry.service_ref_prev, entry.begin_prev, entry.end_prev
					self.fallbackTimer.removeTimer(entry, boundFunction(self.finishedAdd, (True, newentry)), moveEditTimerError)
			elif entry.external:
				self.fallbackTimer.editTimer(entry, self.onSelectionChanged)
			else:
				simulTimerList = self.session.nav.RecordTimer.record(entry)
				if simulTimerList is not None:
					for x in simulTimerList:
						if x.setAutoincreaseEnd(entry):
							self.session.nav.RecordTimer.timeChanged(x)
					simulTimerList = self.session.nav.RecordTimer.record(entry)
					if simulTimerList is not None:
						self.session.openWithCallback(boundFunction(self.finishedEdit, service_ref, begin, end), TimerSanityConflict, simulTimerList)
						return
					else:
						self.session.nav.RecordTimer.timeChanged(entry)
				self.onSelectionChanged()
	def __init__(self, session, pin, pinname):
		Screen.__init__(self, session)
		# for the skin: first try ParentalControlChangePin, then Setup, this allows individual skinning
		self.skinName = ["ParentalControlChangePin", "Setup" ]
		self.setup_title = _("Change pin code")
		self.onChangedEntry = [ ]

		self.pin = pin
		self.list = []
		self.pin1 = ConfigPIN(default = 1111, censor = "*")
		self.pin2 = ConfigPIN(default = 1112, censor = "*")
		self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
		self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
		self.list.append(getConfigListEntry(_("New PIN"), NoSave(self.pin1)))
		self.list.append(getConfigListEntry(_("Re-enter new PIN"), NoSave(self.pin2)))
		ConfigListScreen.__init__(self, self.list)
		ProtectedScreen.__init__(self)

		self["actions"] = NumberActionMap(["DirectionActions", "ColorActions", "OkCancelActions", "MenuActions"],
		{
			"cancel": self.keyCancel,
			"red": self.keyCancel,
			"save": self.keyOK,
			"menu": self.closeRecursive,
		}, -1)
		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		self.onLayoutFinish.append(self.layoutFinished)
Beispiel #13
0
	def openMenu(self):
		if self.movemode:
			# TRANSLATORS: there is no need to translate this string, as it was reused from e2 core
			moveString = _("disable move mode")
		else:
			# TRANSLATORS: there is no need to translate this string, as it was reused from e2 core
			moveString = _("enable move mode")

		list = [
			(moveString, self.toggleMoveMode),
			(_("move extensions"), boundFunction(self.openMover, PluginDescriptor.WHERE_EXTENSIONSMENU)),
			(_("move movie extensions"), boundFunction(self.openMover, PluginDescriptor.WHERE_MOVIELIST)),
			(_("move event extensions"), boundFunction(self.openMover, PluginDescriptor.WHERE_EVENTINFO)),
		]

		if fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/PluginHider/plugin.py")):
			list.insert(0, (_("hide selected plugin"), self.hidePlugin))

		if pluginSortHelp:
			list.insert(0, (_("Help"), boundFunction(pluginSortHelp.open, self.session)))

		self.session.openWithCallback(
			self.menuCallback,
			ChoiceBox,
			list = list,
		)
	def __init__(self, session):
		menu = [(_("General Help"), boundFunction(self.close, self.HELP_RETURN_MAINHELP)),
			(_("Key Help"), boundFunction(self.close, self.HELP_RETURN_KEYHELP)),
			(_("Cancel"), self.close)]

		FixedMenu.__init__(self, session, _("EPGRefresh Configuration Help"), menu)
		self.skinName = ["EPGRefreshConfigurationHelpContextMenu", "Menu" ]
Beispiel #15
0
	def __init__(self, *args, **kwargs):
		baseMethods.Menu__init__(self, *args, **kwargs) # using the base initializer saves us a few cycles
		HelpableScreen.__init__(self)
		self.skinName = "SortableMenu"

		# XXX: not nice, but makes our life a little easier
		l = [(x[0], x[1], x[2], menuWeights.get(x)) for x in self["menu"].list]
		l.sort(key=lambda x:x[3])
		self["menu"] = SortableMenuList(l)

		self["WizardActions"] = ActionMap(["WizardActions"],
			{
				"left": boundFunction(self.doMove, self["menu"].pageUp),
				"right": boundFunction(self.doMove, self["menu"].pageDown),
				"up": boundFunction(self.doMove, self["menu"].up),
				"down": boundFunction(self.doMove, self["menu"].down),
			}, -1
		)

		self["MenuSortActions"] = HelpableActionMap(self, "MenuSortActions",
			{
				"ignore": lambda: None, # we need to overwrite some regular actions :-)
				"toggleSelection": (self.toggleSelection, _("toggle selection")),
				"selectEntry": (self.okbuttonClick, _("enter menu")),
			}, -1
		)
		self.selected = -1
    def __init__(self, session, pin, pinname):
        Screen.__init__(self, session)
        # for the skin: first try ParentalControlChangePin, then Setup, this allows individual skinning
        self.skinName = ["ParentalControlChangePin", "Setup"]
        self.setup_title = _("Change pin code")
        self.onChangedEntry = []

        self.pin = pin
        self.list = []
        self.pin1 = ConfigPIN(default=1111, censor="*")
        self.pin2 = ConfigPIN(default=1112, censor="*")
        self.pin1.addEndNotifier(boundFunction(self.valueChanged, 1))
        self.pin2.addEndNotifier(boundFunction(self.valueChanged, 2))
        self.list.append(getConfigListEntry(_("New PIN"), NoSave(self.pin1)))
        self.list.append(getConfigListEntry(_("Reenter new PIN"), NoSave(self.pin2)))
        ConfigListScreen.__init__(self, self.list)
        # 		print "old pin:", pin
        # if pin.value != "aaaa":
        # self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList = [self.pin.value], title = _("please enter the old pin"), windowTitle = _("Change pin code")))
        ProtectedScreen.__init__(self)

        self["actions"] = NumberActionMap(
            ["DirectionActions", "ColorActions", "OkCancelActions"],
            {"cancel": self.cancel, "red": self.cancel, "save": self.keyOK},
            -1,
        )
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self.onLayoutFinish.append(self.layoutFinished)
Beispiel #17
0
 def getPluginList(self):
     list = []
     for p in plugins.getPlugins(where=PluginDescriptor.WHERE_EXTENSIONSMENU):
         if p.name != "ORF.at IPTV":
             list.append(
                 ((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None)
             )
     return list
Beispiel #18
0
 def getPluginList(self):
     list = []
     for p in plugins.getPlugins(where=PluginDescriptor.WHERE_EXTENSIONSMENU):
         if (p.name != _("P**n Center")) and (p.name != config.plugins.PornCenter.name.value):
             list.append(
                 ((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None)
             )
     return list
Beispiel #19
0
	def getPluginList(self):
		from Components.PluginComponent import plugins
		list = []
		for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU):
			if p.name != _('YouTube'):
				list.append(((boundFunction(self.getPluginName, p.name),
					boundFunction(self.runPlugin, p), lambda: True), None))
		return list
Beispiel #20
0
	def keyOk(self):
		if self["config"].getCurrent() == self.advancedSelectSatsEntry:
			conf = self.nimConfig.advanced.sat[int(self.nimConfig.advanced.sats.value)].userSatellitesList
			self.session.openWithCallback(boundFunction(self.updateConfUserSatellitesList, conf), SelectSatsEntryScreen, userSatlist=conf.value)
		elif self["config"].getCurrent() == self.selectSatsEntry:
			conf = self.nimConfig.userSatellitesList
			self.session.openWithCallback(boundFunction(self.updateConfUserSatellitesList, conf), SelectSatsEntryScreen, userSatlist=conf.value)
		else:
			self.keySave()
	def Ok(self):
		sel = self["list"].getCurrent()
		if sel and sel[1]:
			if len(sel[1])==3:#Device
				tstr = _("Are you sure want to create FlashExpander on\n%s\nPartition %d") % (sel[1][0].model(), sel[1][1])
				self.session.openWithCallback(boundFunction(self.__startFE_device,sel[1]), MessageBox, tstr)
			if len(sel[1])==2:#Server
				tstr = _("Are you sure want to create FlashExpander on \nServer: %s\nPath: %s") % (sel[1][0], sel[1][1])
				self.session.openWithCallback(boundFunction(self.__startFE_server,sel[1]), MessageBox, tstr)
	def createPictures(self, content):
		for entry in content:
			if entry[1]:
				image = entry[1].rsplit('/', 1)[1]
				if image not in self.pictures:
					image = os.path.join('/tmp/', image)
					downloadPage(entry[1], image)\
							.addCallback(boundFunction(self.downloadFinished, image))\
							.addErrback(boundFunction(self.downloadFailed, image))
Beispiel #23
0
    def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
        oldref = self.currentlyPlayingServiceOrGroup
        if ref and oldref and ref == oldref and not forceRestart:
            print "ignore request to play already running service(1)"
            return 1
        print "playing", ref and ref.toString()
        if ref is None:
            self.stopService()
            return 0
        from Components.ServiceEventTracker import InfoBarCount

        InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
        if not checkParentalControl or parentalControl.isServicePlayable(
            ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)
        ):
            if ref.flags & eServiceReference.isGroup:
                oldref = self.currentlyPlayingServiceReference or eServiceReference()
                playref = getBestPlayableServiceReference(ref, oldref)
                print "playref", playref
                if playref and oldref and playref == oldref and not forceRestart:
                    print "ignore request to play already running service(2)"
                    return 1
                if not playref:
                    alternativeref = getBestPlayableServiceReference(ref, eServiceReference(), True)
                    self.stopService()
                    if alternativeref and self.pnav and self.pnav.playService(alternativeref):
                        print "Failed to start", alternativeref
                    return 0
                elif checkParentalControl and not parentalControl.isServicePlayable(
                    playref, boundFunction(self.playService, checkParentalControl=False)
                ):
                    if (
                        self.currentlyPlayingServiceOrGroup
                        and InfoBarInstance
                        and InfoBarInstance.servicelist.servicelist.setCurrent(
                            self.currentlyPlayingServiceOrGroup, adjust
                        )
                    ):
                        self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
                    return 1
            else:
                playref = ref
            if self.pnav:
                self.pnav.stopService()
                self.currentlyPlayingServiceReference = playref
                self.currentlyPlayingServiceOrGroup = ref
                if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
                    self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()

                if self.pnav.playService(playref):
                    print "Failed to start", playref
                    self.currentlyPlayingServiceReference = None
                    self.currentlyPlayingServiceOrGroup = None
                return 0
        elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
            self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
        return 1
Beispiel #24
0
	def __init__(self, *args, **kwargs):
		self.movemode = False
		self.selected = -1
		if 'where' in kwargs:
			self.where = kwargs['where']
			del kwargs['where']
		else:
			self.where = PluginDescriptor.WHERE_PLUGINMENU

		OriginalPluginBrowser.__init__(self, *args, **kwargs)
		self.skinName = ["SortingPluginBrowser", "PluginBrowser"] # XXX: fallback is evil because it makes moving more confusing :P

		self["pluginlist"] = MyPluginList(self.list)

		self["yellow"] = Label()

		self["ColorActions"] = ActionMap(["ColorActions"],
			{
				"yellow": self.toggleMoveMode,
			}, -2
		)

		self["WizardActions"] = ActionMap(["WizardActions"],
			{
				"left": boundFunction(self.doMove, self["pluginlist"].pageUp),
				"right": boundFunction(self.doMove, self["pluginlist"].pageDown),
				"up": boundFunction(self.doMove, self["pluginlist"].up),
				"down": boundFunction(self.doMove, self["pluginlist"].down),
			}, -2
		)

		if self.where != PluginDescriptor.WHERE_PLUGINMENU:
			self.toggleMoveMode()
			self.onShow.append(self.setCustomTitle)
		else:
			self["NumberActions"] = NumberActionMap(["NumberActions"],
				{
					"1": self.keyNumberGlobal,
					"2": self.keyNumberGlobal,
					"3": self.keyNumberGlobal,
					"4": self.keyNumberGlobal,
					"5": self.keyNumberGlobal,
					"6": self.keyNumberGlobal,
					"7": self.keyNumberGlobal,
					"8": self.keyNumberGlobal,
					"9": self.keyNumberGlobal,
					"0": self.keyNumberGlobal,
				}, -2
			)

			self["MenuActions"] = ActionMap(["MenuActions"],
				{
					"menu": self.openMenu,
				}, -1
			)
		self.onFirstExecBegin.append(self.firstExec)
	def __init__(self, session):
		if epgrefresh.isRunning():
			menu = [(_("Stop running refresh"), boundFunction(self.close, self.FUNCTION_RETURN_STOPREFRESH)),
				(_("Pending Services"), boundFunction(self.close, self.FUNCTION_RETURN_SHOWPENDING))]
		else:
			menu = [(_("Refresh now"), boundFunction(self.close, self.FUNCTION_RETURN_FORCEREFRESH))]
		menu.append((_("Cancel"), self.close))

		FixedMenu.__init__(self, session, _("EPGRefresh Functions"), menu)
		self.skinName = ["EPGRefreshConfigurationFunctionContextMenu", "Menu" ]
Beispiel #26
0
	def __init__(self, session, csel, service):
		Screen.__init__(self, session)
		self.csel = csel
		self.service = service

		self["actions"] = ActionMap(["OkCancelActions"],
			{
				"ok": self.okbuttonClick,
				"cancel": self.cancelClick
			})

		menu = [(_("delete..."), self.delete)]
		menu.extend([(p.description, boundFunction(self.execPlugin, p)) for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST)])

		if config.movielist.moviesort.value == MovieList.SORT_ALPHANUMERIC:
			menu.append((_("sort by date"), boundFunction(self.sortBy, MovieList.SORT_RECORDED)))
		else:
			menu.append((_("alphabetic sort"), boundFunction(self.sortBy, MovieList.SORT_ALPHANUMERIC)))
		
		menu.extend((
			(_("list style default"), boundFunction(self.listType, MovieList.LISTTYPE_ORIGINAL)),
			(_("list style compact with description"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT_DESCRIPTION)),
			(_("list style compact"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT)),
			(_("list style single line"), boundFunction(self.listType, MovieList.LISTTYPE_MINIMAL))
		))

		if config.movielist.description.value == MovieList.SHOW_DESCRIPTION:
			menu.append((_("hide extended description"), boundFunction(self.showDescription, MovieList.HIDE_DESCRIPTION)))
		else:
			menu.append((_("show extended description"), boundFunction(self.showDescription, MovieList.SHOW_DESCRIPTION)))
		self["menu"] = MenuList(menu)
Beispiel #27
0
    def __init__(self, session, playlistCallback, nextItemCallback, prevItemCallback, infoCallback, menuCallback):
        Screen.__init__(self, session)
        self.skinName = ['KodiVideoPlayer', 'MoviePlayer']
        statusScreen = self.session.instantiateDialog(StatusScreen)
        InfoBarBase.__init__(self, steal_current_service=True)
        SubsSupport.__init__(self, searchSupport=True, embeddedSupport=True)
        SubsSupportStatus.__init__(self)
        InfoBarSeek.__init__(self)
        InfoBarShowHide.__init__(self)
        InfoBarSubservicesSupport.__init__(self)
        InfoBarAspectChange.__init__(self)
        InfoBarAudioSelection.__init__(self)
        InfoBarNotifications.__init__(self)
        HelpableScreen.__init__(self)
        self.playlistCallback = playlistCallback
        self.nextItemCallback = nextItemCallback
        self.prevItemCallback = prevItemCallback
        self.infoCallback = infoCallback
        self.menuCallback = menuCallback
        self.statusScreen = statusScreen
        self.defaultImage = None
        self.postAspectChange.append(self.showAspectChanged)
        self.__timer = eTimer()
        self.__timer.callback.append(self.__seekToPosition)
        self.__image = None
        self.__position = None
        self.__firstStart = True
        self["image"] = WebPixmap(self.defaultImage, caching=False)
        self["directionActions"] = HelpableActionMap(self, "DirectionActions",
        {
            "downUp": (playlistCallback, _("Show playlist")),
            "upUp": (playlistCallback, _("Show playlist")),
         })

        self["okCancelActions"] = HelpableActionMap(self, "OkCancelActions",
        {
            "cancel": self.close
        })

        self["actions"] = HelpableActionMap(self, "KodiPlayerActions",
        {
            "menuPressed": (menuCallback, _("Show playback menu")),
            "infoPressed": (infoCallback, _("Show playback info")),
            "nextPressed": (nextItemCallback, _("Skip to next item in playlist")),
            "prevPressed": (prevItemCallback, _("Skip to previous item in playlist"))
        })

        self.eventTracker = ServiceEventTracker(self,
        {
            iPlayableService.evStart : self.__evStart,
        })
        self.onClose.append(boundFunction(self.session.deleteDialog, self.statusScreen))
        self.onClose.append(boundFunction(Notifications.RemovePopup, self.RESUME_POPUP_ID))
        self.onClose.append(self.__timer.stop)
Beispiel #28
0
 def keyOK(self): #openpliPC - F2 emuluje green
     curIndex = self["config"].getCurrentIndex()
     currItem = self["config"].list[curIndex][1]
     if isinstance(currItem, ConfigDirectory):
         def SetDirPathCallBack(curIndex, newPath):
             if None != newPath:
                 self["config"].list[curIndex][1].value = newPath
                 self.runSetup()
         if os_path.isdir(j00zekConfig.BouquetsOscamConfig.value):
             self.session.openWithCallback(boundFunction(SetDirPathCallBack, curIndex), DirectorySelectorWidget, currDir=j00zekConfig.BouquetsOscamConfig.value, title='Wybierz katalog z konfiguracją OsCam-a')
         else:
             self.session.openWithCallback(boundFunction(SetDirPathCallBack, curIndex), DirectorySelectorWidget, currDir='/', title='Wybierz katalog z konfiguracją OsCam-a')
Beispiel #29
0
def startUpServiceContextMenuCallback(self, add):
	if add:
		options = [
				(_("set as startup service after booting..."), boundFunction(self.setStartUpService, config.startupservice)),
				(_("set as startup service after leaving standby mode..."), boundFunction(self.setStartUpService, config.startupserviceleavingstandbymode)),
			]
	else:
		options = [
				(_("reset startup service for booting..."), boundFunction(self.resetStartUpService, config.startupservice)),
				(_("reset startup service for leaving standby mode..."), boundFunction(self.resetStartUpService, config.startupserviceleavingstandbymode)),
			]
	self.session.openWithCallback(self.startUpServiceMenuCallback, ChoiceBox,list = options)
Beispiel #30
0
	def __init__(self, *args, **kwargs):
		self.movemode = False
		self.selected = -1
		if 'where' in kwargs:
			self.where = kwargs['where']
			del kwargs['where']
		else:
			self.where = PluginDescriptor.WHERE_PLUGINMENU

		OriginalPluginBrowser.__init__(self, *args, **kwargs)
		self.skinName = ["SortingPluginBrowser", "PluginBrowser"]

		self["ColorActions"] = ActionMap(["ColorActions"],
			{
				"green": self.toggleMoveMode,
			}, -2
		)
		self["ColorActions"].setEnabled(False)

		self["WizardActions"] = ActionMap(["WizardActions"],
			{
				"left": boundFunction(self.doMove, self["list"].pageUp),
				"right": boundFunction(self.doMove, self["list"].pageDown),
				"up": boundFunction(self.doMove, self["list"].up),
				"down": boundFunction(self.doMove, self["list"].down),
			}, -2
		)

		if self.where != PluginDescriptor.WHERE_PLUGINMENU:
			self.toggleMoveMode()
			self.onShow.append(self.setCustomTitle)
		else:
			self["NumberActions"] = NumberActionMap(["NumberActions"],
				{
					"1": self.keyNumberGlobal,
					"2": self.keyNumberGlobal,
					"3": self.keyNumberGlobal,
					"4": self.keyNumberGlobal,
					"5": self.keyNumberGlobal,
					"6": self.keyNumberGlobal,
					"7": self.keyNumberGlobal,
					"8": self.keyNumberGlobal,
					"9": self.keyNumberGlobal,
					"0": self.keyNumberGlobal,
				}, -2
			)

			self["MenuActions"] = ActionMap(["MenuActions"],
				{
					"menu": self.openMenu,
				}, -1
			)
		self.onFirstExecBegin.append(self.firstExec)
Beispiel #31
0
 def isWorkingCorrectly(self, callBackFun):
     self.iptv_sys = iptv_system( DMHelper.GET_F4M_PATH() + " 2>&1 ", boundFunction(self._checkWorkingCallBack, callBackFun) )
Beispiel #32
0
 def loadPlaylistFeed(self, playlist):
     self.patientDialog = self.session.open(
         PatientMessageBox, _("Loading playlist, be patient ..."))
     self.patientDialog.processDelayed(
         boundFunction(self.loadPlaylistFeedReal, playlist=playlist))
Beispiel #33
0
 def requestApply(self):
     if self.underClosing: return
     self.doAction(
         boundFunction(self._iptvDoClose, self.getCurrentDirectory()))
Beispiel #34
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        list = []

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

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

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

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

# Sort by Weight
#		list.sort(key=lambda x: int(x[3]))
        self.skinName = []
        self.menuID = menuID
        skfile = "/usr/share/enigma2/" + config.skin.primary_skin.value
        f1 = file(skfile, "r")
        self.sktxt = f1.read()
        f1.close()
        if menuID is not None:
            if ('<screen name="Animmain" '
                    in self.sktxt) and (config.usage.mainmenu_mode.value
                                        == "horzanim"):
                self.skinName.append("Animmain")
                title = self.menuID
                self.setTitle(title)
            elif ('<screen name="Iconmain" '
                  in self.sktxt) and (config.usage.mainmenu_mode.value
                                      == "horzicon"):
                self.skinName.append("Iconmain")
                title = self.menuID
                self.setTitle(title)
            else:
                self.skinName.append("menu_" + menuID)
        self.skinName.append("Menu")
        ProtectedScreen.__init__(self)

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

        self.tlist = list
        ########################## pcd end #############################
        self["menu"] = List(list)

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

        a = parent.get("title", "").encode("UTF-8") or None
        a = a and _(a)
        if a is None:
            a = _(parent.get("text", "").encode("UTF-8"))
        self["title"] = StaticText(a)
        self.menu_title = a
        ###################### pcd ###############
        if ('<screen name="Animmain" '
                in self.sktxt) and (config.usage.mainmenu_mode.value
                                    == "horzanim"):
            self.onShown.append(self.openTestA)
        elif ('<screen name="Iconmain" '
              in self.sktxt) and (config.usage.mainmenu_mode.value
                                  == "horzicon"):
            self.onShown.append(self.openTestB)
Beispiel #35
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 == '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 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 == "":
                    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))
Beispiel #36
0
class InfoBarButtonSetup():
	def __init__(self):
		self["ButtonSetupButtonActions"] = helpableButtonSetupActionMap(self, "ButtonSetupActions",
			dict((x[1],(self.ButtonSetupGlobal, boundFunction(self.getHelpText, x[1]))) for x in ButtonSetupKeys), -10)
Beispiel #37
0
	def __init__(self):
		if self.isProtected() and config.ParentalControl.servicepin[0].value:
			self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.pinEntered, PinInput, pinList=[x.value for x in config.ParentalControl.servicepin], triesEntry=config.ParentalControl.retries.servicepin, title=_("Please enter the correct pin code"), windowTitle=_("Enter pin code")))
 def playService(self,
                 ref,
                 checkParentalControl=True,
                 forceRestart=False,
                 adjust=True):
     oldref = self.currentlyPlayingServiceOrGroup
     if ref and oldref and ref == oldref and not forceRestart:
         print "ignore request to play already running service(1)"
         return 1
     print "playing", ref and ref.toString()
     if path.exists("/proc/stb/lcd/symbol_signal"
                    ) and config.lcd.mode.value == '1':
         try:
             if '0:0:0:0:0:0:0:0:0' not in ref.toString():
                 signal = 1
             else:
                 signal = 0
             open("/proc/stb/lcd/symbol_signal", "w").write(str(signal))
         except:
             open("/proc/stb/lcd/symbol_signal", "w").write("0")
     elif path.exists("/proc/stb/lcd/symbol_signal"
                      ) and config.lcd.mode.value == '0':
         open("/proc/stb/lcd/symbol_signal", "w").write("0")
     if ref is None:
         self.stopService()
         return 0
     from Components.ServiceEventTracker import InfoBarCount
     InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
     if not checkParentalControl or parentalControl.isServicePlayable(
             ref,
             boundFunction(self.playService,
                           checkParentalControl=False,
                           forceRestart=forceRestart,
                           adjust=adjust)):
         if ref.flags & eServiceReference.isGroup:
             oldref = self.currentlyPlayingServiceReference or eServiceReference(
             )
             playref = getBestPlayableServiceReference(ref, oldref)
             print "playref", playref
             if playref and oldref and playref == oldref and not forceRestart:
                 print "ignore request to play already running service(2)"
                 return 1
             if not playref:
                 alternativeref = getBestPlayableServiceReference(
                     ref, eServiceReference(), True)
                 self.stopService()
                 if alternativeref and self.pnav:
                     self.currentlyPlayingServiceReference = alternativeref
                     self.currentlyPlayingServiceOrGroup = ref
                     if self.pnav.playService(alternativeref):
                         print "Failed to start", alternativeref
                         self.currentlyPlayingServiceReference = None
                         self.currentlyPlayingServiceOrGroup = None
                 return 0
             elif checkParentalControl and not parentalControl.isServicePlayable(
                     playref,
                     boundFunction(self.playService,
                                   checkParentalControl=False)):
                 if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                         self.currentlyPlayingServiceOrGroup, adjust):
                     self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                     )
                 return 1
         else:
             playref = ref
         if self.pnav:
             self.pnav.stopService()
             self.currentlyPlayingServiceReference = playref
             self.currentlyPlayingServiceOrGroup = ref
             if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                     ref, adjust):
                 self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                 )
             setPriorityFrontend = False
             if SystemInfo["DVB-T_priority_tuner_available"] or SystemInfo[
                     "DVB-C_priority_tuner_available"] or SystemInfo[
                         "DVB-S_priority_tuner_available"] or SystemInfo[
                             "ATSC_priority_tuner_available"]:
                 str_service = playref.toString()
                 if '%3a//' not in str_service and not str_service.rsplit(
                         ":", 1)[1].startswith("/"):
                     type_service = playref.getUnsignedData(4) >> 16
                     if type_service == 0xEEEE:
                         if SystemInfo[
                                 "DVB-T_priority_tuner_available"] and config.usage.frontend_priority_dvbt.value != "-2":
                             if config.usage.frontend_priority_dvbt.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbt.value))
                                 setPriorityFrontend = True
                         if SystemInfo[
                                 "ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
                             if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_atsc.value))
                                 setPriorityFrontend = True
                     elif type_service == 0xFFFF:
                         if SystemInfo[
                                 "DVB-C_priority_tuner_available"] and config.usage.frontend_priority_dvbc.value != "-2":
                             if config.usage.frontend_priority_dvbc.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbc.value))
                                 setPriorityFrontend = True
                         if SystemInfo[
                                 "ATSC_priority_tuner_available"] and config.usage.frontend_priority_atsc.value != "-2":
                             if config.usage.frontend_priority_atsc.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_atsc.value))
                                 setPriorityFrontend = True
                     else:
                         if SystemInfo[
                                 "DVB-S_priority_tuner_available"] and config.usage.frontend_priority_dvbs.value != "-2":
                             if config.usage.frontend_priority_dvbs.value != config.usage.frontend_priority.value:
                                 setPreferredTuner(
                                     int(config.usage.
                                         frontend_priority_dvbs.value))
                                 setPriorityFrontend = True
             if self.pnav.playService(playref):
                 print "Failed to start", playref
                 self.currentlyPlayingServiceReference = None
                 self.currentlyPlayingServiceOrGroup = None
             if setPriorityFrontend:
                 setPreferredTuner(int(
                     config.usage.frontend_priority.value))
             return 0
     elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
             oldref, adjust):
         self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
         )
     return 1
Beispiel #39
0
 def playService(self,
                 ref,
                 checkParentalControl=True,
                 forceRestart=False,
                 adjust=True):
     oldref = self.currentlyPlayingServiceOrGroup
     if ref and oldref and ref == oldref and not forceRestart:
         print "ignore request to play already running service(1)"
         return 1
     print "playing", ref and ref.toString()
     if ref is None:
         self.stopService()
         return 0
     from Components.ServiceEventTracker import InfoBarCount
     InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
     if not checkParentalControl or parentalControl.isServicePlayable(
             ref,
             boundFunction(self.playService,
                           checkParentalControl=False,
                           forceRestart=forceRestart,
                           adjust=adjust)):
         if ref.flags & eServiceReference.isGroup:
             oldref = self.currentlyPlayingServiceReference or eServiceReference(
             )
             playref = getBestPlayableServiceReference(ref, oldref)
             print "playref", playref
             if playref and oldref and playref == oldref and not forceRestart:
                 print "ignore request to play already running service(2)"
                 return 1
             if not playref:
                 alternativeref = getBestPlayableServiceReference(
                     ref, eServiceReference(), True)
                 self.stopService()
                 if alternativeref and self.pnav and self.pnav.playService(
                         alternativeref):
                     print "Failed to start", alternativeref
                 return 0
             elif checkParentalControl and not parentalControl.isServicePlayable(
                     playref,
                     boundFunction(self.playService,
                                   checkParentalControl=False)):
                 if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                         self.currentlyPlayingServiceOrGroup, adjust):
                     self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                     )
                 return 1
         else:
             playref = ref
         if self.pnav:
             self.pnav.stopService()
             self.currentlyPlayingServiceReference = playref
             self.currentlyPlayingServiceOrGroup = ref
             if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
                     ref, adjust):
                 self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
                 )
             if self.pnav.playService(playref):
                 print "Failed to start", playref
                 self.currentlyPlayingServiceReference = None
                 self.currentlyPlayingServiceOrGroup = None
             return 0
     elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(
             oldref, adjust):
         self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent(
         )
     return 1
Beispiel #40
0
	def __init__(self):
		# TIMEREDITLIST
		self["actions"] = ActionMap(["OkCancelActions", "DirectionActions", "ShortcutActions", "TimerEditActions", "YttrailerActions"],
		{
			"ok":			self.openEdit,
			"cancel":		self.keyExit, # overwritten to use our own exit function
			"green":		self.addCurrentTimer,
			"log":			self.showLog,
			"left":			self.left,
			"right":		self.right,
			"up":			self.up,
			"down":			self.down,
			"video":		self.keyVideo,
		}, -1)
		
		# TAB NAVIGATION
		self["tabNavigationActions"] = ActionMap(["TabNavigationActions"],
		{
			"nextTab":		boundFunction(self.keyDirection, direction = 1),
			"prevTab": 		boundFunction(self.keyDirection, direction = -1),
			"1":			boundFunction(self.keyNumber, number = 1),
			"2":			boundFunction(self.keyNumber, number = 2),
			"3":			boundFunction(self.keyNumber, number = 3),
			"4":			boundFunction(self.keyNumber, number = 4),
			"5":			boundFunction(self.keyNumber, number = 5),
			"6":			boundFunction(self.keyNumber, number = 6),
		}, -1)
		
		# EPG TABS
		self["epgTabBaseActions"] = ActionMap(["EpgTabBaseActions"],
		{
			"exit":			self.keyExit,
			"moveUp":		self.keyUp,
			"moveDown":		self.keyDown,
			"pageUp":		self.keyLeft,
			"pageDown":		self.keyRight,
			"nextBouquet":		self.keyBouquetUp,
			"prevBouquet": 		self.keyBouquetDown,
			"showRadio":		self.keyRadio,
			"showTv":		self.keyTv,
			"showEventInfo":	self.keyInfo,
			"ok":			self.keyOk,
			"video":		self.keyVideo,
			"text":			self.keyText,
		}, -1)
		
		# EPG HISTORY ACTIONS
		self["epgHistoryActions"] = ActionMap(["EpgHistoryActions"],
		{
			"exit":			self.keyExit,
			"ok":			self.keyOk,
			"moveUp":		self.keyUp,
			"moveDown":		self.keyDown,
			"pageUp":		self.keyLeft,
			"pageDown":		self.keyRight,
		}, -1)
		
		# EPG MANUAL SEARCH ACTIONS
		self["epgManualSearchActions"] = ActionMap(["EpgManualSearchActions"],
		{
			"exit":			self.keyExit,
			"ok":			self.keyOk,
			"left":			self.keyLeft,
			"right":		self.keyRight,
			"next":			boundFunction(self.keyDirection, direction = 1),
			"previous":		boundFunction(self.keyDirection, direction = -1),
			"1":			boundFunction(self.keyNumber, number = 1),
			"2":			boundFunction(self.keyNumber, number = 2),
			"3":			boundFunction(self.keyNumber, number = 3),
			"4":			boundFunction(self.keyNumber, number = 4),
			"5":			boundFunction(self.keyNumber, number = 5),
			"6":			boundFunction(self.keyNumber, number = 6),
			"7":			boundFunction(self.keyNumber, number = 7),
			"8":			boundFunction(self.keyNumber, number = 8),
			"9":			boundFunction(self.keyNumber, number = 9),
			"0":			boundFunction(self.keyNumber, number = 0),
		}, -1)
		
		# EPG RED
		self["epgRedActions"] = ActionMap(["EpgRedActions"],
		{
			"red":			self.keyRed,
		}, -1)
		
		# EPG GREEN
		self["epgGreenActions"] = ActionMap(["EpgGreenActions"],
		{
			"green":		self.keyGreen,
		}, -1)
		
		# EPG BLUE
		self["epgBlueActions"] = ActionMap(["EpgBlueActions"],
		{
			"blue":			self.keyBlue,
		}, -1)
		
		# EPG YELLOW
		self["epgYellowActions"] = ActionMap(["EpgYellowActions"],
		{
			"yellow":		self.keyYellow,
		}, -1)
		
		# SETTINGS ACTIONS
		self["settingsActions"] = ActionMap(["SettingsActions"],
		{
			"nextTab":		boundFunction(self.keyDirection, direction = 1),
			"prevTab": 		boundFunction(self.keyDirection, direction = -1),
			"1":			boundFunction(self.keyNumber, number = 1),
			"2":			boundFunction(self.keyNumber, number = 2),
			"3":			boundFunction(self.keyNumber, number = 3),
			"4":			boundFunction(self.keyNumber, number = 4),
			"5":			boundFunction(self.keyNumber, number = 5),
			"6":			boundFunction(self.keyNumber, number = 6),
			"7":			boundFunction(self.keyNumber, number = 7),
			"8":			boundFunction(self.keyNumber, number = 8),
			"9":			boundFunction(self.keyNumber, number = 9),
			"0":			boundFunction(self.keyNumber, number = 0),
			"exit":			self.keyExit,
			"moveUp":		self.keyUp,
			"moveDown":		self.keyDown,
			"left":			self.keyLeft,
			"right":		self.keyRight,
		}, -1)
		
		# TOGGLE CONFIG
		self["toggleConfigActions"] = ActionMap(["ToggleConfigActions"],
		{
			"toggleConfig":		self.keyMenu,
		}, -1)
		
		# disable several action maps on start
		self["actions"].setEnabled(False)
		self["epgHistoryActions"].setEnabled(False)
		self["epgManualSearchActions"].setEnabled(False)
		self["epgRedActions"].setEnabled(False)
		self["epgYellowActions"].setEnabled(False)
		self["epgBlueActions"].setEnabled(False)
		self["settingsActions"].setEnabled(False)
		self["toggleConfigActions"].setEnabled(True)
def restartGui(session=None):
	if session and not session.nav.getRecordings():
		session.openWithCallback(boundFunction(restartGuiNow, session), MessageBox, _("Restart the GUI now?"), MessageBox.TYPE_YESNO, default = False)
Beispiel #42
0
    def __init__(self,
                 session,
                 text="",
                 filename="",
                 currDir=None,
                 bookmarks=None,
                 userMode=False,
                 windowTitle=_("Select location"),
                 minFree=None,
                 autoAdd=False,
                 editDir=False,
                 inhibitDirs=[],
                 inhibitMounts=[]):
        # Init parents
        Screen.__init__(self, session)
        NumericalTextInput.__init__(self, handleTimeout=False)
        HelpableScreen.__init__(self)

        # Set useable chars
        self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz')

        # Quickselect Timer
        self.qs_timer = eTimer()
        self.qs_timer.callback.append(self.timeout)
        self.qs_timer_type = 0

        # Initialize Quickselect
        self.curr_pos = -1
        self.quickselect = ""

        # Set Text
        self["text"] = Label(text)
        self["textbook"] = Label(_("Bookmarks"))

        # Save parameters locally
        self.text = text
        self.filename = filename
        self.minFree = minFree
        self.realBookmarks = bookmarks
        self.bookmarks = bookmarks and bookmarks.value[:] or []
        self.userMode = userMode
        self.autoAdd = autoAdd
        self.editDir = editDir
        self.inhibitDirs = inhibitDirs

        # Initialize FileList
        self["filelist"] = FileList(currDir,
                                    showDirectories=True,
                                    showFiles=False,
                                    inhibitMounts=inhibitMounts,
                                    inhibitDirs=inhibitDirs)

        # Initialize BookList
        self["booklist"] = MenuList(self.bookmarks)

        # Buttons
        self["key_green"] = Button(_("OK"))
        self["key_yellow"] = Button(_("Rename"))
        self["key_blue"] = Button(_("Remove bookmark"))
        self["key_red"] = Button(_("Cancel"))

        # Background for Buttons
        self["green"] = Pixmap()
        self["yellow"] = Pixmap()
        self["blue"] = Pixmap()
        self["red"] = Pixmap()

        # Initialize Target
        self["target"] = Label()

        if self.userMode:
            self.usermodeOn()

        # Custom Action Handler
        class LocationBoxActionMap(HelpableActionMap):
            def __init__(self, parent, context, actions={}, prio=0):
                HelpableActionMap.__init__(self, parent, context, actions,
                                           prio)
                self.box = parent

            def action(self, contexts, action):
                # Reset Quickselect
                self.box.timeout(force=True)

                return HelpableActionMap.action(self, contexts, action)

        # Actions that will reset quickselect
        self["WizardActions"] = LocationBoxActionMap(self, "WizardActions", {
            "ok": (self.ok, _("select")),
            "back": (self.cancel, _("Cancel")),
        }, -2)

        self["DirectionActions"] = LocationBoxActionMap(
            self, "DirectionActions", {
                "left": self.left,
                "right": self.right,
                "up": self.up,
                "down": self.down,
            }, -2)

        self["ColorActions"] = LocationBoxActionMap(
            self, "ColorActions", {
                "red": self.cancel,
                "green": self.select,
                "yellow": self.changeName,
                "blue": self.addRemoveBookmark,
            }, -2)

        self["EPGSelectActions"] = LocationBoxActionMap(
            self, "EPGSelectActions", {
                "prevService":
                (self.switchToBookList, _("switch to bookmarks")),
                "nextService":
                (self.switchToFileList, _("switch to filelist")),
            }, -2)

        self["MenuActions"] = LocationBoxActionMap(self, "MenuActions", {
            "menu": (self.showMenu, _("menu")),
        }, -2)

        # Actions used by quickselect
        self["NumberActions"] = NumberActionMap(
            ["NumberActions"], {
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
                "0": self.keyNumberGlobal
            })

        # Run some functions when shown
        self.onShown.extend((
            boundFunction(self.setTitle, windowTitle),
            self.updateTarget,
            self.showHideRename,
        ))

        self.onLayoutFinish.append(self.switchToFileListOnStart)

        # Make sure we remove our callback
        self.onClose.append(self.disableTimer)
Beispiel #43
0
 def isWorkingCorrectly(self, callBackFun):
     self.iptv_sys = iptv_system(
         "wget 2>&1 ", boundFunction(self._checkWorkingCallBack,
                                     callBackFun))
Beispiel #44
0
    def __init__(self, session):
        self.modulation = config.plugins.SDGRadio.modulation
        self.frequency = eval("config.plugins.SDGRadio.frequency_%s" %
                              self.modulation.value)
        self.playbackFrequency = None  # currently playing frequency
        self.playbackPreset = None  # currently playing preset
        self.presets = []  # preset list for current modulation
        self.log = []  # log messages
        self.programs = []  # DAB program list
        self.console = None

        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        self.setTitle(_("Software defined radio"))
        self.skin = SKIN
        self.skin_path = resolveFilename(SCOPE_PLUGINS, "Extensions/SDGRadio")

        for i in range(0, 10):
            self["mem_%d" % i] = MultiPixmap()

        self["modulation"] = Label()
        self["freq"] = Label()
        self["freq_off"] = Label()
        self["freq_units"] = Label()
        self["dab_channel"] = Label()
        self["radiotext"] = Label()
        self["prog_type"] = Label()
        self["pi"] = Label()
        self["traffic"] = Label()
        self["af"] = Label()
        self["ct"] = Label()
        self["eon"] = Label()
        self["rt+"] = Label()
        self["pic"] = Pixmap()
        self["rds_icon"] = Pixmap()
        self["rt_icon"] = Pixmap()
        self["ps_icon"] = Pixmap()

        self["key_red"] = StaticText()
        self["key_green"] = StaticText(_("Play"))
        self["key_yellow"] = StaticText()
        self["key_blue"] = StaticText()

        self["actions"] = HelpableActionMap(
            self, "SDGRadioActions", {
                "cancel": (self.cancel, _("Close plugin")),
                "ok": (self.selectFreq, _("Play current frequency")),
                "info": (self.showPrograms, _("Show DAB program list")),
                "menu": (self.showMenu, _("Open advanced options menu")),
                "red": (self.toggleModulation, _("Change modulation")),
                "green": (self.togglePlayback, _("Start/stop playback")),
                "yellow": (self.yellow, _("Switch RDS on/off")),
                "blue": (self.showInput, _("Open frequency input screen")),
                "blue_long": (self.showLog, _("Cmd execution log")),
                "0": (boundFunction(self.selectPreset,
                                    0), _("Play memory preset %d") % 0),
                "1": (boundFunction(self.selectPreset,
                                    1), _("Play memory preset %d") % 1),
                "2": (boundFunction(self.selectPreset,
                                    2), _("Play memory preset %d") % 2),
                "3": (boundFunction(self.selectPreset,
                                    3), _("Play memory preset %d") % 3),
                "4": (boundFunction(self.selectPreset,
                                    4), _("Play memory preset %d") % 4),
                "5": (boundFunction(self.selectPreset,
                                    5), _("Play memory preset %d") % 5),
                "6": (boundFunction(self.selectPreset,
                                    6), _("Play memory preset %d") % 6),
                "7": (boundFunction(self.selectPreset,
                                    7), _("Play memory preset %d") % 7),
                "8": (boundFunction(self.selectPreset,
                                    8), _("Play memory preset %d") % 8),
                "9": (boundFunction(self.selectPreset,
                                    9), _("Play memory preset %d") % 9),
                "long0": (boundFunction(self.storePreset, 0),
                          _("Store frequency to memory preset %d") % 0),
                "long1": (boundFunction(self.storePreset, 1),
                          _("Store frequency to memory preset %d") % 1),
                "long2": (boundFunction(self.storePreset, 2),
                          _("Store frequency to memory preset %d") % 2),
                "long3": (boundFunction(self.storePreset, 3),
                          _("Store frequency to memory preset %d") % 3),
                "long4": (boundFunction(self.storePreset, 4),
                          _("Store frequency to memory preset %d") % 4),
                "long5": (boundFunction(self.storePreset, 5),
                          _("Store frequency to memory preset %d") % 5),
                "long6": (boundFunction(self.storePreset, 6),
                          _("Store frequency to memory preset %d") % 6),
                "long7": (boundFunction(self.storePreset, 7),
                          _("Store frequency to memory preset %d") % 7),
                "long8": (boundFunction(self.storePreset, 8),
                          _("Store frequency to memory preset %d") % 8),
                "long9": (boundFunction(self.storePreset, 9),
                          _("Store frequency to memory preset %d") % 9),
                "up": (boundFunction(
                    self.freqUp, "1"), _("Increase frequency by 1 MHz / KHz")),
                "down":
                (boundFunction(self.freqDown,
                               "1"), _("Decrease frequency by 1 MHz / KHz")),
                "upRepeated":
                (boundFunction(self.freqUp, "10"),
                 _("Increase frequency by 10 MHz / KHz (long press)")),
                "downRepeated":
                (boundFunction(self.freqDown, "10"),
                 _("Decrease frequency by 10 MHz / KHz (long press)")),
                "right": (boundFunction(
                    self.freqUp, "0.05"), _("Increase frequency by 0.05 MHz")),
                "left": (boundFunction(self.freqDown, "0.05"),
                         _("Decrease frequency by 0.05 MHz")),
                "rightRepeated":
                (boundFunction(self.freqUp, "0.1"),
                 _("Increase frequency by 0.1 MHz (long press)")),
                "leftRepeated":
                (boundFunction(self.freqDown, "0.1"),
                 _("Decrease frequency by 0.1 MHz (long press)")),
                "nextBouquet": (boundFunction(self.freqUp, "0.0001"),
                                _("Increase frequency by 0.0001 MHz")),
                "prevBouquet": (boundFunction(self.freqDown, "0.0001"),
                                _("Decrease frequency by 0.0001 MHz")),
            }, -2)

        self.onLayoutFinish.extend([
            self.getConfigOptions, self.getPresets, self.updateFreqWidget,
            self.updateExtraWidgets, self.redText, self.yellowText,
            self.blueText
        ])

        self.oldService = self.session.nav.getCurrentlyPlayingServiceReference(
        )  # get currently playing service
        self.session.nav.stopService()  # stop currently playing service
        eConsoleAppContainer().execute(
            "showiframe /usr/share/enigma2/radio.mvi")  # display radio mvi
Beispiel #45
0
	def __init__(self, session, parent):
		Screen.__init__(self, session)

		list = []

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

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

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

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

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

		self["menu"] = List(list)

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

		a = parent.get("title", "").encode("UTF-8") or None
		a = a and _(a)
		if a is None:
			a = _(parent.get("text", "").encode("UTF-8"))
		self["title"] = StaticText(a)
		Screen.setTitle(self, a)
		self.menu_title = a
Beispiel #46
0
    def __init__(self,
                 session,
                 csel,
                 menu_mode,
                 current_dir,
                 list_styles,
                 service=None):
        logger.info("current_dir: %s", current_dir)
        Screen.__init__(self, session)
        HelpableScreen.__init__(self)
        self.csel = csel
        self.menu_mode = menu_mode
        self.current_dir = current_dir
        self.list_styles = list_styles
        self.service = service
        self.skinName = getSkinName("CockpitContextMenu")
        self["title"] = StaticText()
        self["menu"] = List()

        self["actions"] = HelpableActionMap(
            self, "CockpitActions", {
                "EXIT": (self.close, _("Exit")),
                "OK": (self.ok, _("Select function")),
                "RED": (self.close, _("Cancel")),
                "MENU": (self.csel.openConfigScreen, _("Open setup")),
            }, -1)

        menu = []
        if self.menu_mode == MENU_FUNCTIONS:
            self.setTitle(_("Select function"))

            if self.current_dir not in MountCockpit.getInstance(
            ).getMountedBookmarks(ID):
                menu.append((_("Home"), (boundFunction(
                    self.csel.changeDir,
                    MountCockpit.getInstance().getHomeDir(ID)), True)))
                menu.append((_("Directory up"),
                             (boundFunction(self.csel.changeDir,
                                            self.current_dir + "/.."), True)))

            menu.append((_("Delete"), (self.csel.deleteMovies, True)))
            menu.append((_("Move"), (self.csel.moveMovies, True)))
            menu.append((_("Copy"), (self.csel.copyMovies, True)))

            if config.plugins.moviecockpit.trashcan_enable.value:
                menu.append(
                    (_("Empty trashcan"), (self.csel.emptyTrashcan, True)))

            menu.append((_("Bookmarks"), (self.csel.openBookmarks, True)))

            for i, _list_style in enumerate(self.list_styles):
                menu.append((_(self.list_styles[i][1]),
                             (boundFunction(self.csel.movie_list.setListStyle,
                                            i), True)))

            if config.plugins.cachecockpit.archive_enable.value:
                menu.append((_("Archive"), (self.csel.archiveFiles, True)))
            menu.append((_("Reload cache"), (self.csel.reloadCache, False)))
            menu.append((_("Remove all marks"),
                         (self.csel.removeCutListMarkers, True)))
            menu.append((_("Setup"), (self.csel.openConfigScreen, True)))
            menu.append((_("About"), (boundFunction(about,
                                                    self.session), True)))
        elif self.menu_mode == MENU_PLUGINS:
            self.setTitle(_("Select plugin"))
            if self.service is not None:
                for plugin in plugins.getPlugins(
                        PluginDescriptor.WHERE_MOVIELIST):
                    menu.append((plugin.description,
                                 boundFunction(self.execPlugin, plugin)))

        self["menu"].setList(menu)
Beispiel #47
0
def main(session, **kwargs):
	InfoBar.instance.checkTimeshiftRunning(boundFunction(mainCheckTimeshiftCallback, session))
Beispiel #48
0
 def _isWgetWorkingCorrectly(self, callBackFun):
     self.iptv_sys = iptv_system( DMHelper.GET_WGET_PATH() + " -V 2>&1 ", boundFunction(self._checkWgetWorkingCallBack, callBackFun) )
Beispiel #49
0
def newChannelContextMenu__init__(self, session, csel):
    baseChannelContextMenu__init__(self, session, csel)
    self["menu"].enableWrapAround = True
    if config.BouquetProtect.enabled.value == 'none':
        return
    if csel.bouquet_mark_edit != 0 or csel.movemode:
        return

    idx = max(0, len(self["menu"].list) - 1)
    current = csel.getCurrentSelection()
    current_root = csel.getRoot()
    if not (current_root
            and current_root.getPath().find('FROM BOUQUET "bouquets.') != -1):
        inBouquet = csel.getMutableList() != None
        if not (current.flags &
                (eServiceReference.isMarker | eServiceReference.isDirectory)):
            if inBouquet and config.BouquetProtect.enabled.value in ('bouq'):
                if not csel.hidden_shown:
                    self["menu"].list.insert(
                        idx,
                        ChoiceEntryComponent(
                            text=(_("unlock protected services"),
                                  self.menuShowAllHiddenBouquetServices)))
                    self["menu"].list.insert(
                        idx,
                        ChoiceEntryComponent(text=(
                            _("add to bouquets protection"),
                            boundFunction(self.menuHideCurrentService, True))))
                else:
                    self["menu"].list.insert(
                        idx,
                        ChoiceEntryComponent(
                            text=(_("lock protected services"),
                                  self.menuShowAllHiddenBouquetServices)))
                    if current.toString() in getHiddenList():
                        self["menu"].list.insert(
                            idx,
                            ChoiceEntryComponent(text=(
                                _("remove from bouquets protection"),
                                boundFunction(self.menuHideCurrentService,
                                              False))))
                    else:
                        self["menu"].list.insert(
                            idx,
                            ChoiceEntryComponent(
                                text=(_("add to bouquets protection"),
                                      boundFunction(
                                          self.menuHideCurrentService, True))))
            elif not inBouquet and config.BouquetProtect.unwanted.enalbed.value:
                if current_root and current_root.getPath().find(
                        "flags == 2") != -1:
                    self["menu"].list.insert(
                        idx,
                        ChoiceEntryComponent(
                            text=(_("restore all hidden services"),
                                  boundFunction(self.menuHideUnwantedServices,
                                                False))))
                    self["menu"].list.insert(
                        idx,
                        ChoiceEntryComponent(
                            text=(_("restore hidden service"),
                                  boundFunction(self.menuHideUnwantedService,
                                                False))))
                else:
                    self["menu"].list.insert(
                        idx,
                        ChoiceEntryComponent(
                            text=(_("hide as unwanted service"),
                                  boundFunction(self.menuHideUnwantedService,
                                                True))))

        else:
            if config.BouquetProtect.unwanted.enalbed.value:
                if not inBouquet and current.getPath().find("PROVIDERS") == -1:
                    self["menu"].list.insert(
                        idx,
                        ChoiceEntryComponent(
                            text=(_("hide all as unwanted services"),
                                  boundFunction(self.menuHideUnwantedServices,
                                                True))))
    else:
        if not csel.hidden_shown:
            self["menu"].list.insert(
                idx,
                ChoiceEntryComponent(
                    text=(_("unlock protected services"),
                          self.menuShowAllHiddenBouquetServices)))
            self["menu"].list.insert(
                idx,
                ChoiceEntryComponent(
                    text=(_("add to bouquets protection"),
                          boundFunction(self.menuHideCurrentBouquet, True))))
        else:
            self["menu"].list.insert(
                idx,
                ChoiceEntryComponent(
                    text=(_("lock protected services"),
                          self.menuShowAllHiddenBouquetServices)))
            if current.toString() in getHiddenList():
                self["menu"].list.insert(
                    idx,
                    ChoiceEntryComponent(text=(
                        _("remove from bouquets protection"),
                        boundFunction(self.menuHideCurrentBouquet, False))))
            else:
                self["menu"].list.insert(
                    idx,
                    ChoiceEntryComponent(text=(
                        _("add to bouquets protection"),
                        boundFunction(self.menuHideCurrentBouquet, True))))
Beispiel #50
0
	def okbuttonClick(self):
		nim = self["nimlist"].getCurrent()
		nim = nim and nim[3]
		if nim is not None and not nim.empty and nim.isSupported():
			self.session.openWithCallback(boundFunction(self.updateList, self["nimlist"].getIndex()), self.resultclass, nim.slot)
 def cancel(self, value=None):
     self.container = Console()
     self.container.ePopen('umount /tmp/startupmount',
                           boundFunction(self.unmountCallback, value))
Beispiel #52
0
    def getEpisode(self, timer, block=False):

        log.info("timername, service, begin, end:", timer.name,
                 str(timer.service_ref.ref), timer.begin, timer.end)

        if hasattr(timer, 'sp_in_queue'):
            if timer.sp_in_queue:
                msg = _("Skipping timer because it is already in queue")
                log.warning(msg, timer.name)
                timer.log(601, "[SeriesPlugin]" + " " + msg)
                return

        # We have to compare the length,
        # because of the E2 special chars handling for creating the filenames
        #if timer.name == name:
        # Mad Men != Mad_Men

        if TAG in timer.tags:
            msg = _("Skipping timer because it is already handled"
                    ) + "\n\n" + _("Can be configured within the setup")
            log.info(msg, timer.name)
            timer.log(607, "[SeriesPlugin]" + " " + msg)
            return

        if timer.begin < time() + 60:
            msg = _("Skipping timer because it starts in less than 60 seconds")
            log.debug(msg, timer.name)
            timer.log(604, "[SeriesPlugin]" + " " + msg)
            return

        if timer.isRunning():
            msg = _("Skipping timer because it is already running")
            log.debug(msg, timer.name)
            timer.log(605, "[SeriesPlugin]" + " " + msg)
            return

        if timer.justplay:
            msg = _("Skipping timer because it is a just play timer")
            log.debug(msg, timer.name)
            timer.log(606, "[SeriesPlugin]" + " " + msg)
            return

        event = None
        epgcache = eEPGCache.getInstance()

        if timer.eit:
            event = epgcache.lookupEventId(timer.service_ref.ref, timer.eit)
            log.debug("lookupEventId", timer.eit, event)
        if not (event):
            event = epgcache.lookupEventTime(
                timer.service_ref.ref,
                timer.begin + ((timer.end - timer.begin) / 2))
            log.debug("lookupEventTime", event)

        if event:
            if not (len(timer.name) == len(event.getEventName())):
                msg = _("Skipping timer because it is already modified %s" %
                        (timer.name))
                log.info(msg)
                timer.log(602, "[SeriesPlugin]" + " " + msg)
                return
            begin = event.getBeginTime() or 0
            duration = event.getDuration() or 0
            end = begin + duration

        else:
            if config.plugins.seriesplugin.timer_eit_check.value:
                msg = _("Skipping timer because no event was found")
                log.info(msg, timer.name)
                timer.log(603, "[SeriesPlugin]" + " " + msg)
                return
            else:
                # We don't know the exact margins, we will assume the E2 default margins
                log.debug(
                    "We don't know the exact margins, we will assume the E2 default margins"
                )
                begin = timer.begin + (config.recording.margin_before.value *
                                       60)
                end = timer.end - (config.recording.margin_after.value * 60)

        timer.log(
            600, "[SeriesPlugin]" + " " + _("Try to find infos for %s" %
                                            (timer.name)))

        seriesPlugin = getInstance()

        if timer.service_ref:
            log.debug("getEpisode:", timer.name, timer.begin, timer.end, block)

            timer.sp_in_queue = True

            return seriesPlugin.getEpisode(boundFunction(
                self.timerCallback, timer),
                                           timer.name,
                                           begin,
                                           end,
                                           timer.service_ref,
                                           future=True,
                                           block=block)
        else:
            msg = _("Skipping lookup because no channel is specified")
            log.warning(msg)
            self.timerCallback(timer, msg)
            return None
Beispiel #53
0
	def newPinEntered(self, answer):
		if answer is not None:
			self.session.openWithCallback(boundFunction(self.confirmNewPinEntered, answer), PinInput, title=_("Please re-enter the new PIN code"), windowTitle=_("Enter pin code"))
Beispiel #54
0
 def searchFeed(self, searchContext):
     self.patientDialog = self.session.open(PatientMessageBox,
                                            _("Searching, be patient ..."))
     self.patientDialog.processDelayed(
         boundFunction(self.searchFeedReal, searchContext=searchContext))
     self.isFavoritesFeed = False
Beispiel #55
0
	def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust=True):
		oldref = self.currentlyPlayingServiceOrGroup
		if ref and oldref and ref == oldref and not forceRestart:
			print "ignore request to play already running service(1)"
			return 1
		print "playing", ref and ref.toString()
		if path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '1':
			try:
				if '0:0:0:0:0:0:0:0:0' not in ref.toString():
					signal = 1
				else:
					signal = 0
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write(str(signal))
				f.close()
			except:
				f = open("/proc/stb/lcd/symbol_signal", "w")
				f.write("0")
				f.close()
		elif path.exists("/proc/stb/lcd/symbol_signal") and config.lcd.mode.value == '0':
			f = open("/proc/stb/lcd/symbol_signal", "w")
			f.write("0")
			f.close()

		if ref is None:
			self.stopService()
			return 0
		from Components.ServiceEventTracker import InfoBarCount
		InfoBarInstance = InfoBarCount == 1 and InfoBar.instance
		if not checkParentalControl or parentalControl.isServicePlayable(ref, boundFunction(self.playService, checkParentalControl=False, forceRestart=forceRestart, adjust=adjust)):
			if ref.flags & eServiceReference.isGroup:
				oldref = self.currentlyPlayingServiceReference or eServiceReference()
				playref = getBestPlayableServiceReference(ref, oldref)
				print "playref", playref
				if playref and oldref and playref == oldref and not forceRestart:
					print "ignore request to play already running service(2)"
					return 1
				if not playref:
					alternativeref = getBestPlayableServiceReference(ref, eServiceReference(), True)
					self.stopService()
					if alternativeref and self.pnav:
						self.currentlyPlayingServiceReference = alternativeref
						self.currentlyPlayingServiceOrGroup = ref
						if self.pnav.playService(alternativeref):
							print "Failed to start", alternativeref
							self.currentlyPlayingServiceReference = None
							self.currentlyPlayingServiceOrGroup = None
					return 0
				elif checkParentalControl and not parentalControl.isServicePlayable(playref, boundFunction(self.playService, checkParentalControl = False)):
					if self.currentlyPlayingServiceOrGroup and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(self.currentlyPlayingServiceOrGroup, adjust):
						self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
					return 1
			else:
				playref = ref
			if self.pnav:
				self.pnav.stopService()
				self.currentlyPlayingServiceReference = playref
				self.currentlyPlayingServiceOrGroup = ref
				if InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(ref, adjust):
					self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
				if self.pnav.playService(playref):
					print "Failed to start", playref
					self.currentlyPlayingServiceReference = None
					self.currentlyPlayingServiceOrGroup = None
				return 0
		elif oldref and InfoBarInstance and InfoBarInstance.servicelist.servicelist.setCurrent(oldref, adjust):
			self.currentlyPlayingServiceOrGroup = InfoBarInstance.servicelist.servicelist.getCurrent()
		return 1
Beispiel #56
0
 def requestApply(self, fullPath):
     if self.underClosing: return
     self.doAction(boundFunction(self._iptvDoClose, fullPath))
Beispiel #57
0
	def __copyFlash(self, mp, data):
		if self.__checkMountPoint(mp):
			cmd = "cp -af /usr/* %s/" % (mp)
			self.Console.ePopen(cmd, self.__CopyFinished)
			self.__message = self.session.openWithCallback(boundFunction(self.__EndCB, data), MessageBox, _("Please wait, Flash memory will be copied."), MessageBox.TYPE_INFO, enable_input=False)
Beispiel #58
0
    def createMenuList(self, showNumericHelp=False):
        self["key_blue"].text = _(
            "Edit menu") if config.usage.menu_sort_mode.value == "user" else ""
        self.list = []
        self.menuID = None
        for x in self.parentmenu:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(self.list, x)
                    count += 1
            elif x.tag == 'menu':
                item_level = int(x.get("level", 0))
                if item_level <= config.usage.setup_level.index:
                    self.addMenu(self.list, x)
                    count += 1
            elif x.tag == "id":
                self.menuID = x.get("val")
                count = 0

            if self.menuID:
                # menuupdater?
                if menuupdater.updatedMenuAvailable(self.menuID):
                    for x in menuupdater.getUpdatedMenu(self.menuID):
                        if x[1] == count:
                            self.list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ", ")), x[4]))
                            count += 1
        if self.menuID:
            # plugins
            for l in plugins.getPluginsForMenu(self.menuID):
                # check if a plugin overrides an existing menu
                plugin_menuid = l[2]
                for x in self.list:
                    if x[2] == plugin_menuid:
                        self.list.remove(x)
                        break
                self.list.append(
                    (l[0], boundFunction(l[1], self.session,
                                         close=self.close), l[2], l[3] or 50))

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

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

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

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

        self["menu"].updateList(self.list)
Beispiel #59
0
    def __init__(self, session, parent):
        Screen.__init__(self, session)
        list = []

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

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

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

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

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

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

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

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

        self["menu"] = List(list)

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

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

        self.number = 0
        self.nextNumberTimer = eTimer()
        self.nextNumberTimer.callback.append(self.okbuttonClick)
Beispiel #60
0
def mainSetup(session, **kwargs):
	if config.plugins.iptvplayer.configProtectedByPin.value:
		session.openWithCallback(boundFunction(pinCallback, session, runSetup), IPTVPinWidget, title=_("Enter pin")) 
	else:
		runSetup(session)