def searchMenu(self, parent, name): menuID = None ret = None for x in parent: if x.tag == "item": requires = x.get("requires") if requires: if requires[0] == "!": if SystemInfo.get(requires[1:], False): continue elif not SystemInfo.get(requires, False): continue item_text = x.get("text", "").encode("UTF-8") entryID = x.get("entryID", "") if entryID == name: for z in x: if z.tag == "screen": module = z.get("module") screen = z.get("screen") if screen is None: screen = module print module, screen if module[:7] == "SIFTeam": pass # we don't need any change to module elif module: module = "Screens." + module else: module = "" # check for arguments. they will be appended to the # openDialog call args = z.text or "" screen += ", " + args ret = boundFunction(self.runScreen, (module, screen)) elif z.tag == "code": ret = boundFunction(self.execText, z.text) elif z.tag == "setup": id = z.get("id") ret = boundFunction(self.openSetup, id) elif x.tag == "menu": if ret is None: ret = self.searchMenu(x, name) elif x.tag == "id": menuID = x.get("val") if menuID is not None: for l in plugins.getPluginsForMenu(menuID): if l[2] == name: ret = boundFunction(l[1], self.session) return ret
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]])== "/".join(selected): self.runPlugin(plugin) break twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) break elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/etc/shellscripts/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command)
def getSubEntry(self, menuID, list): if menuID is None: for l in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU): if isinstance(l.iconstr, str): menuitem = [l.name, '/'.join((l.path, l.iconstr)), boundFunction(self.runPlugin, (l, None)), l.weight] else: menuitem = [l.name, '', boundFunction(self.runPlugin, (l, None)), l.weight] if l.name in [ _("Front Panel Update"), _("CrossEPG Downloader"), _("OpenWebif"), _("Software management"), _("MediaPortal"), _("AutoTimer"), _("Picture player"), _("YouTube TV Settings")]: print "Skip =>", l.name else: list.append(tuple(menuitem)) else: for l in plugins.getPluginsForMenu(menuID): if len(l) > 5: menuitem = [l[0], l[2], boundFunction(self.runPlugin, (l[1], l[6])), l[3] or 50] else: menuitem = [l[0], l[2], boundFunction(self.runPlugin, (l[1], None)), l[3] or 50] if l[0] in [ _("Front Panel Update"), _("CrossEPG Downloader"), _("OpenWebif"), _("Software management"), _("MediaPortal"), _("Picture player"), _("YouTube TV Settings")]: print "Skip =>", l.name else: list.append(tuple(menuitem)) # This is little HACK to show AutoTimer in TV section, as We do not want to clone AutTimer git and reqwrite it to show in our section for l in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU): if l.name == _("AutoTimer"): if menuID == "id_mainmenu_tv": if isinstance(l.iconstr, str): menuitem = [l.name, '/'.join((l.path, l.iconstr)), boundFunction(self.runPlugin, (l, None)), 60] else: menuitem = [l.name, '', boundFunction(self.runPlugin, (l, None)), 60] list.append(tuple(menuitem)) try: list.sort(key=lambda x: int(x[3])) except: list.sort(key=lambda x: x[3]) return list
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]])== "/".join(selected): self.runPlugin(plugin) break twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) break elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + selected[1] + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0] == "Zap": self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show()
def parseMenu(self, parent): menuID = None for x in parent: if x.tag == "item": self.addItem(x) elif x.tag == "menu": self.parseMenu(x) elif x.tag == "id": menuID = x.get("val") if menuID is not None: for l in plugins.getPluginsForMenu(menuID): plugin_menuid = l[2] for x in self.cacheList: if x[1] == plugin_menuid: self.cacheList.remove(x) break self.cacheList.append([l[0], l[2]])
def __init__(self, session, parent): Screen.__init__(self, session) list = [] menuID = None for x in parent: if not x.tag: continue if x.tag == 'item': item_level = int(x.get('level', 0)) if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 elif x.tag == 'menu': self.addMenu(list, x) count += 1 elif x.tag == 'id': menuID = x.get('val') count = 0 if menuID is not None: if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ', ')), x[4])) count += 1 self.menuID = menuID if config.ParentalControl.configured.value: ProtectedScreen.__init__(self) if menuID is not None: for l in plugins.getPluginsForMenu(menuID): plugin_menuid = l[2] for x in list: if x[2] == plugin_menuid: list.remove(x) break if len(l) > 4 and l[4]: list.append((l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) self.skinName = [] if menuID is not None: self.skinName.append('menu_' + menuID) self.skinName.append('Menu') self.menuID = menuID ProtectedScreen.__init__(self) if config.usage.sort_menus.value: list.sort() else: list.sort(key=lambda x: int(x[3])) self['menu'] = List(list) self['actions'] = NumberActionMap(['OkCancelActions', 'MenuActions', 'NumberActions'], {'ok': self.okbuttonClick, 'cancel': self.closeNonRecursive, 'menu': self.closeRecursive, '1': self.keyNumberGlobal, '2': self.keyNumberGlobal, '3': self.keyNumberGlobal, '4': self.keyNumberGlobal, '5': self.keyNumberGlobal, '6': self.keyNumberGlobal, '7': self.keyNumberGlobal, '8': self.keyNumberGlobal, '9': self.keyNumberGlobal}) a = parent.get('title', '').encode('UTF-8') or None a = a and _(a) if a is None: a = _(parent.get('text', '').encode('UTF-8')) self['title'] = StaticText(a) Screen.setTitle(self, a) self.menu_title = a return
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.menu_title = a global menu_path self.menu_path_compressed = menu_path if menu_path == "": menu_path += a elif not menu_path.endswith(a): menu_path += " / " + a global full_menu_path full_menu_path = menu_path + ' / ' if config.usage.show_menupath.value == 'large': Screen.setTitle(self, menu_path) self["title"] = StaticText(menu_path) self["menu_path_compressed"] = StaticText("") elif config.usage.show_menupath.value == 'small': Screen.setTitle(self, a) self["title"] = StaticText(a) self["menu_path_compressed"] = StaticText( self.menu_path_compressed and self.menu_path_compressed + " >" or "") else: Screen.setTitle(self, a) self["title"] = StaticText(a) self["menu_path_compressed"] = StaticText("") self.number = 0 self.nextNumberTimer = eTimer() self.nextNumberTimer.callback.append(self.okbuttonClick)
def execButtonSetup(self, selected): if selected: selected = selected[1].split('/') if selected[0] == 'Plugins': twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]) == '/'.join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]) == '/'.join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == 'MenuPlugin': for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == 'Infobar': if hasattr(self, selected[1]): exec 'self.' + '.'.join(selected[1:]) + '()' else: return 0 elif selected[0] == 'Module': try: exec 'from ' + selected[1] + ' import *' exec 'self.session.open(' + ','.join(selected[2:]) + ')' except: print '[ButtonSetup] error during executing module %s, screen %s' % (selected[1], selected[2]) elif selected[0] == 'Setup': exec 'from Screens.Setup import *' exec 'self.session.open(Setup, "' + selected[1] + '")' elif selected[0].startswith('Zap'): if selected[0] == 'ZapPanic': self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent(eServiceReference('/'.join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, 'lastservice'): self.lastservice = eServiceReference('/'.join(selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == 'PPanel': ppanelFileName = '/etc/ppanels/' + selected[1] + '.xml' if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == 'Shellscript': command = '/usr/script/' + selected[1] + '.sh' if os.path.isfile(command) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + ' shellscript', None, command) elif selected[0] == 'EMC': try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance)) except Exception as e: print '[EMCPlayer] showMovies exception:\n' + str(e) return
def __init__(self, session, parent): Screen.__init__(self, session) list = [] menuID = None for x in parent: #walk through the actual nodelist if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 elif x.tag == 'menu': self.addMenu(list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 if menuID is not None: # plugins 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), 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 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, # ikseong - for memory test # "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 }) # ikseong # etitle = parent.get("title", "").encode("UTF-8") or None # etitle = etitle # if etitle is None: # etitle = parent.get("text","").encode("UTF-8") a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) if a is None: a = _(parent.get("text", "").encode("UTF-8")) # ikseong - enter Main menu else: t_history.reset() self["title"] = StaticText(a) self.menu_title = a # ikseong - for memory test # self.memorytestmode = 0 # self.testkey = 0 # ikseong make menu title self["thistory"] = StaticText(t_history.thistory) history_len = len(t_history.thistory) self["title0"] = StaticText('') self["title1"] = StaticText('') self["title2"] = StaticText('') if history_len < 13 : self["title0"] = StaticText(a) elif history_len < 21 : self["title0"] = StaticText('') self["title1"] = StaticText(a) else: self["title0"] = StaticText('') self["title1"] = StaticText('') self["title2"] = StaticText(a) # english title # if(t_history.thistory ==''): # t_history.thistory = str(etitle) + ' > ' # else: # t_history.thistory = t_history.thistory + str(etitle) + ' > ' if(t_history.thistory ==''): t_history.thistory = str(a) + ' > ' else: t_history.thistory = t_history.thistory + str(a) + ' > '
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "Plugins")) twinPlugins.append(plugin.name) ButtonSetupFunctions.append((_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG")) ButtonSetupFunctions.append((_("Main menu"), "Infobar/mainMenu", "InfoBar")) ButtonSetupFunctions.append((_("Show help"), "Infobar/showHelp", "InfoBar")) ButtonSetupFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) ButtonSetupFunctions.append((_("Volume down"), "Infobar/volumeDown", "InfoBar")) ButtonSetupFunctions.append((_("Volume up"), "Infobar/volumeUp", "InfoBar")) ButtonSetupFunctions.append((_("Show Infobar"), "Infobar/toggleShow", "InfoBar")) ButtonSetupFunctions.append((_("Show service list"), "Infobar/openServiceList", "InfoBar")) ButtonSetupFunctions.append((_("Show favourites list"), "Infobar/openBouquets", "InfoBar")) ButtonSetupFunctions.append((_("Show satellites list"), "Infobar/openSatellites", "InfoBar")) ButtonSetupFunctions.append((_("History back"), "Infobar/historyBack", "InfoBar")) ButtonSetupFunctions.append((_("History next"), "Infobar/historyNext", "InfoBar")) ButtonSetupFunctions.append((_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG")) ButtonSetupFunctions.append((_("Show event details"), "Infobar/openEventView", "EPG")) ButtonSetupFunctions.append((_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG")) ButtonSetupFunctions.append((_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG")) ButtonSetupFunctions.append((_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) ButtonSetupFunctions.append((_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) ButtonSetupFunctions.append((_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) ButtonSetupFunctions.append((_("Show servicelist or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) ButtonSetupFunctions.append((_("Show movies"), "Infobar/showMovies", "InfoBar")) ButtonSetupFunctions.append((_("Instant record"), "Infobar/instantRecord", "InfoBar")) ButtonSetupFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) ButtonSetupFunctions.append((_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) ButtonSetupFunctions.append((_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) ButtonSetupFunctions.append((_("Start teletext"), "Infobar/startTeletext", "InfoBar")) ButtonSetupFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) ButtonSetupFunctions.append((_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) ButtonSetupFunctions.append((_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) if SystemInfo["PIPAvailable"]: ButtonSetupFunctions.append((_("Show PIP"), "Infobar/showPiP", "InfoBar")) ButtonSetupFunctions.append((_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) ButtonSetupFunctions.append((_("Move PIP"), "Infobar/movePiP", "InfoBar")) ButtonSetupFunctions.append((_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar")) ButtonSetupFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) ButtonSetupFunctions.append((_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) ButtonSetupFunctions.append((_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) if SystemInfo["LcdLiveTV"]: ButtonSetupFunctions.append((_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) ButtonSetupFunctions.append((_("Hotkey Setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup")) ButtonSetupFunctions.append((_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) ButtonSetupFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) ButtonSetupFunctions.append((_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) ButtonSetupFunctions.append((_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) ButtonSetupFunctions.append((_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): ButtonSetupFunctions.append((plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) ButtonSetupFunctions.append((_("Network setup"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) ButtonSetupFunctions.append((_("Network menu"), "Infobar/showNetworkMounts", "Setup")) ButtonSetupFunctions.append((_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) ButtonSetupFunctions.append((_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) ButtonSetupFunctions.append((_("SkinSelector"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) ButtonSetupFunctions.append((_("LCD SkinSelector"), "Module/Screens.SkinSelector/LcdSkinSelector", "Setup")) ButtonSetupFunctions.append((_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) ButtonSetupFunctions.append((_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: ButtonSetupFunctions.append((plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) ButtonSetupFunctions.append((_("Standby"), "Module/Screens.Standby/Standby", "Power")) ButtonSetupFunctions.append((_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) ButtonSetupFunctions.append((_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) ButtonSetupFunctions.append((_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) ButtonSetupFunctions.append((_("SleepTimer"), "Module/Screens.SleepTimerEdit/SleepTimerEdit", "Power")) ButtonSetupFunctions.append((_("PowerTimer"), "Module/Screens.PowerTimerEdit/PowerTimerEditList", "Power")) ButtonSetupFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) ButtonSetupFunctions.append((_("User interface settings"), "Setup/userinterface", "Setup")) ButtonSetupFunctions.append((_("Recording Setup"), "Setup/recording", "Setup")) ButtonSetupFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup")) ButtonSetupFunctions.append((_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) ButtonSetupFunctions.append((_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) ButtonSetupFunctions.append((_("OscamInfo Mainmenu"), "Module/Screens.OScamInfo/OscamInfoMenu", "Plugins")) if os.path.isdir("/etc/ppanels"): for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]: x = x[:-4] ButtonSetupFunctions.append((_("PPanel") + " " + x, "PPanel/" + x, "PPanels")) if os.path.isdir("/usr/script"): for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]: x = x[:-3] ButtonSetupFunctions.append((_("Shellscript") + " " + x, "Shellscript/" + x, "Shellscripts")) if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/ScriptRunner.pyo"): ButtonSetupFunctions.append((_("ScriptRunner"), "ScriptRunner/", "Plugins")) if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/QuickMenu.pyo"): ButtonSetupFunctions.append((_("QuickMenu"), "QuickMenu/", "Plugins")) if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo"): ButtonSetupFunctions.append((_("Kodi MediaCenter"), "Kodi/", "Plugins")) return ButtonSetupFunctions
def getHotkeyFunctions(): hotkeyFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[pathLen:]): twinPaths[plugin.path[pathLen:]] += 1 else: twinPaths[plugin.path[pathLen:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[pathLen:] + "/" + str(twinPaths[plugin.path[pathLen:]]), "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[pathLen:]): twinPaths[plugin.path[pathLen:]] += 1 else: twinPaths[plugin.path[pathLen:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[pathLen:] + "/" + str(twinPaths[plugin.path[pathLen:]]), "Plugins")) twinPlugins.append(plugin.name) hotkeyFunctions.append((_("Show Graphical Multi EPG"), "Infobar/openGraphEPG", "EPG")) hotkeyFunctions.append((_("Show Event View"), "Infobar/openEventView", "EPG")) hotkeyFunctions.append((_("Show Event Info Plugins"), "Infobar/showEventInfoPlugins", "EPG")) hotkeyFunctions.append((_("Show Single Service EPG"), "Infobar/openSingleServiceEPG", "EPG")) hotkeyFunctions.append((_("Show Multi Service EPG"), "Infobar/openMultiServiceEPG", "EPG")) hotkeyFunctions.append((_("Show Infobar EPG"), "Infobar/openInfoBarEPG", "EPG")) hotkeyFunctions.append((_("Main Menu"), "Infobar/mainMenu", "InfoBar")) hotkeyFunctions.append((_("Show Help"), "Infobar/showHelp", "InfoBar")) hotkeyFunctions.append((_("Toggle Infobar/SecondInfobar"), "Infobar/toggleShow", "InfoBar")) hotkeyFunctions.append((_("Show First Infobar"), "Infobar/showFirstInfoBar", "InfoBar")) hotkeyFunctions.append((_("Show Second Infobar"), "Infobar/showSecondInfoBar", "InfoBar")) hotkeyFunctions.append((_("Show Extension Selection"), "Infobar/showExtensionSelection", "InfoBar")) hotkeyFunctions.append((_("Show Plugin Selection"), "Infobar/showPluginBrowser", "InfoBar")) hotkeyFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) hotkeyFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) hotkeyFunctions.append((_("BackZap [0]"), "Infobar/BackZap", "InfoBar")) hotkeyFunctions.append((_("Volume down"), "Infobar/volumeDown", "InfoBar")) hotkeyFunctions.append((_("Volume up"), "Infobar/volumeUp", "InfoBar")) hotkeyFunctions.append((_("Switch Channel up in Infobar"), "Infobar/switchChannelUp", "InfoBar")) hotkeyFunctions.append((_("Switch Channel down in Infobar"), "Infobar/switchChannelDown", "InfoBar")) hotkeyFunctions.append((_("Show Service List"), "Infobar/openServiceList", "InfoBar")) hotkeyFunctions.append((_("History Zap Menu Plus"), "Infobar/historyZapForward", "InfoBar")) hotkeyFunctions.append((_("History Zap Menu Minus"), "Infobar/historyZapBackward", "InfoBar")) hotkeyFunctions.append((_("History Zap Menu"), "Infobar/historyZapMenu", "InfoBar")) hotkeyFunctions.append((_("History back"), "Infobar/historyBack", "InfoBar")) hotkeyFunctions.append((_("History next"), "Infobar/historyNext", "InfoBar")) hotkeyFunctions.append((_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) hotkeyFunctions.append((_("Enable digital downmix"), "Infobar/audioDownmixOn", "InfoBar")) hotkeyFunctions.append((_("Disable digital downmix"), "Infobar/audioDownmixOff", "InfoBar")) hotkeyFunctions.append((_("Switch to Radio Mode"), "Infobar/showRadio", "InfoBar")) hotkeyFunctions.append((_("Switch to TV Mode"), "Infobar/showTv", "InfoBar")) hotkeyFunctions.append((_("Toggle between TV and Radio mode"), "Infobar/toogleTvRadio", "InfoBar")) hotkeyFunctions.append((_("Show Favourites List"), "Infobar/openFavouritesList", "InfoBar")) hotkeyFunctions.append((_("Show Satellites List"), "Infobar/openSatellites", "InfoBar")) hotkeyFunctions.append((_("Show Movies"), "Infobar/showMovies", "InfoBar")) hotkeyFunctions.append((_("Instant Record"), "Infobar/instantRecord", "InfoBar")) hotkeyFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) hotkeyFunctions.append((_("Start Timeshift"), "Infobar/startTimeshift", "InfoBar")) hotkeyFunctions.append((_("Stop Timeshift"), "Infobar/stopTimeshift", "InfoBar")) hotkeyFunctions.append((_("Start Teletext"), "Infobar/startTeletext", "InfoBar")) hotkeyFunctions.append((_("Show Subservice Selection"), "Infobar/subserviceSelection", "InfoBar")) hotkeyFunctions.append((_("Show Subtitle Selection"), "Infobar/subtitleSelection", "InfoBar")) hotkeyFunctions.append((_("Show subtitle quick menu"), "Infobar/subtitleQuickMenu", "InfoBar")) hotkeyFunctions.append((_("Letterbox Zoom"), "Infobar/vmodeSelection", "InfoBar")) hotkeyFunctions.append((_("ZoomInOut"), "InfobarGenerics/ZoomInOut", "InfoBar")) hotkeyFunctions.append((_("ZoomOff"), "InfobarGenerics/ZoomInOut", "InfoBar")) hotkeyFunctions.append((_("Show Seekbar"), "Infobar/seekFwdVod", "InfoBar")) hotkeyFunctions.append((_("Do nothing"), "Void", "InfoBar")) if SystemInfo["PIPAvailable"]: hotkeyFunctions.append((_("Show Picture In Picture"), "Infobar/showPiP", "InfoBar")) hotkeyFunctions.append((_("Swap Picture In Picture"), "Infobar/swapPiP", "InfoBar")) hotkeyFunctions.append((_("Move Picture In Picture"), "Infobar/movePiP", "InfoBar")) hotkeyFunctions.append((_("Toggle Picture In Picture Zap"), "Infobar/togglePipzap", "InfoBar")) hotkeyFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) if getHaveHDMIinHD() in ('True') or getHaveHDMIinFHD() in ('True'): hotkeyFunctions.append((_("Toggle HDMI-In Full Screen"), "Infobar/HDMIInFull", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI-In Picture In Picture"), "Infobar/HDMIInPiP", "InfoBar")) if SystemInfo["LcdLiveTV"]: hotkeyFunctions.append((_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) if SystemInfo["canMultiBoot"]: hotkeyFunctions.append((_("MultiBootSelector"), "Module/Screens.MultiBootSelector/MultiBootSelector", "InfoBar")) hotkeyFunctions.append((_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup")) hotkeyFunctions.append((_("Software Update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) if getHaveCI() in ('True'): hotkeyFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) hotkeyFunctions.append((_("Videosetup"), "Module/Screens.VideoMode/VideoSetup", "Setup")) hotkeyFunctions.append((_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) hotkeyFunctions.append((_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) hotkeyFunctions.append((_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): hotkeyFunctions.append((plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) hotkeyFunctions.append((_("Network Adapter"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) hotkeyFunctions.append((_("Network Menu"), "Infobar/showNetworkMounts", "Setup")) hotkeyFunctions.append((_("VPN"), "Module/Screens.NetworkSetup/NetworkOpenvpn", "Setup")) hotkeyFunctions.append((_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) hotkeyFunctions.append((_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) hotkeyFunctions.append((_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) hotkeyFunctions.append((_("PowerTimer"), "Module/Screens.PowerTimerEdit/PowerTimerEditList", "Setup")) hotkeyFunctions.append((_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) hotkeyFunctions.append((_("Memory Info"), "Module/Screens.About/MemoryInfo", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: hotkeyFunctions.append((plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) hotkeyFunctions.append((_("Standby"), "Module/Screens.Standby/Standby", "Power")) hotkeyFunctions.append((_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) hotkeyFunctions.append((_("Restart Enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) hotkeyFunctions.append((_("Deep-Standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) hotkeyFunctions.append((_("SleepTimer"), "Module/Screens.SleepTimerEdit/SleepTimerEdit", "Power")) hotkeyFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) hotkeyFunctions.append((_("User Interface"), "Setup/userinterface", "Setup")) hotkeyFunctions.append((_("Recording Setup"), "Setup/recording", "Setup")) hotkeyFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup")) hotkeyFunctions.append((_("Device Manager"), "DeviceManager", "Setup")) hotkeyFunctions.append((_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) hotkeyFunctions.append((_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) hotkeyFunctions.append((_("Skin setup"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) hotkeyFunctions.append((_("OscamInfo"), "Module/Screens.OScamInfo/OscamInfoMenu", "Plugins")) hotkeyFunctions.append((_("CCcamInfo"), "Module/Screens.CCcamInfo/CCcamInfoMain", "Plugins")) if os.path.isfile(ppath + "/Plugins/Extensions/Kodi/plugin.pyo"): hotkeyFunctions.append((_("Kodi Media Center"), "Kodi/", "Plugins")) if os.path.isdir("/etc/ppanel"): for x in [x for x in os.listdir("/etc/ppanel") if x.endswith(".xml")]: x = x[:-4] hotkeyFunctions.append((_("PPanel") + " " + x, "PPanel/" + x, "PPanels")) if os.path.isdir("/usr/scripts"): for x in [x for x in os.listdir("/usr/scripts") if x.endswith(".sh")]: x = x[:-3] hotkeyFunctions.append((_(" ") + " " + x, "Shellscript/" + x, "Shellscripts")) return hotkeyFunctions
def getHotkeyFunctions(): hotkeyFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append( (plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "Plugins")) twinPlugins.append(plugin.name) hotkeyFunctions.append((_("Main menu"), "Infobar/mainMenu", "InfoBar")) hotkeyFunctions.append((_("Show help"), "Infobar/showHelp", "InfoBar")) hotkeyFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) hotkeyFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) hotkeyFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) hotkeyFunctions.append( (_("Switch channel up"), "Infobar/switchChannelUp", "InfoBar")) hotkeyFunctions.append( (_("Switch channel down"), "Infobar/switchChannelDown", "InfoBar")) hotkeyFunctions.append( (_("Show service list"), "Infobar/openServiceList", "InfoBar")) hotkeyFunctions.append((_("Show movies"), "Infobar/showMovies", "InfoBar")) hotkeyFunctions.append((_("Show servicelist or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) hotkeyFunctions.append( (_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar")) hotkeyFunctions.append( (_("History back"), "Infobar/historyBack", "InfoBar")) hotkeyFunctions.append( (_("History next"), "Infobar/historyNext", "InfoBar")) hotkeyFunctions.append( (_("Recall to previous service"), "Infobar/servicelist/recallPrevService", "InfoBar")) hotkeyFunctions.append( (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG")) hotkeyFunctions.append( (_("Show event details"), "Infobar/openEventView", "EPG")) hotkeyFunctions.append( (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG")) hotkeyFunctions.append( (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG")) hotkeyFunctions.append( (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) hotkeyFunctions.append( (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) hotkeyFunctions.append( (_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) hotkeyFunctions.append( (_("Toggle TV/RADIO mode"), "Infobar/toggleTvRadio", "InfoBar")) hotkeyFunctions.append( (_("Instant record"), "Infobar/instantRecord", "InfoBar")) hotkeyFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) hotkeyFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) hotkeyFunctions.append((_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) hotkeyFunctions.append( (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) hotkeyFunctions.append( (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) hotkeyFunctions.append( (_("Start teletext"), "Infobar/startTeletext", "InfoBar")) hotkeyFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) hotkeyFunctions.append( (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) hotkeyFunctions.append( (_("Show InfoBar"), "Infobar/showFirstInfoBar", "InfoBar")) hotkeyFunctions.append( (_("Show second InfoBar"), "Infobar/showSecondInfoBar", "InfoBar")) hotkeyFunctions.append( (_("Toggle infoBar"), "Infobar/toggleShow", "InfoBar")) hotkeyFunctions.append( (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) if SystemInfo["PIPAvailable"]: hotkeyFunctions.append((_("Show PIP"), "Infobar/showPiP", "InfoBar")) hotkeyFunctions.append((_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) hotkeyFunctions.append((_("Move PIP"), "Infobar/movePiP", "InfoBar")) hotkeyFunctions.append( (_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar")) hotkeyFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI In"), "Infobar/HDMIIn", "InfoBar")) if SystemInfo["LcdLiveTV"]: hotkeyFunctions.append( (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) hotkeyFunctions.append( (_("Toggle dashed flickering line for this service"), "Infobar/ToggleHideVBI", "InfoBar")) hotkeyFunctions.append((_("Do nothing"), "Void", "InfoBar")) if SystemInfo["HasHDMI-CEC"]: hotkeyFunctions.append((_("HDMI-CEC Source Active"), "Infobar/SourceActiveHdmiCec", "InfoBar")) hotkeyFunctions.append((_("HDMI-CEC Source Inactive"), "Infobar/SourceInactiveHdmiCec", "InfoBar")) if SystemInfo["HasSoftcamInstalled"]: hotkeyFunctions.append((_("Softcam Setup"), "SoftcamSetup", "Setup")) hotkeyFunctions.append( (_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup")) hotkeyFunctions.append( (_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) hotkeyFunctions.append( (_("Latest Commits"), "Module/Screens.About/CommitInfo", "Setup")) hotkeyFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) hotkeyFunctions.append( (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) hotkeyFunctions.append( (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) hotkeyFunctions.append((_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): hotkeyFunctions.append( (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) hotkeyFunctions.append( (_("Network"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) hotkeyFunctions.append( (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) hotkeyFunctions.append( (_("Sleeptimer edit"), "Module/Screens.SleepTimerEdit/SleepTimerEdit", "Setup")) hotkeyFunctions.append( (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) hotkeyFunctions.append( (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: hotkeyFunctions.append( (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) for plugin in plugins.getPluginsForMenu("video"): if plugin[2]: hotkeyFunctions.append( (plugin[0], "MenuPlugin/video/" + plugin[2], "Setup")) hotkeyFunctions.append((_("PowerMenu"), "Menu/shutdown", "Power")) hotkeyFunctions.append( (_("Standby"), "Module/Screens.Standby/Standby", "Power")) hotkeyFunctions.append( (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) hotkeyFunctions.append( (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) hotkeyFunctions.append( (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) hotkeyFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) hotkeyFunctions.append( (_("User interface"), "Setup/userinterface", "Setup")) hotkeyFunctions.append((_("Recording Setup"), "Setup/recording", "Setup")) hotkeyFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup")) hotkeyFunctions.append( (_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) hotkeyFunctions.append( (_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) hotkeyFunctions.append( (_("Memory Info"), "Module/Screens.About/MemoryInfo", "Setup")) if os.path.isdir("/etc/ppanels"): for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]: x = x[:-4] hotkeyFunctions.append( (_("PPanel") + " " + x, "PPanel/" + x, "PPanels")) if os.path.isdir("/usr/script"): for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]: x = x[:-3] hotkeyFunctions.append((_("Shellscript") + " " + x, "Shellscript/" + x, "Shellscripts")) return hotkeyFunctions
def createMenuList(self, showNumericHelp=False): self.menuList = [] self.menuID = None for x in self.parentMenu: # walk through the actual nodelist if not x.tag: continue if x.tag == "item": itemLevel = int(x.get("level", 0)) if itemLevel <= config.usage.setup_level.index: self.addItem(self.menuList, x) count += 1 elif x.tag == "menu": itemLevel = int(x.get("level", 0)) if itemLevel <= config.usage.setup_level.index: self.addMenu(self.menuList, 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: description = _( x.get("description", "").encode( "UTF-8", "ignore")) if PY2 else _( x.get("description", "")) menupng = MenuEntryPixmap(self.menuID, self.png_cache, lastMenuID) self.menuList.append( (x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4], description, menupng)) 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.menuList: if x[2] == plugin_menuid: self.menuList.remove(x) break description = plugins.getDescriptionForMenuEntryID( self.menuID, plugin_menuid) menupng = MenuEntryPixmap(l[2], self.png_cache, lastMenuID) if len(l) > 4 and l[4]: self.menuList.append( (l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50, description, menupng)) else: self.menuList.append( (l[0], boundFunction(l[1], self.session), l[2], l[3] or 50, description, menupng)) if config.usage.menu_sort_mode.value == "user" 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 config.usage.menu_sort_mode.value == "user": self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue( self.menuID, "submenu") or {} idx = 0 for x in self.menuList: entry = list(self.menuList.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue( entry[2], "sort") or entry[3] entry.append(m_weight) self.menuList.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], "sort", m_weight) idx += 1 self.full_list = list(self.menuList) if config.usage.menu_sort_mode.value == "a_z": # Sort by Name self.menuList.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == "user": self["blue"].setText(_("Edit Mode On")) self.hide_show_entries() else: # Sort by Weight self.menuList.sort(key=lambda x: int(x[3])) if config.usage.menu_show_numbers.value: self.menuList = [(str(x[0] + 1) + " " + x[1][0], x[1][1], x[1][2]) for x in enumerate(self.menuList)] self["menu"].setList(self.menuList)
def __init__(self, session, plugin_path, args = 0): Screen.__init__(self, session) self.skin_path = plugin_path self.session = session self.title = _('VTI custom main menu') try: self['title'] = StaticText(self.title) except: print 'self["title"] was not found in skin' mdom = xml.etree.cElementTree.parse(resolveFilename(SCOPE_SKIN, 'menu.xml')).getroot() self.entrylist = [] self.removelist = [] self.addlist = [] templist = config.plugins.vtipanel.menunotshown.value for tempitem in templist.split(','): self.removelist.append(tempitem) templist = config.plugins.vtipanel.menushown.value for tempitem in templist.split(','): self.addlist.append(tempitem) self['menu'] = List(self.entrylist) self['key_red'] = StaticText(_('Cancel')) self['key_green'] = StaticText(_('Save')) self['key_yellow'] = StaticText(_('Default')) self['shortcuts'] = ActionMap(['SetupActions', 'ColorActions'], {'ok': self.keyOk, 'cancel': self.keyCancel, 'green': self.keySave, 'yellow': self.keyYellow}, -2) self.statusok = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, 'SystemPlugins/VTIPanel/pictures/installed.png')) self.statusremove = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, 'SystemPlugins/VTIPanel/pictures/remove.png')) searchmenus = 'item,menu' nodetype = 'menu' for searchmenu in searchmenus.split(','): for node in mdom.findall(searchmenu): nodetext = node.get('text').encode('UTF-8') nodeID = node.get('entryID', 'undefined') nodeweight = node.get('weight', 50) if nodeID in self.removelist: statuspng = self.statusremove else: statuspng = self.statusok self.entrylist.append((_(nodetext), nodeID, statuspng, nodeweight, nodetype)) searchplugins = 'mainmenu' nodetype = 'menu_plugin' for searchplugin in searchplugins.split(','): for l in plugins.getPluginsForMenu(searchplugin): nodeID = l[2] nodetext = l[0].encode('UTF-8') nodeweight = node.get('weight', 50) if nodeID in self.removelist: statuspng = self.statusremove else: statuspng = self.statusok self.entrylist.append((_(nodetext), nodeID, statuspng, nodeweight, nodetype)) nodetype = 'plugin' id_list = [] for l in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]): l.id = l.name.lower().replace(' ', '_') if len(inspect.getargspec(l.__call__).args) == 1: if l.id not in id_list: nodeweight = 10 id_list.append(l.id) if l.id in self.addlist: statuspng = self.statusok else: statuspng = self.statusremove self.entrylist.append((_(l.name), l.id, statuspng, nodeweight, nodetype)) self['menu'].setList(self.entrylist)
def __init__(self, session, parent): Screen.__init__(self, session) self.sort_mode = False self.selected_entry = None self.sub_menu_sort = None self['key_green'] = Label() self['key_yellow'] = Label() self['key_blue'] = Label() m_list = [] menuID = None for x in parent: if not x.tag: continue if x.tag == 'item': item_level = int(x.get('level', 0)) if item_level <= config.usage.setup_level.index: self.addItem(m_list, x) count += 1 elif x.tag == 'menu': item_level = int(x.get('level', 0)) if item_level <= config.usage.setup_level.index: self.addMenu(m_list, x) count += 1 elif x.tag == 'id': menuID = x.get('val') count = 0 if menuID is not None: if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: description = x.get('description', '').encode('UTF-8') or None description = description and _(description) menupng = MenuEntryPixmap(menuID, self.png_cache, lastMenuID) m_list.append( (x[0], boundFunction(self.runScreen, (x[2], x[3] + ', ')), x[4], description, menupng)) count += 1 self.menuID = menuID if config.ParentalControl.configured.value: ProtectedScreen.__init__(self) if menuID is not None: for l in plugins.getPluginsForMenu(menuID): plugin_menuid = l[2] for x in m_list: if x[2] == plugin_menuid: m_list.remove(x) break description = plugins.getDescriptionForMenuEntryID( menuID, plugin_menuid) menupng = MenuEntryPixmap(l[2], self.png_cache, lastMenuID) if len(l) > 4 and l[4]: m_list.append( (l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50, description, menupng)) else: m_list.append( (l[0], boundFunction(l[1], self.session), l[2], l[3] or 50, description, menupng)) self.skinName = [] if menuID is not None: if config.usage.menutype.value == 'horzanim' and skin.dom_screens.has_key( 'Animmain'): self.skinName.append('Animmain') elif config.usage.menutype.value == 'horzicon' and skin.dom_screens.has_key( 'Iconmain'): self.skinName.append('Iconmain') else: self.skinName.append('menu_' + menuID) self.skinName.append('Menu') self.menuID = menuID ProtectedScreen.__init__(self) if config.usage.menu_sort_mode.value == 'user' and menuID == 'mainmenu': plugin_list = [] id_list = [] for l in plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]): l.id = l.name.lower().replace(' ', '_') if l.id not in id_list: id_list.append(l.id) plugin_list.append( (l.name, boundFunction(l.__call__, session), l.id, 200)) self.list = m_list if menuID is not None and config.usage.menu_sort_mode.value == 'user': self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue( self.menuID, 'submenu') or {} idx = 0 for x in self.list: entry = list(self.list.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue( entry[2], 'sort') or entry[3] entry.append(m_weight) self.list.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], 'sort', m_weight) idx += 1 self.full_list = list(m_list) if config.usage.menu_sort_mode.value == 'a_z': m_list.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == 'user': self['key_blue'].setText(_('Edit mode on')) self.hide_show_entries() m_list = self.list else: m_list.sort(key=lambda x: int(x[3])) if config.usage.menu_show_numbers.value: m_list = [(str(x[0] + 1) + ' ' + x[1][0], x[1][1], x[1][2]) for x in enumerate(m_list)] self['menu'] = List(m_list) self['menu'].enableWrapAround = True if config.usage.menu_sort_mode.value == 'user': self['menu'].onSelectionChanged.append(self.selectionChanged) self['actions'] = NumberActionMap( ['OkCancelActions', 'MenuActions', 'NumberActions'], { 'ok': self.okbuttonClick, 'cancel': self.closeNonRecursive, 'menu': self.closeRecursive, '0': self.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 }) if config.usage.menu_sort_mode.value == 'user': self['MoveActions'] = ActionMap( ['WizardActions'], { 'left': self.keyLeft, 'right': self.keyRight, 'up': self.keyUp, 'down': self.keyDown }, -1) self['EditActions'] = ActionMap( ['ColorActions'], { 'green': self.keyGreen, 'yellow': self.keyYellow, 'blue': self.keyBlue }) a = parent.get('title', '').encode('UTF-8') or None a = a and _(a) if a is None: a = _(parent.get('text', '').encode('UTF-8')) else: t_history.reset() self['title'] = StaticText(a) Screen.setTitle(self, a) self.menu_title = a self['thistory'] = StaticText(t_history.thistory) history_len = len(t_history.thistory) self['title0'] = StaticText('') self['title1'] = StaticText('') self['title2'] = StaticText('') if history_len < 13: self['title0'] = StaticText(a) elif history_len < 21: self['title0'] = StaticText('') self['title1'] = StaticText(a) else: self['title0'] = StaticText('') self['title1'] = StaticText('') self['title2'] = StaticText(a) if t_history.thistory == '': t_history.thistory = str(a) + ' > ' else: t_history.thistory = t_history.thistory + str(a) + ' > ' if config.usage.menutype.value == 'horzanim' and skin.dom_screens.has_key( 'Animmain'): self['label1'] = StaticText() self['label2'] = StaticText() self['label3'] = StaticText() self['label4'] = StaticText() self['label5'] = StaticText() self.onShown.append(self.openTestA) elif config.usage.menutype.value == 'horzicon' and skin.dom_screens.has_key( 'Iconmain'): self['label1'] = StaticText() self['label2'] = StaticText() self['label3'] = StaticText() self['label4'] = StaticText() self['label5'] = StaticText() self['label6'] = StaticText() self['label1s'] = StaticText() self['label2s'] = StaticText() self['label3s'] = StaticText() self['label4s'] = StaticText() self['label5s'] = StaticText() self['label6s'] = StaticText() self['pointer'] = Pixmap() self['pixmap1'] = Pixmap() self['pixmap2'] = Pixmap() self['pixmap3'] = Pixmap() self['pixmap4'] = Pixmap() self['pixmap5'] = Pixmap() self['pixmap6'] = Pixmap() self.onShown.append(self.openTestB) self.number = 0 self.nextNumberTimer = eTimer() self.nextNumberTimer.callback.append(self.okbuttonClick)
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[pathLen:]): twinPaths[plugin.path[pathLen:]] += 1 else: twinPaths[plugin.path[pathLen:]] = 1 if plugin.path[pathLen:] + "/" + str(twinPaths[plugin.path[pathLen:]])== "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[pathLen:]): twinPaths[plugin.path[pathLen:]] += 1 else: twinPaths[plugin.path[pathLen:]] = 1 if plugin.path[pathLen:] + "/" + str(twinPaths[plugin.path[pathLen:]])== "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir(ppath+"/Plugins/Extensions/PPanel"): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/scripts/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir(ppath+"/Plugins/Extensions/PPanel"): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: os.system(command) elif selected[0] == "EMC": try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance)) except Exception as e: print('[EMCPlayer] showMovies exception:\n' + str(e)) elif selected[0] == "Kodi": if os.path.isfile(ppath+"/Plugins/Extensions/Kodi/plugin.pyo"): from Plugins.Extensions.Kodi.plugin import KodiMainScreen self.session.open(KodiMainScreen) elif selected[0] == "DeviceManager": from Plugins.SystemPlugins.DeviceManager.HddSetup import * self.session.open(HddSetup)
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import " + selected[2] exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": from Screens.Setup import Setup exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0][:3] == "Zap": if selected[0] == "ZapPanic": self.servicelist.history = [] self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0][-6:] == "script": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command): if selected[0] == "Backgroundscript": from Components.Console import Console as eConsole message = _("Execute %s") % (selected[1] + ".sh") self.session.open(MessageBox, message, type = MessageBox.TYPE_INFO, timeout = 2) eConsole().ePopen(command) elif os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: from Screens.Console import Console as sConsole self.session.open(sConsole, cmdlist = [command])
def reloadMenu(self): self.list = [] count = 0 if self.parent is not None: for x in self.parent: 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') self.default = str(x.get('default', 0)) self.update = int(x.get('update', 0)) self.overrides = int(x.get('overrides', 1)) self.findmenu = int(x.get('findmenu', self.findmenu)) self.endtext = str(x.get('endtext', '>')) count = 0 if self.menuID is not None: 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 is not None: for l in plugins.getPluginsForMenu(self.menuID): if self.overrides: plugin_menuid = l[2] for x in self.list: if x[2] == plugin_menuid: self.list.remove(x) break endtext = self.endtext if len(l) > 4: endtext = l[4] if len(l) > 5: if l[5] is None: menuitem = [ l[0], boundFunction(self.runPlugin, (l[1], l[6])), l[2], l[3] or 50, endtext, None ] else: menuitem = [ l[0], boundFunction(self.runPlugin, (l[1], l[6])), l[2], l[3] or 50, endtext, boundFunction(self.runPlugin, (l[5], l[6])) ] for x in range(7, len(l)): menuitem.append(l[x]) else: menuitem = [ l[0], boundFunction(self.runPlugin, (l[1], None)), l[2], l[3] or 50, endtext, None ] self.list.append(tuple(menuitem)) try: if self.sort == 'sort': self.list.sort(key=lambda x: int(x[3])) if self.sort == 'reverse': self.list.sort(key=lambda x: int(x[3])) self.list.reverse() except: if self.sort == 'sort': self.list.sort(key=lambda x: x[3]) if self.sort == 'reverse': self.list.sort(key=lambda x: x[3]) self.list.reverse() if self.findmenu == 1: self.charlist = {} for x in self.list: title = x[0].decode('UTF-8', 'ignore') if len(title) > 0: if len(title) > 3 and title[ 2:4] == '. ' and title[:2].isdigit(): char = title[4].upper() else: char = title[0].upper() self.charlist[char] = CharEntryComponent( char.encode('UTF-8')) self['menu'].setList(self.list)
def createMenuList(self): self.list = [] self.menuID = None count = 0 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 is not None: if menuupdater.updatedMenuAvailable(self.menuID): for x in menuupdater.getUpdatedMenu(self.menuID): if x[1] == count: description = x.get('description', '').encode('UTF-8') or None description = description and _(description) menupng = MenuEntryPixmap(self.menuID, self.png_cache, lastMenuID) self.list.append( (x[0], boundFunction(self.runScreen, (x[2], x[3] + ', ')), x[4], description, menupng)) count += 1 if self.menuID is not None: for l in plugins.getPluginsForMenu(self.menuID): plugin_menuid = l[2] for x in self.list: if x[2] == plugin_menuid: self.list.remove(x) break description = plugins.getDescriptionForMenuEntryID( self.menuID, plugin_menuid) menupng = MenuEntryPixmap(l[2], self.png_cache, lastMenuID) self.list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50, description, menupng)) if config.usage.menu_sort_mode.value == 'user' 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 config.usage.menu_sort_mode.value == 'user': self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue( self.menuID, 'submenu') or {} idx = 0 for x in self.list: entry = list(self.list.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue( entry[2], 'sort') or entry[3] entry.append(m_weight) self.list.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], 'sort', m_weight) idx += 1 self.full_list = list(self.list) if config.usage.menu_sort_mode.value == 'a_z': self.list.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == 'user': self.hide_show_entries() else: self.list.sort(key=lambda x: int(x[3])) if config.usage.menu_show_numbers.value: 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)
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[ButtonSetup] error during executing module %s, screen %s" % ( selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: from Screens.Console import Console exec "self.session.open(Console,_(selected[1]),[command])" elif selected[0] == "EMC": try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance)) except Exception as e: print('[EMCPlayer] showMovies exception:\n' + str(e)) elif selected[0] == "ScriptRunner": if os.path.isfile( "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/ScriptRunner.pyo" ): from Plugins.Extensions.Infopanel.ScriptRunner import ScriptRunner self.session.open(ScriptRunner) elif selected[0] == "QuickMenu": if os.path.isfile( "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/QuickMenu.pyo" ): from Plugins.Extensions.Infopanel.QuickMenu import QuickMenu self.session.open(QuickMenu) elif selected[0] == "Kodi": if os.path.isfile( "/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo" ): from Plugins.Extensions.Kodi.plugin import KodiMainScreen self.session.open(KodiMainScreen)
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec("self." + ".".join(selected[1:]) + "()") else: return 0 elif selected[0] == "Module": try: exec("from %s import %s" % (selected[1], selected[2])) exec("self.session.open(%s)" % ",".join(selected[2:])) except: print( "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2])) elif selected[0] == "SoftcamSetup" and SystemInfo[ "HasSoftcamInstalled"]: from Screens.SoftcamSetup import SoftcamSetup self.session.open(SoftcamSetup) elif selected[0] == "Setup": from Screens.Setup import Setup exec("self.session.open(Setup, \"%s\")" % selected[1]) elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir( resolveFilename(SCOPE_PLUGINS, 'Extensions/PPanel')): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command): if ".hidden." in command: from enigma import eConsoleAppContainer eConsoleAppContainer().execute(command) else: from Screens.Console import Console self.session.open( Console, selected[1] + " shellscript", command, closeOnSuccess=selected[1].startswith('!'), showStartStopText=False) elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break
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 self.skinName = [ ] if menuID is not None: if menuID == "vtimain": self.skinName.append("menu_system") else: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") ## VTi function moved from VTiPanel to Menu Screen if config.usage.menu_sort_mode.value == "user" and menuID == "mainmenu": plugin_list = [] id_list = [] for l in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]): l.id = (l.name.lower()).replace(' ','_') if l.id not in id_list: id_list.append(l.id) plugin_list.append((l.name, boundFunction(l.__call__, session), l.id, 200)) addlist = config.plugins.vtipanel.menushown.value addlist = addlist.split(',') for entry in plugin_list: if entry[2] in addlist: m_list.append(entry) self.list = m_list if menuID is not None and config.usage.menu_sort_mode.value == "user": self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue(self.menuID, "submenu") or {} idx = 0 for x in self.list: entry = list(self.list.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue(entry[2], "sort") or entry[3] entry.append(m_weight) self.list.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], "sort", m_weight) idx += 1 self.full_list = list(m_list) if config.usage.menu_sort_mode.value == "a_z": # Sort by Name m_list.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == "user": self["blue"].setText(_("Edit mode on")) self.hide_show_entries() m_list = self.list else: # Sort by Weight m_list.sort(key=lambda x: int(x[3])) self["menu"] = List(m_list) self["menu"].enableWrapAround = True if config.usage.menu_sort_mode.value == "user": self["menu"].onSelectionChanged.append(self.selectionChanged) self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions"], { "ok": self.keyOk, "cancel": self.keyCancel, "menu": self.closeRecursive, "0": self.resetSortOrder, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal, }) if config.usage.menu_sort_mode.value == "user": self["MoveActions"] = ActionMap(["WizardActions"], { "left": self.keyLeft, "right": self.keyRight, "up": self.keyUp, "down": self.keyDown, }, -1 ) self["EditActions"] = ActionMap(["ColorActions"], { "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, }) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) if a is None: a = _(parent.get("text", "").encode("UTF-8")) # ikseong - enter Main menu else: t_history.reset() self["title"] = StaticText(a) self.menu_title = a # ikseong make menu title self["thistory"] = StaticText(t_history.thistory) history_len = len(t_history.thistory) self["title0"] = StaticText('') self["title1"] = StaticText('') self["title2"] = StaticText('') if history_len < 13 : self["title0"] = StaticText(a) elif history_len < 21 : self["title0"] = StaticText('') self["title1"] = StaticText(a) else: self["title0"] = StaticText('') self["title1"] = StaticText('') self["title2"] = StaticText(a) # english title # if(t_history.thistory ==''): # t_history.thistory = str(etitle) + ' > ' # else: # t_history.thistory = t_history.thistory + str(etitle) + ' > ' if(t_history.thistory ==''): t_history.thistory = str(a) + ' > ' else: t_history.thistory = t_history.thistory + str(a) + ' > '
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key( plugin.path[plugin.path.rfind("Plugins"):]): twinPaths[plugin.path[plugin.path.rfind("Plugins" ):]] += 1 else: twinPaths[ plugin.path[plugin.path.rfind("Plugins"):]] = 1 if plugin.path[ plugin.path.rfind("Plugins"):] + "/" + str( twinPaths[plugin.path[plugin.path.rfind( "Plugins"):]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key( plugin.path[plugin.path.rfind("Plugins"):]): twinPaths[plugin.path[plugin.path.rfind("Plugins" ):]] += 1 else: twinPaths[ plugin.path[plugin.path.rfind("Plugins"):]] = 1 if plugin.path[ plugin.path.rfind("Plugins"):] + "/" + str( twinPaths[plugin.path[plugin.path.rfind( "Plugins"):]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except Exception as e: print "[ButtonSetup] error during executing module %s, screen %s, %s" % ( selected[1], selected[2], e) import traceback traceback.print_exc() elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "Script": command = '/usr/script/' + selected[1] + ".sh" from Screens.Console import Console exec "self.session.open(Console,_(selected[1]),[command])" elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break
def getHotkeyFunctions(): hotkeyFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append( (plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "Plugins")) twinPlugins.append(plugin.name) hotkeyFunctions.append( (_("Show Graphical Multi EPG"), "Infobar/openGraphEPG", "EPG")) hotkeyFunctions.append( (_("Show Event View"), "Infobar/openEventView", "EPG")) hotkeyFunctions.append( (_("Show Eventinfo Plugins"), "Infobar/showEventInfoPlugins", "EPG")) hotkeyFunctions.append( (_("Show Single Service EPG"), "Infobar/openSingleServiceEPG", "EPG")) hotkeyFunctions.append( (_("Show Multi Service EPG"), "Infobar/openMultiServiceEPG", "EPG")) hotkeyFunctions.append( (_("Show Infobar EPG"), "Infobar/openInfoBarEPG", "EPG")) hotkeyFunctions.append((_("Main Menu"), "Infobar/mainMenu", "InfoBar")) hotkeyFunctions.append((_("Show Help"), "Infobar/showHelp", "InfoBar")) hotkeyFunctions.append( (_("Toggle Infobar/SecondInfobar"), "Infobar/toggleShow", "InfoBar")) hotkeyFunctions.append( (_("Show First InfoBar"), "Infobar/showFirstInfoBar", "InfoBar")) hotkeyFunctions.append( (_("Show Second InfoBar"), "Infobar/showSecondInfoBar", "InfoBar")) hotkeyFunctions.append((_("Show Extension Selection"), "Infobar/showExtensionSelection", "InfoBar")) hotkeyFunctions.append( (_("Show Plugin Selection"), "Infobar/showPluginBrowser", "InfoBar")) hotkeyFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) hotkeyFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) hotkeyFunctions.append((_("Volume down"), "Infobar/volumeDown", "InfoBar")) hotkeyFunctions.append((_("Volume up"), "Infobar/volumeUp", "InfoBar")) hotkeyFunctions.append((_("Switch Channel up in Infobar"), "Infobar/switchChannelUp", "InfoBar")) hotkeyFunctions.append((_("Switch Channel down in Infobar"), "Infobar/switchChannelDown", "InfoBar")) hotkeyFunctions.append( (_("Show Service List"), "Infobar/openServiceList", "InfoBar")) hotkeyFunctions.append( (_("History Zap Menu"), "Infobar/historyZap", "InfoBar")) hotkeyFunctions.append( (_("History back"), "Infobar/historyBack", "InfoBar")) hotkeyFunctions.append( (_("History next"), "Infobar/historyNext", "InfoBar")) hotkeyFunctions.append( (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) hotkeyFunctions.append( (_("Switch to Radio Mode"), "Infobar/showRadio", "InfoBar")) hotkeyFunctions.append( (_("Switch to TV Mode"), "Infobar/showTv", "InfoBar")) hotkeyFunctions.append( (_("Show Favourites List"), "Infobar/openFavouritesList", "InfoBar")) hotkeyFunctions.append( (_("Show Satellites List"), "Infobar/openSatellites", "InfoBar")) hotkeyFunctions.append((_("Show Movies"), "Infobar/showMovies", "InfoBar")) hotkeyFunctions.append( (_("Instant Record"), "Infobar/instantRecord", "InfoBar")) hotkeyFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) #hotkeyFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) #hotkeyFunctions.append((_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) hotkeyFunctions.append( (_("Start Timeshift"), "Infobar/startTimeshift", "InfoBar")) hotkeyFunctions.append( (_("Stop Timeshift"), "Infobar/stopTimeshift", "InfoBar")) hotkeyFunctions.append( (_("Start Teletext"), "Infobar/startTeletext", "InfoBar")) hotkeyFunctions.append((_("Show Subservice Selection"), "Infobar/subserviceSelection", "InfoBar")) hotkeyFunctions.append( (_("Show Subtitle Selection"), "Infobar/subtitleSelection", "InfoBar")) hotkeyFunctions.append( (_("Letterbox Zoom"), "Infobar/vmodeSelection", "InfoBar")) hotkeyFunctions.append( (_("ZoomInOut"), "InfobarGenerics/ZoomInOut", "InfoBar")) hotkeyFunctions.append( (_("ZoomOff"), "InfobarGenerics/ZoomInOut", "InfoBar")) if SystemInfo["PIPAvailable"]: hotkeyFunctions.append( (_("Show Picture In Picture"), "Infobar/showPiP", "InfoBar")) hotkeyFunctions.append( (_("Swap Picture In Picture"), "Infobar/swapPiP", "InfoBar")) hotkeyFunctions.append( (_("Move Picture In Picture"), "Infobar/movePiP", "InfoBar")) hotkeyFunctions.append((_("Toggle Picture In Picture Zap"), "Infobar/togglePipzap", "InfoBar")) hotkeyFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) hotkeyFunctions.append( (_("Toggle HDMI-In Full Screen"), "Infobar/HDMIInFull", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI-In Picture In Picture"), "Infobar/HDMIInPiP", "InfoBar")) hotkeyFunctions.append( (_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup")) hotkeyFunctions.append( (_("Software Update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) hotkeyFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) hotkeyFunctions.append( (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) hotkeyFunctions.append( (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) hotkeyFunctions.append((_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): hotkeyFunctions.append( (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) hotkeyFunctions.append( (_("Network"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) hotkeyFunctions.append( (_("Network Menu"), "Infobar/showNetworkMounts", "Setup")) hotkeyFunctions.append( (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) hotkeyFunctions.append( (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) hotkeyFunctions.append( (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) hotkeyFunctions.append( (_("PowerTimer"), "Module/Screens.PowerTimerEdit/PowerTimerEditList", "Setup")) hotkeyFunctions.append( (_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) hotkeyFunctions.append( (_("Memory Info"), "Module/Screens.About/MemoryInfo", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: hotkeyFunctions.append( (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) hotkeyFunctions.append( (_("Standby"), "Module/Screens.Standby/Standby", "Power")) hotkeyFunctions.append( (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) hotkeyFunctions.append( (_("Restart Enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) hotkeyFunctions.append( (_("Deep-Standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) hotkeyFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) hotkeyFunctions.append( (_("User Interface"), "Setup/userinterface", "Setup")) hotkeyFunctions.append((_("Recording Setup"), "Setup/recording", "Setup")) hotkeyFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup")) hotkeyFunctions.append( (_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) hotkeyFunctions.append( (_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) if os.path.isdir("/etc/ppanel"): for x in [x for x in os.listdir("/etc/ppanel") if x.endswith(".xml")]: x = x[:-4] hotkeyFunctions.append( (_("PPanel") + " " + x, "PPanel/" + x, "PPanels")) if os.path.isdir("/usr/scripts"): for x in [x for x in os.listdir("/usr/scripts") if x.endswith(".sh")]: x = x[:-3] hotkeyFunctions.append((_("Shellscript") + " " + x, "Shellscript/" + x, "Shellscripts")) if os.path.isfile( "/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/plugin.pyo" ): hotkeyFunctions.append((_("EnhancedMovieCenter"), "EMC/", "Plugins")) return hotkeyFunctions
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % ( selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break
ButtonSetupFunctions.append((_("Move PIP"), "Infobar/movePiP", "InfoBar")) ButtonSetupFunctions.append((_("Toggle PIP-ZAP"), "Infobar/togglePipzap", "InfoBar")) ButtonSetupFunctions.append((_("Activate HbbTV (RedButton)"), "Infobar/activateRedButton", "InfoBar")) if SystemInfo["HasHDMIin"]: ButtonSetupFunctions.append((_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) ButtonSetupFunctions.append((_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) if SystemInfo["LcdLiveTV"]: ButtonSetupFunctions.append((_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) ButtonSetupFunctions.append((_("Do nothing"), "Void", "InfoBar")) ButtonSetupFunctions.append((_("Button setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup")) ButtonSetupFunctions.append((_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) ButtonSetupFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) ButtonSetupFunctions.append((_("Show stream clients"), "Module/Screens.StreamingClientsInfo/StreamingClientsInfo", "Setup")) ButtonSetupFunctions.append((_("Manual scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) ButtonSetupFunctions.append((_("Automatic scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): ButtonSetupFunctions.append((plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) ButtonSetupFunctions.append((_("Network Setup"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) ButtonSetupFunctions.append((_("Network menu"), "Infobar/showNetworkMounts", "Setup")) ButtonSetupFunctions.append((_("Plugin browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) ButtonSetupFunctions.append((_("Channel info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) ButtonSetupFunctions.append((_("Timers"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) ButtonSetupFunctions.append((_("Autotimer overview"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: ButtonSetupFunctions.append((plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) ButtonSetupFunctions.append((_("Power menu"), "Menu/shutdown", "Power")) ButtonSetupFunctions.append((_("Standby"), "Module/Screens.Standby/Standby", "Power")) ButtonSetupFunctions.append((_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) ButtonSetupFunctions.append((_("Restart GUI"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) ButtonSetupFunctions.append((_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power"))
def createMenuList(self): 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 config.usage.menu_sort_mode.value == "user" 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 config.usage.menu_sort_mode.value == "user": self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue(self.menuID, "submenu") or {} idx = 0 for x in self.list: entry = list(self.list.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue(entry[2], "sort") or entry[3] entry.append(m_weight) self.list.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], "sort", m_weight) idx += 1 self.full_list = list(self.list) if config.usage.menu_sort_mode.value == "a_z": # Sort by Name self.list.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == "user": self.hide_show_entries() else: # Sort by Weight self.list.sort(key=lambda x: int(x[3])) if config.usage.menu_show_numbers.value: 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)
def __init__(self, session, parent): Screen.__init__(self, session) list = [] menuID = None for x in parent: #walk through the actual nodelist if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 elif x.tag == 'menu': self.addMenu(list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 if menuID is not None: # plugins for l in plugins.getPluginsForMenu(menuID): # check if a plugin overrides an existing menu plugin_menuid = l[2] for x in list: if x[2] == plugin_menuid: list.remove(x) break if len(l) > 4 and l[4]: list.append((l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) # for the skin: first try a menu_<menuID>, then Menu self.skinName = [ ] if menuID is not None: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") self.menuID = menuID ProtectedScreen.__init__(self) # Sort by Weight if config.usage.sort_menus.value: list.sort() else: list.sort(key=lambda x: int(x[3])) if config.usage.menu_show_numbers.value: list = [(str(x[0] + 1) + " " +x[1][0], x[1][1], x[1][2]) for x in enumerate(list)] self["menu"] = List(list) self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions"], { "ok": self.okbuttonClick, "cancel": self.closeNonRecursive, "menu": self.closeRecursive, "0": self.keyNumberGlobal, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal }) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) or _(parent.get("text", "").encode("UTF-8")) self.menu_title = a global menu_path self.menu_path_compressed = menu_path if menu_path == "": menu_path += a elif not menu_path.endswith(a): menu_path += " / " + a global full_menu_path full_menu_path = menu_path + ' / ' if config.usage.show_menupath.value == 'large': Screen.setTitle(self, menu_path) self["title"] = StaticText(menu_path) self["menu_path_compressed"] = StaticText("") elif config.usage.show_menupath.value == 'small': Screen.setTitle(self, a) self["title"] = StaticText(a) self["menu_path_compressed"] = StaticText(self.menu_path_compressed and self.menu_path_compressed + " >" or "") else: Screen.setTitle(self, a) self["title"] = StaticText(a) self["menu_path_compressed"] = StaticText("") self.number = 0 self.nextNumberTimer = eTimer() self.nextNumberTimer.callback.append(self.okbuttonClick)
def getHotkeyFunctions(): hotkeyFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "Plugins")) twinPlugins.append(plugin.name) hotkeyFunctions.append((_("Main menu"), "Infobar/mainMenu", "InfoBar")) hotkeyFunctions.append((_("Show help"), "Infobar/showHelp", "InfoBar")) hotkeyFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) hotkeyFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) hotkeyFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) hotkeyFunctions.append((_("Switch channel up"), "Infobar/switchChannelUp", "InfoBar")) hotkeyFunctions.append((_("Switch channel down"), "Infobar/switchChannelDown", "InfoBar")) hotkeyFunctions.append((_("Show service list"), "Infobar/openServiceList", "InfoBar")) hotkeyFunctions.append((_("Show movies"), "Infobar/showMovies", "InfoBar")) hotkeyFunctions.append((_("Show servicelist or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) hotkeyFunctions.append((_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar")) hotkeyFunctions.append((_("History back"), "Infobar/historyBack", "InfoBar")) hotkeyFunctions.append((_("History next"), "Infobar/historyNext", "InfoBar")) hotkeyFunctions.append((_("Recall to previous service"), "Infobar/servicelist/recallPrevService", "InfoBar")) hotkeyFunctions.append((_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG")) hotkeyFunctions.append((_("Show event details"), "Infobar/openEventView", "EPG")) hotkeyFunctions.append((_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG")) hotkeyFunctions.append((_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG")) hotkeyFunctions.append((_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) hotkeyFunctions.append((_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) hotkeyFunctions.append((_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) hotkeyFunctions.append((_("Toggle TV/RADIO mode"), "Infobar/toggleTvRadio", "InfoBar")) hotkeyFunctions.append((_("Instant record"), "Infobar/instantRecord", "InfoBar")) hotkeyFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) hotkeyFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) hotkeyFunctions.append((_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) hotkeyFunctions.append((_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) hotkeyFunctions.append((_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) hotkeyFunctions.append((_("Start teletext"), "Infobar/startTeletext", "InfoBar")) hotkeyFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) hotkeyFunctions.append((_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) hotkeyFunctions.append((_("Show InfoBar"), "Infobar/showFirstInfoBar", "InfoBar")) hotkeyFunctions.append((_("Show second InfoBar"), "Infobar/showSecondInfoBar", "InfoBar")) hotkeyFunctions.append((_("Toggle infoBar"), "Infobar/toggleShow", "InfoBar")) hotkeyFunctions.append((_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) if SystemInfo["PIPAvailable"]: hotkeyFunctions.append((_("Show PIP"), "Infobar/showPiP", "InfoBar")) hotkeyFunctions.append((_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) hotkeyFunctions.append((_("Move PIP"), "Infobar/movePiP", "InfoBar")) hotkeyFunctions.append((_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar")) hotkeyFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI In"), "Infobar/HDMIIn", "InfoBar")) if SystemInfo["LcdLiveTV"]: hotkeyFunctions.append((_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) hotkeyFunctions.append((_("Toggle dashed flickering line for this service"), "Infobar/ToggleHideVBI", "InfoBar")) hotkeyFunctions.append((_("Do nothing"), "Void", "InfoBar")) hotkeyFunctions.append((_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup")) hotkeyFunctions.append((_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) hotkeyFunctions.append((_("Latest Commits"), "Module/Screens.About/CommitInfo", "Setup")) hotkeyFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) hotkeyFunctions.append((_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) hotkeyFunctions.append((_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) hotkeyFunctions.append((_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): hotkeyFunctions.append((plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) hotkeyFunctions.append((_("Network"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) hotkeyFunctions.append((_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) hotkeyFunctions.append((_("Sleeptimer edit"), "Module/Screens.SleepTimerEdit/SleepTimerEdit", "Setup")) hotkeyFunctions.append((_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) hotkeyFunctions.append((_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: hotkeyFunctions.append((plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) hotkeyFunctions.append((_("PowerMenu"), "Menu/shutdown", "Power")) hotkeyFunctions.append((_("Standby"), "Module/Screens.Standby/Standby", "Power")) hotkeyFunctions.append((_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) hotkeyFunctions.append((_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) hotkeyFunctions.append((_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) hotkeyFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) hotkeyFunctions.append((_("User interface"), "Setup/userinterface", "Setup")) hotkeyFunctions.append((_("Recording Setup"), "Setup/recording", "Setup")) hotkeyFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup")) hotkeyFunctions.append((_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) hotkeyFunctions.append((_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) hotkeyFunctions.append((_("Skin setup"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) hotkeyFunctions.append((_("Memory Info"), "Module/Screens.About/MemoryInfo", "Setup")) if os.path.isdir("/etc/ppanels"): for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]: x = x[:-4] hotkeyFunctions.append((_("PPanel") + " " + x, "PPanel/" + x, "PPanels")) if os.path.isdir("/usr/script"): for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]: x = x[:-3] hotkeyFunctions.append((_("Shellscript") + " " + x, "Shellscript/" + x, "Shellscripts")) return hotkeyFunctions
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)
if menuID is not None: # plugins <<<<<<< HEAD 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() ======= >>>>>>> dev/Dev 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 <<<<<<< HEAD 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:
def __init__(self, session, parent): Screen.__init__(self, session) self.sort_mode = False self.selected_entry = None self.sub_menu_sort = None self["green"] = Label() self["yellow"] = Label() self["blue"] = Label() m_list = [] menuID = None for x in parent: #walk through the actual nodelist if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(m_list, x) count += 1 elif x.tag == 'menu': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addMenu(m_list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: m_list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 self.menuID = menuID if menuID is not None: # plugins for l in plugins.getPluginsForMenu(menuID): # check if a plugin overrides an existing menu plugin_menuid = l[2] for x in m_list: if x[2] == plugin_menuid: m_list.remove(x) break if len(l) > 4 and l[4]: m_list.append((l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: m_list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) # for the skin: first try a menu_<menuID>, then Menu self.skinName = [ ] if menuID is not None: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") self.menuID = menuID ProtectedScreen.__init__(self) if config.usage.menu_sort_mode.value == "user" and menuID == "mainmenu": plugin_list = [] id_list = [] for l in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]): l.id = (l.name.lower()).replace(' ','_') if l.id not in id_list: id_list.append(l.id) plugin_list.append((l.name, boundFunction(l.__call__, session), l.id, 200)) self.list = m_list if menuID is not None and config.usage.menu_sort_mode.value == "user": self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue(self.menuID, "submenu") or {} idx = 0 for x in self.list: entry = list(self.list.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue(entry[2], "sort") or entry[3] entry.append(m_weight) self.list.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], "sort", m_weight) idx += 1 self.full_list = list(m_list) if config.usage.menu_sort_mode.value == "a_z": # Sort by Name m_list.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == "user": self["blue"].setText(_("Edit mode on")) self.hide_show_entries() m_list = self.list else: # Sort by Weight m_list.sort(key=lambda x: int(x[3])) self["menu"] = List(m_list) self["menu"].enableWrapAround = True if config.usage.menu_sort_mode.value == "user": self["menu"].onSelectionChanged.append(self.selectionChanged) self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions"], { "ok": self.okbuttonClick, "cancel": self.closeNonRecursive, "menu": self.closeRecursive, "0": self.resetSortOrder, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal }) if config.usage.menu_sort_mode.value == "user": self["MoveActions"] = ActionMap(["WizardActions"], { "left": self.keyLeft, "right": self.keyRight, "up": self.keyUp, "down": self.keyDown, }, -1 ) self["EditActions"] = ActionMap(["ColorActions"], { "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, }) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) or _(parent.get("text", "").encode("UTF-8")) self["title"] = StaticText(a) Screen.setTitle(self, a) self.menu_title = a global menu_path self.menu_path_compressed = menu_path menu_path = menu_path and menu_path + " > " + a or a self["menu_path"] = StaticText(menu_path) self["menu_path_compressed"] = StaticText(self.menu_path_compressed and self.menu_path_compressed + " >" or "")
def __init__(self, session, parent): Screen.__init__(self, session) list = [] menuID = None for x in parent: #walk through the actual nodelist if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 elif x.tag == 'menu': self.addMenu(list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: list.append((x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 if menuID is not None: # plugins for l in plugins.getPluginsForMenu(menuID): # check if a plugin overrides an existing menu plugin_menuid = l[2] for x in list: if x[2] == plugin_menuid: list.remove(x) break if len(l) > 4 and l[4]: list.append((l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) # for the skin: first try a menu_<menuID>, then Menu self.skinName = [ ] if menuID is not None: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") self.menuID = menuID ProtectedScreen.__init__(self) if config.plugins.infopanel_usermenus is not None and menuID == "mainmenu": plugin_list = [] id_list = [] for l in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]): l.id = (l.name.lower()).replace(' ','_') if l.id not in id_list: id_list.append(l.id) plugin_list.append((l.name, boundFunction(l.__call__, session), l.id, 200)) addlist = config.plugins.infopanel_usermenus.value addlist = addlist.split(',') for entry in plugin_list: if entry[2] in addlist: list.append(entry) self.list = list # Sort by Weight if config.usage.sort_menus.value: list.sort() else: 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
def reloadMenu(self): self.list = [] count = 0 if self.parent is not None: for x in self.parent: 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') self.default = str(x.get('default', 0)) self.update = int(x.get('update', 0)) self.overrides = int(x.get('overrides', 1)) self.findmenu = int(x.get('findmenu', self.findmenu)) self.endtext = str(x.get('endtext', '>')) count = 0 if self.menuID is not None: 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 is not None: for l in plugins.getPluginsForMenu(self.menuID): if self.overrides: plugin_menuid = l[2] for x in self.list: if x[2] == plugin_menuid: self.list.remove(x) break endtext = self.endtext if len(l) > 4: endtext = l[4] if len(l) > 5: if l[5] is None: menuitem = [l[0], boundFunction(self.runPlugin, (l[1], l[6])), l[2], l[3] or 50, endtext, None] else: menuitem = [l[0], boundFunction(self.runPlugin, (l[1], l[6])), l[2], l[3] or 50, endtext, boundFunction(self.runPlugin, (l[5], l[6]))] for x in range(7, len(l)): menuitem.append(l[x]) else: menuitem = [l[0], boundFunction(self.runPlugin, (l[1], None)), l[2], l[3] or 50, endtext, None] self.list.append(tuple(menuitem)) try: if self.sort == 'sort': self.list.sort(key=lambda x: int(x[3])) if self.sort == 'reverse': self.list.sort(key=lambda x: int(x[3])) self.list.reverse() except: if self.sort == 'sort': self.list.sort(key=lambda x: x[3]) if self.sort == 'reverse': self.list.sort(key=lambda x: x[3]) self.list.reverse() if self.findmenu == 1: self.charlist = {} for x in self.list: title = x[0].decode('UTF-8', 'ignore') if len(title) > 0: if len(title) > 3 and title[2:4] == '. ' and title[:2].isdigit(): char = title[4].upper() else: char = title[0].upper() self.charlist[char] = CharEntryComponent(char.encode('UTF-8')) self['menu'].setList(self.list)
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append( (plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append( (plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "Plugins")) twinPlugins.append(plugin.name) ButtonSetupFunctions.append( (_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG")) ButtonSetupFunctions.append( (_("Main menu"), "Infobar/mainMenu", "InfoBar")) ButtonSetupFunctions.append( (_("Show help"), "Infobar/showHelp", "InfoBar")) ButtonSetupFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) ButtonSetupFunctions.append( (_("Volume down"), "Infobar/volumeDown", "InfoBar")) ButtonSetupFunctions.append( (_("Volume up"), "Infobar/volumeUp", "InfoBar")) ButtonSetupFunctions.append( (_("Show Infobar"), "Infobar/toggleShow", "InfoBar")) ButtonSetupFunctions.append( (_("Show service list"), "Infobar/openServiceList", "InfoBar")) ButtonSetupFunctions.append( (_("Show favourites list"), "Infobar/openBouquets", "InfoBar")) ButtonSetupFunctions.append( (_("Show satellites list"), "Infobar/openSatellites", "InfoBar")) ButtonSetupFunctions.append( (_("History back"), "Infobar/historyBack", "InfoBar")) ButtonSetupFunctions.append( (_("History next"), "Infobar/historyNext", "InfoBar")) ButtonSetupFunctions.append( (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG")) ButtonSetupFunctions.append( (_("Show event details"), "Infobar/openEventView", "EPG")) ButtonSetupFunctions.append( (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Enable digital downmix"), "Infobar/audioDownmixOn", "InfoBar")) ButtonSetupFunctions.append( (_("Disable digital downmix"), "Infobar/audioDownmixOff", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) ButtonSetupFunctions.append((_("Show servicelist or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Show movies"), "Infobar/showMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Instant record"), "Infobar/instantRecord", "InfoBar")) ButtonSetupFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) ButtonSetupFunctions.append( (_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) ButtonSetupFunctions.append( (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Start teletext"), "Infobar/startTeletext", "InfoBar")) ButtonSetupFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) ButtonSetupFunctions.append((_("Show subtitle quick menu"), "Infobar/subtitleQuickMenu", "InfoBar")) ButtonSetupFunctions.append( (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) if SystemInfo["PIPAvailable"]: ButtonSetupFunctions.append( (_("Show PIP"), "Infobar/showPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Move PIP"), "Infobar/movePiP", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar")) ButtonSetupFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) if SystemInfo["LcdLiveTV"]: ButtonSetupFunctions.append( (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) ButtonSetupFunctions.append( (_("Hotkey Setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup")) ButtonSetupFunctions.append( (_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) ButtonSetupFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) ButtonSetupFunctions.append( (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) ButtonSetupFunctions.append( (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) ButtonSetupFunctions.append( (_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) ButtonSetupFunctions.append( (_("Network setup"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) ButtonSetupFunctions.append( (_("Network menu"), "Infobar/showNetworkMounts", "Setup")) ButtonSetupFunctions.append( (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) ButtonSetupFunctions.append( (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) ButtonSetupFunctions.append( (_("SkinSelector"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) ButtonSetupFunctions.append( (_("LCD SkinSelector"), "Module/Screens.SkinSelector/LcdSkinSelector", "Setup")) ButtonSetupFunctions.append( (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) ButtonSetupFunctions.append( (_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) ButtonSetupFunctions.append( (_("Standby"), "Module/Screens.Standby/Standby", "Power")) ButtonSetupFunctions.append( (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) ButtonSetupFunctions.append( (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) ButtonSetupFunctions.append( (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) ButtonSetupFunctions.append( (_("SleepTimer"), "Module/Screens.SleepTimerEdit/SleepTimerEdit", "Power")) ButtonSetupFunctions.append( (_("PowerTimer"), "Module/Screens.PowerTimerEdit/PowerTimerEditList", "Power")) ButtonSetupFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) ButtonSetupFunctions.append( (_("User interface settings"), "Setup/userinterface", "Setup")) ButtonSetupFunctions.append( (_("Recording Setup"), "Setup/recording", "Setup")) ButtonSetupFunctions.append( (_("Harddisk Setup"), "Setup/harddisk", "Setup")) ButtonSetupFunctions.append( (_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) ButtonSetupFunctions.append( (_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) ButtonSetupFunctions.append( (_("OscamInfo Mainmenu"), "Module/Screens.OScamInfo/OscamInfoMenu", "Plugins")) ButtonSetupFunctions.append( (_("CCcamInfo Mainmenu"), "Module/Screens.CCcamInfo/CCcamInfoMain", "Plugins")) ButtonSetupFunctions.append( (_("Movieplayer"), "Module/Screens.MovieSelection/MovieSelection", "Plugins")) if os.path.isdir("/etc/ppanels"): for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]: x = x[:-4] ButtonSetupFunctions.append( (_("PPanel") + " " + x, "PPanel/" + x, "PPanels")) if os.path.isdir("/usr/script"): for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]: x = x[:-3] ButtonSetupFunctions.append((_("Shellscript") + " " + x, "Shellscript/" + x, "Shellscripts")) if os.path.isfile( "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/ScriptRunner.pyo" ): ButtonSetupFunctions.append( (_("ScriptRunner"), "ScriptRunner/", "Plugins")) if os.path.isfile( "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/QuickMenu.pyo" ): ButtonSetupFunctions.append((_("QuickMenu"), "QuickMenu/", "Plugins")) if os.path.isfile( "/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo"): ButtonSetupFunctions.append( (_("Kodi MediaCenter"), "Kodi/", "Plugins")) return ButtonSetupFunctions
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[ButtonSetup] error during executing module %s, screen %s" % ( selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show()
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)
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append( (plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append( (plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]), "Plugins")) twinPlugins.append(plugin.name) ButtonSetupFunctions.append( (_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG")) ButtonSetupFunctions.append( (_("Main menu"), "Infobar/mainMenu", "InfoBar")) ButtonSetupFunctions.append( (_("Show help"), "Infobar/showHelp", "InfoBar")) ButtonSetupFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) ButtonSetupFunctions.append( (_("Show service list"), "Infobar/openServiceList", "InfoBar")) ButtonSetupFunctions.append( (_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar")) ButtonSetupFunctions.append( (_("History back"), "Infobar/historyBack", "InfoBar")) ButtonSetupFunctions.append( (_("History next"), "Infobar/historyNext", "InfoBar")) ButtonSetupFunctions.append( (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG")) ButtonSetupFunctions.append( (_("Show event details"), "Infobar/openEventView", "EPG")) ButtonSetupFunctions.append( (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) ButtonSetupFunctions.append((_("Show servicelist or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Show movies"), "Infobar/showMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Instant record"), "Infobar/instantRecord", "InfoBar")) ButtonSetupFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) ButtonSetupFunctions.append( (_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) ButtonSetupFunctions.append( (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Start teletext"), "Infobar/startTeletext", "InfoBar")) ButtonSetupFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) if SystemInfo["PIPAvailable"]: ButtonSetupFunctions.append( (_("Show PIP"), "Infobar/showPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Move PIP"), "Infobar/movePiP", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar")) ButtonSetupFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) ButtonSetupFunctions.append( (_("ButtonSetup Setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup")) ButtonSetupFunctions.append( (_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) ButtonSetupFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) ButtonSetupFunctions.append( (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) ButtonSetupFunctions.append( (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) ButtonSetupFunctions.append( (_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) ButtonSetupFunctions.append( (_("Network setup"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) ButtonSetupFunctions.append( (_("Network menu"), "Infobar/showNetworkMounts", "Setup")) ButtonSetupFunctions.append( (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) ButtonSetupFunctions.append( (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) ButtonSetupFunctions.append( (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) ButtonSetupFunctions.append( (_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) ButtonSetupFunctions.append( (_("Standby"), "Module/Screens.Standby/Standby", "Power")) ButtonSetupFunctions.append( (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) ButtonSetupFunctions.append( (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) ButtonSetupFunctions.append( (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) ButtonSetupFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) ButtonSetupFunctions.append( (_("User interface settings"), "Setup/userinterface", "Setup")) ButtonSetupFunctions.append( (_("Recording Setup"), "Setup/recording", "Setup")) ButtonSetupFunctions.append( (_("Harddisk Setup"), "Setup/harddisk", "Setup")) ButtonSetupFunctions.append( (_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) ButtonSetupFunctions.append( (_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) return ButtonSetupFunctions
def __init__(self, session, parent): Screen.__init__(self, session) list = [] menuID = None for x in parent: #walk through the actual nodelist if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 elif x.tag == 'menu': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addMenu(list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: list.append( (x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 self.menuID = menuID if config.ParentalControl.configured.value: ProtectedScreen.__init__(self) if menuID is not None: # plugins 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 if len(l) > 4 and l[4]: list.append( (l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) # for the skin: first try a menu_<menuID>, then Menu self.skinName = [] if menuID is not None: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") self.menuID = menuID ProtectedScreen.__init__(self) # Sort by Weight if config.usage.sort_menus.value: list.sort() else: list.sort(key=lambda x: int(x[3])) self["menu"] = List(list) self["actions"] = NumberActionMap( ["OkCancelActions", "MenuActions", "NumberActions"], { "ok": self.okbuttonClick, "cancel": self.closeNonRecursive, "menu": self.closeRecursive, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal }) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) if a is None: a = _(parent.get("text", "").encode("UTF-8")) self["title"] = StaticText(a) Screen.setTitle(self, a) self.menu_title = a
def createMenuList(self): self.list = [] self.menuID = None for x in self.parentmenu: 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: 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: for l in plugins.getPluginsForMenu(self.menuID): 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 config.usage.menu_sort_mode.value == 'user' 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 config.usage.menu_sort_mode.value == 'user': self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue(self.menuID, 'submenu') or {} idx = 0 for x in self.list: entry = list(self.list.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue(entry[2], 'sort') or entry[3] entry.append(m_weight) self.list.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], 'sort', m_weight) idx += 1 self.full_list = list(self.list) if config.usage.menu_sort_mode.value == 'a_z': self.list.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == 'user': self.hide_show_entries() else: self.list.sort(key=lambda x: int(x[3])) self['menu'].updateList(self.list)
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 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 list.sort(key=lambda x: int(x[3])) self["menu"] = List(list) self["actions"] = NumberActionMap( ["OkCancelActions", "MenuActions", "NumberActions"], { "ok": self.okbuttonClick, "cancel": self.closeNonRecursive, "menu": self.closeRecursive, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal }) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) if a is None: a = _(parent.get("text", "").encode("UTF-8")) self["title"] = StaticText(a) self.menu_title = a
def __init__(self, session, parent): Screen.__init__(self, session) list = [] menuID = None for x in parent: #walk through the actual nodelist if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 elif x.tag == 'menu': self.addMenu(list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: list.append( (x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 if menuID is not None: # plugins for l in plugins.getPluginsForMenu(menuID): # check if a plugin overrides an existing menu plugin_menuid = l[2] for x in list: if x[2] == plugin_menuid: list.remove(x) break if len(l) > 4 and l[4]: list.append( (l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) # for the skin: first try a menu_<menuID>, then Menu self.skinName = [] if menuID is not None: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") self.menuID = menuID ProtectedScreen.__init__(self) if config.plugins.infopanel_usermenus is not None and menuID == "mainmenu": plugin_list = [] id_list = [] for l in plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]): l.id = (l.name.lower()).replace(' ', '_') if l.id not in id_list: id_list.append(l.id) plugin_list.append( (l.name, boundFunction(l.__call__, session), l.id, 200)) addlist = config.plugins.infopanel_usermenus.value addlist = addlist.split(',') for entry in plugin_list: if entry[2] in addlist: list.append(entry) self.list = list # Sort by Weight if config.usage.sort_menus.value: list.sort() else: 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
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[plugin.path.rfind("Plugins"):]): twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1 else: twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1 ButtonSetupFunctions.append( (plugin.name, plugin.path[plugin.path.rfind("Plugins"):] + "/" + str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]]), "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[plugin.path.rfind("Plugins"):]): twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1 else: twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1 ButtonSetupFunctions.append( (plugin.name, plugin.path[plugin.path.rfind("Plugins"):] + "/" + str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]]), "Plugins")) twinPlugins.append(plugin.name) ButtonSetupFunctions.append( (_("Show Grid EPG"), "Infobar/openGridEPG", "EPG")) ButtonSetupFunctions.append( (_("Main menu"), "Infobar/mainMenu", "InfoBar")) ButtonSetupFunctions.append( (_("Show help"), "Infobar/showHelp", "InfoBar")) ButtonSetupFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) ButtonSetupFunctions.append( (_("Show service list"), "Infobar/openServiceList", "InfoBar")) ButtonSetupFunctions.append((_("Show service list or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Show movies"), "Infobar/showMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Restart last movie"), "Infobar/restartLastMovie", "InfoBar")) ButtonSetupFunctions.append( (_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar")) ButtonSetupFunctions.append( (_("History back"), "Infobar/historyBack", "InfoBar")) ButtonSetupFunctions.append( (_("History next"), "Infobar/historyNext", "InfoBar")) ButtonSetupFunctions.append( (_("Show event info plugins"), "Infobar/showEventInfoPlugins", "EPG")) ButtonSetupFunctions.append( (_("Show event details"), "Infobar/openEventView", "EPG")) ButtonSetupFunctions.append( (_("Show Single EPG"), "Infobar/openSingleServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show Multi EPG"), "Infobar/openMultiServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show select audio track"), "Infobar/audioSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) ButtonSetupFunctions.append((_("Toggle default subtitles"), "Infobar/toggleDefaultSubtitles", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) ButtonSetupFunctions.append( (_("Instant record"), "Infobar/instantRecord", "InfoBar")) ButtonSetupFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift end"), "Infobar/activateTimeshiftEnd", "InfoBar")) ButtonSetupFunctions.append( (_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) ButtonSetupFunctions.append( (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Start teletext"), "Infobar/startTeletext", "InfoBar")) ButtonSetupFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Seekbar"), "Infobar/seekFwdVod", "InfoBar")) if SystemInfo["PIPAvailable"]: ButtonSetupFunctions.append( (_("Show PIP"), "Infobar/showPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Move PIP"), "Infobar/movePiP", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle PIP-ZAP"), "Infobar/togglePipzap", "InfoBar")) ButtonSetupFunctions.append((_("Activate HbbTV (RedButton)"), "Infobar/activateRedButton", "InfoBar")) if SystemInfo["HasHDMIin"]: ButtonSetupFunctions.append( (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) if SystemInfo["LcdLiveTV"]: ButtonSetupFunctions.append( (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) ButtonSetupFunctions.append((_("Do nothing"), "Void", "InfoBar")) if os.path.isdir("/usr/script"): for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]: x = x[:-3] ButtonSetupFunctions.append( (_("Script") + " " + x, "Script/" + x, "Scripts")) ButtonSetupFunctions.append( (_("Button setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup")) ButtonSetupFunctions.append( (_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) ButtonSetupFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) ButtonSetupFunctions.append( (_("Show stream clients"), "Module/Screens.StreamingClientsInfo/StreamingClientsInfo", "Setup")) ButtonSetupFunctions.append( (_("Manual scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) ButtonSetupFunctions.append( (_("Automatic scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) ButtonSetupFunctions.append( (_("Network Setup"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) ButtonSetupFunctions.append( (_("Network menu"), "Infobar/showNetworkMounts", "Setup")) ButtonSetupFunctions.append( (_("Plugin browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) ButtonSetupFunctions.append( (_("Channel info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) ButtonSetupFunctions.append( (_("Timers"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) ButtonSetupFunctions.append( (_("Autotimer overview"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) ButtonSetupFunctions.append((_("Power menu"), "Menu/shutdown", "Power")) ButtonSetupFunctions.append( (_("Standby"), "Module/Screens.Standby/Standby", "Power")) ButtonSetupFunctions.append( (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) ButtonSetupFunctions.append( (_("Restart GUI"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) ButtonSetupFunctions.append( (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) ButtonSetupFunctions.append((_("Usage setup"), "Setup/usage", "Setup")) ButtonSetupFunctions.append( (_("User interface settings"), "Setup/userinterface", "Setup")) ButtonSetupFunctions.append( (_("Recording and playback settings"), "Setup/recording", "Setup")) ButtonSetupFunctions.append( (_("Skin setup"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) ButtonSetupFunctions.append( (_("Harddisk setup"), "Setup/harddisk", "Setup")) ButtonSetupFunctions.append( (_("Subtitles settings"), "Setup/subtitlesetup", "Setup")) return ButtonSetupFunctions
def execButtonSetup(self, selected): if selected: selected = selected[1].split('/') if selected[0] == 'Plugins': twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]) == '/'.join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]) == '/'.join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == 'MenuPlugin': for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == 'Infobar': if hasattr(self, selected[1]): exec 'self.' + '.'.join(selected[1:]) + '()' else: return 0 elif selected[0] == 'Module': try: exec 'from ' + selected[1] + ' import *' exec 'self.session.open(' + ','.join(selected[2:]) + ')' except: print '[ButtonSetup] error during executing module %s, screen %s' % (selected[1], selected[2]) elif selected[0] == 'Setup': exec 'from Screens.Setup import *' exec 'self.session.open(Setup, "' + selected[1] + '")' elif selected[0].startswith('Zap'): if selected[0] == 'ZapPanic': self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent(eServiceReference('/'.join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, 'lastservice'): self.lastservice = eServiceReference('/'.join(selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[pathLen:]): twinPaths[plugin.path[pathLen:]] += 1 else: twinPaths[plugin.path[pathLen:]] = 1 if plugin.path[pathLen:] + "/" + str(twinPaths[plugin.path[pathLen:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[pathLen:]): twinPaths[plugin.path[pathLen:]] += 1 else: twinPaths[plugin.path[pathLen:]] = 1 if plugin.path[pathLen:] + "/" + str(twinPaths[plugin.path[pathLen:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from %s import %s" % (selected[1], selected[2]) exec "self.session.open(%s)" % ",".join(selected[2:]) except: print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": from Screens.Setup import Setup exec "self.session.open(Setup, \"%s\")" % selected[1] elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir(ppath + "/Plugins/Extensions/PPanel"): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/scripts/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir(ppath + "/Plugins/Extensions/PPanel"): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: os.system(command) elif selected[0] == "EMC": try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance)) except Exception as e: print('[EMCPlayer] showMovies exception:\n' + str(e)) elif selected[0] == "Kodi": if os.path.isfile(ppath + "/Plugins/Extensions/Kodi/plugin.pyo"): from Plugins.Extensions.Kodi.plugin import KodiMainScreen self.session.open(KodiMainScreen) elif selected[0] == "DeviceManager": from Plugins.SystemPlugins.DeviceManager.HddSetup import * self.session.open(HddSetup)
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]), 'EPG')) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]), 'Plugins')) twinPlugins.append(plugin.name) ButtonSetupFunctions.append((_('Show Graphical multi EPG'), 'Infobar/openGraphEPG', 'EPG')) ButtonSetupFunctions.append((_('Main menu'), 'Infobar/mainMenu', 'InfoBar')) ButtonSetupFunctions.append((_('Show help'), 'Infobar/showHelp', 'InfoBar')) ButtonSetupFunctions.append((_('Show extension selection'), 'Infobar/showExtensionSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Zap down'), 'Infobar/zapDown', 'InfoBar')) ButtonSetupFunctions.append((_('Zap up'), 'Infobar/zapUp', 'InfoBar')) ButtonSetupFunctions.append((_('Show service list'), 'Infobar/openServiceList', 'InfoBar')) ButtonSetupFunctions.append((_('Show servicelist or movies'), 'Infobar/showServiceListOrMovies', 'InfoBar')) ButtonSetupFunctions.append((_('Show movies'), 'Infobar/showMovies', 'InfoBar')) ButtonSetupFunctions.append((_('Show favourites list'), 'Infobar/openFavouritesList', 'InfoBar')) ButtonSetupFunctions.append((_('History back'), 'Infobar/historyBack', 'InfoBar')) ButtonSetupFunctions.append((_('History next'), 'Infobar/historyNext', 'InfoBar')) ButtonSetupFunctions.append((_('Show Event Info plugins'), 'Infobar/showEventInfoPlugins', 'EPG')) ButtonSetupFunctions.append((_('Show event details'), 'Infobar/openEventView', 'EPG')) ButtonSetupFunctions.append((_('Show EPG for current service'), 'Infobar/openSingleServiceEPG', 'EPG')) ButtonSetupFunctions.append((_('Show Multi EPG'), 'Infobar/openMultiServiceEPG', 'EPG')) ButtonSetupFunctions.append((_('Show select audio track'), 'Infobar/audioSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Show subtitle selection'), 'Infobar/subtitleSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Switch to radio mode'), 'Infobar/showRadio', 'InfoBar')) ButtonSetupFunctions.append((_('Switch to TV mode'), 'Infobar/showTv', 'InfoBar')) ButtonSetupFunctions.append((_('Instant record'), 'Infobar/instantRecord', 'InfoBar')) ButtonSetupFunctions.append((_('Start instant recording'), 'Infobar/startInstantRecording', 'InfoBar')) ButtonSetupFunctions.append((_('Activate timeshift end'), 'Infobar/activateTimeshiftEnd', 'InfoBar')) ButtonSetupFunctions.append((_('Activate timeshift end and pause'), 'Infobar/activateTimeshiftEndAndPause', 'InfoBar')) ButtonSetupFunctions.append((_('Start timeshift'), 'Infobar/startTimeshift', 'InfoBar')) ButtonSetupFunctions.append((_('Stop timeshift'), 'Infobar/stopTimeshift', 'InfoBar')) ButtonSetupFunctions.append((_('Start teletext'), 'Infobar/startTeletext', 'InfoBar')) ButtonSetupFunctions.append((_('Show subservice selection'), 'Infobar/subserviceSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Letterbox zoom'), 'Infobar/vmodeSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Aspect selection'), 'Infobar/aspectSelection', 'InfoBar')) if SystemInfo['PIPAvailable']: ButtonSetupFunctions.append((_('Show PIP'), 'Infobar/showPiP', 'InfoBar')) ButtonSetupFunctions.append((_('Swap PIP'), 'Infobar/swapPiP', 'InfoBar')) ButtonSetupFunctions.append((_('Move PIP'), 'Infobar/movePiP', 'InfoBar')) ButtonSetupFunctions.append((_('Toggle PIP-ZAP'), 'Infobar/togglePipzap', 'InfoBar')) ButtonSetupFunctions.append((_('Activate HbbTV (RedButton)'), 'Infobar/activateRedButton', 'InfoBar')) ButtonSetupFunctions.append((_('Toggle HDMI-In full screen'), 'Infobar/HDMIInFull', 'InfoBar')) ButtonSetupFunctions.append((_('Toggle HDMI-In PiP'), 'Infobar/HDMIInPiP', 'InfoBar')) if SystemInfo['LcdLiveTV']: ButtonSetupFunctions.append((_('Toggle LCD LiveTV'), 'Infobar/ToggleLCDLiveTV', 'InfoBar')) ButtonSetupFunctions.append((_('Button setup'), 'Module/Screens.ButtonSetup/ButtonSetup', 'Setup')) ButtonSetupFunctions.append((_('Software update'), 'Module/Screens.SoftwareUpdate/UpdatePlugin', 'Setup')) ButtonSetupFunctions.append((_('CI (Common Interface) Setup'), 'Module/Screens.Ci/CiSelection', 'Setup')) ButtonSetupFunctions.append((_('Manual scan'), 'Module/Screens.ScanSetup/ScanSetup', 'Scanning')) ButtonSetupFunctions.append((_('Automatic scan'), 'Module/Screens.ScanSetup/ScanSimple', 'Scanning')) for plugin in plugins.getPluginsForMenu('scan'): ButtonSetupFunctions.append((plugin[0], 'MenuPlugin/scan/' + plugin[2], 'Scanning')) ButtonSetupFunctions.append((_('Network Setup'), 'Module/Screens.NetworkSetup/NetworkAdapterSelection', 'Setup')) ButtonSetupFunctions.append((_('Network menu'), 'Infobar/showNetworkMounts', 'Setup')) ButtonSetupFunctions.append((_('Plugin Browser'), 'Module/Screens.PluginBrowser/PluginBrowser', 'Setup')) ButtonSetupFunctions.append((_('Channel info'), 'Module/Screens.ServiceInfo/ServiceInfo', 'Setup')) ButtonSetupFunctions.append((_('Timers'), 'Module/Screens.TimerEdit/TimerEditList', 'Setup')) ButtonSetupFunctions.append((_('AutoTimer Overview'), 'Infobar/showAutoTimerList', 'Setup')) for plugin in plugins.getPluginsForMenu('system'): if plugin[2]: ButtonSetupFunctions.append((plugin[0], 'MenuPlugin/system/' + plugin[2], 'Setup')) ButtonSetupFunctions.append((_('Standby'), 'Module/Screens.Standby/Standby', 'Power')) ButtonSetupFunctions.append((_('Restart'), 'Module/Screens.Standby/TryQuitMainloop/2', 'Power')) ButtonSetupFunctions.append((_('Restart GUI'), 'Module/Screens.Standby/TryQuitMainloop/3', 'Power')) ButtonSetupFunctions.append((_('Deep standby'), 'Module/Screens.Standby/TryQuitMainloop/1', 'Power')) ButtonSetupFunctions.append((_('Usage setup'), 'Setup/usage', 'Setup')) ButtonSetupFunctions.append((_('User interface Settings'), 'Setup/userinterface', 'Setup')) ButtonSetupFunctions.append((_('Recording and playback settings'), 'Setup/recording', 'Setup')) ButtonSetupFunctions.append((_('Skin setup'), 'Module/Screens.SkinSelector/SkinSelector', 'Setup')) ButtonSetupFunctions.append((_('Harddisk setup'), 'Setup/harddisk', 'Setup')) ButtonSetupFunctions.append((_('Subtitles settings'), 'Setup/subtitlesetup', 'Setup')) ButtonSetupFunctions.append((_('Language'), 'Module/Screens.LanguageSelection/LanguageSelection', 'Setup')) ButtonSetupFunctions.append((_('EGAMI Cam Center'), 'Module/EGAMI.EGAMI_Blue/EmuManager', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI Green Panel'), 'Module/EGAMI.EGAMI_Green/EGGreenPanel', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI Download Panel'), 'Module/EGAMI.EGAMI_addon_manager/EGAddonMenu', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI File Commander'), 'Module/Plugins.Extensions.FileCommander.plugin/FileCommanderScreen', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI Smart Script'), 'Module/EGAMI.EGAMI_main/EGScript', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI Softcam Informations'), 'Module/EGAMI.EGAMI_Blue/EGSoftCamInfo', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI Software Tools'), 'Module/EGAMI.EGAMI_addon_manager/EGAddonMenu', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI Devices Manager'), 'Module/EGAMI.EGAMI_devices_menu/EGDeviceManager', 'EGAMI')) ButtonSetupFunctions.append((_('EGAMI News'), 'Module/Plugins.Extensions.EGAMINews.plugin/EGAMIMainNews', 'EGAMI')) return ButtonSetupFunctions
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginList = plugins.getPlugins( PluginDescriptor.WHERE_EVENTINFO) pluginList.sort(key=lambda x: x.name) for plugin in pluginList: if plugin.name not in twinPlugins and plugin.path and "selectedevent" not in plugin.__call__.__code__.co_varnames: if plugin.path[plugin.path.rfind("Plugins" ):] in twinPaths: twinPaths[plugin.path[plugin.path.rfind("Plugins" ):]] += 1 else: twinPaths[ plugin.path[plugin.path.rfind("Plugins"):]] = 1 if "%s/%s" % ( plugin.path[plugin.path.rfind("Plugins"):], str(twinPaths[plugin.path[plugin.path.rfind( "Plugins"):]])) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginList = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU ]) pluginList.sort(key=lambda p: p.name) for plugin in pluginList: if plugin.name not in twinPlugins and plugin.path: if plugin.path[plugin.path.rfind("Plugins" ):] in twinPaths: twinPaths[plugin.path[plugin.path.rfind("Plugins" ):]] += 1 else: twinPaths[ plugin.path[plugin.path.rfind("Plugins"):]] = 1 if "%s/%s" % ( plugin.path[plugin.path.rfind("Plugins"):], str(twinPaths[plugin.path[plugin.path.rfind( "Plugins"):]])) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec("self.%s()" % ".".join(selected[1:])) else: return 0 elif selected[0] == "Module": try: exec("from %s import %s\nself.session.open(%s)" % (selected[1], selected[2], ",".join(selected[2:]))) except Exception as err: print( "[ButtonSetup] Error: Exception raised executing module '%s', screen '%s'! (%s)" % (selected[1], selected[2], str(err))) import traceback traceback.print_exc() elif selected[0] == "Setup": from Screens.Setup import Setup # exec("self.session.open(Setup, \"%s\")" % selected[1]) # DEBUG: What is this trying to do? self.session.open(Setup, selected[1]) elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = "/etc/ppanels/%s.xml" % selected[1] if isfile(ppanelFileName) and isdir( "/usr/lib/enigma2/python/Plugins/Extensions/PPanel"): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name="%s PPanel" % selected[1], node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = "/usr/script/%s.sh" % selected[1] if isfile(command) and isdir( "/usr/lib/enigma2/python/Plugins/Extensions/PPanel"): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, "%s shellscript" % selected[1], None, command) else: from Screens.Console import Console # exec("self.session.open(Console, title=_(selected[1]), cmdlist=[command])") # DEBUG: What is this trying to do? self.session.open(Console, selected[1], [command]) elif selected[0] == "EMC": try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance) ) # DEBUG: Should this be self.session.open? except Exception as err: print( "[ButtonSetup] EMCPlayer: showMovies exception: %s!" % str(err)) elif selected[0] == "ScriptRunner": from Screens.ScriptRunner import ScriptRunner self.session.open(ScriptRunner) elif selected[0] == "QuickMenu": from Screens.QuickMenu import QuickMenu self.session.open(QuickMenu) elif selected[0] == "Kodi": if isPluginInstalled("Kodi"): from Plugins.Extensions.Kodi.plugin import KodiMainScreen self.session.open(KodiMainScreen) elif selected[0] == "Bluetooth": if isPluginInstalled("BluetoothSetup"): from Plugins.SystemPlugins.BluetoothSetup.plugin import BluetoothSetup self.session.open(BluetoothSetup) elif selected[0] == "YoutubeTV": if isPluginInstalled("Chromium"): from Plugins.Extensions.Chromium.youtube import YoutubeTVWindow self.session.open(YoutubeTVWindow)
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins( [ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO, ] ) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) break twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) break elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + selected[1] + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[ButtonSetup] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec 'self.session.open(Setup, "' + selected[1] + '")' elif selected[0] == "Zap": self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() elif selected[0] == "PPanel": ppanelFileName = "/etc/ppanels/" + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir( "/usr/lib/enigma2/python/Plugins/Extensions/PPanel" ): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open( PPanel, name=selected[1] + " PPanel", node=None, filename=ppanelFileName, deletenode=None ) elif selected[0] == "Shellscript": command = "/usr/script/" + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir("/usr/lib/enigma2/python/Plugins/Extensions/PPanel"): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: from Screens.Console import Console exec "self.session.open(Console,_(selected[1]),[command])" elif selected[0] == "EMC": try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance)) except Exception as e: print ("[EMCPlayer] showMovies exception:\n" + str(e)) elif selected[0] == "ScriptRunner": if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/LDteam/ScriptRunner.pyo"): from Plugins.Extensions.LDteam.ScriptRunner import ScriptRunner self.session.open(ScriptRunner) elif selected[0] == "Kodi": if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo"): from Plugins.Extensions.Kodi.plugin import KodiMainScreen self.session.open(KodiMainScreen)
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[ButtonSetup] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) else: from Screens.Console import Console exec "self.session.open(Console,_(selected[1]),[command])" elif selected[0] == "EMC": try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance)) except Exception as e: print('[EMCPlayer] showMovies exception:\n' + str(e)) elif selected[0] == "ScriptRunner": if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/ScriptRunner.pyo"): from Plugins.Extensions.Infopanel.ScriptRunner import ScriptRunner self.session.open (ScriptRunner) elif selected[0] == "QuickMenu": if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/QuickMenu.pyo"): from Plugins.Extensions.Infopanel.QuickMenu import QuickMenu self.session.open (QuickMenu) elif selected[0] == "Kodi": if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo"): from Plugins.Extensions.Kodi.plugin import KodiMainScreen self.session.open(KodiMainScreen)
def __init__(self, session, parent): Screen.__init__(self, session) HelpableScreen.__init__(self) list = [] menuID = None for x in parent: #walk through the actual nodelist if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(list, x) count += 1 elif x.tag == 'menu': self.addMenu(list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: list.append( (x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 if menuID is not None: # plugins for l in plugins.getPluginsForMenu(menuID): # check if a plugin overrides an existing menu plugin_menuid = l[2] for x in list: if x[2] == plugin_menuid: list.remove(x) break if len(l) > 4 and l[4]: list.append( (l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: list.append((l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) # for the skin: first try a menu_<menuID>, then Menu self.skinName = [] if menuID is not None: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") self.menuID = menuID ProtectedScreen.__init__(self) # Sort by Weight if config.usage.sort_menus.value: list.sort() else: list.sort(key=lambda x: int(x[3])) if config.usage.menu_show_numbers.value: list = [(str(x[0] + 1) + " " + x[1][0], x[1][1], x[1][2]) for x in enumerate(list)] self["menu"] = List(list) # self["menuActions"] = HelpableNumberActionMap(self, ["OkCancelActions", "MenuActions", "NumberActions"], { self["menuActions"] = HelpableNumberActionMap( self, ["OkCancelActions", "NumberActions"], { "ok": (self.okbuttonClick, _("Select the current menu item")), "cancel": (self.closeNonRecursive, _("Exit menu")), "close": (self.closeRecursive, _("Exit all menus")), # "menu": (self.closeRecursive, _("Exit all menus")), "1": (self.keyNumberGlobal, _("Direct menu item selection")), "2": (self.keyNumberGlobal, _("Direct menu item selection")), "3": (self.keyNumberGlobal, _("Direct menu item selection")), "4": (self.keyNumberGlobal, _("Direct menu item selection")), "5": (self.keyNumberGlobal, _("Direct menu item selection")), "6": (self.keyNumberGlobal, _("Direct menu item selection")), "7": (self.keyNumberGlobal, _("Direct menu item selection")), "8": (self.keyNumberGlobal, _("Direct menu item selection")), "9": (self.keyNumberGlobal, _("Direct menu item selection")), "0": (self.keyNumberGlobal, _("Direct menu item selection")) }, prio=0, description=_("Common Menu Actions")) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) or _(parent.get("text", "").encode("UTF-8")) self.setTitle(a) self.number = 0 self.nextNumberTimer = eTimer() self.nextNumberTimer.callback.append(self.okbuttonClick)
def getHotkeyFunctions(): hotkeyFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "Plugins")) twinPlugins.append(plugin.name) hotkeyFunctions.append((_("Show Graphical Multi EPG"), "Infobar/openGraphEPG", "EPG")) hotkeyFunctions.append((_("Show Event View"), "Infobar/openEventView", "EPG")) #hotkeyFunctions.append((_("Show Event Info"), "Infobar/showEventInfo", "EPG")) hotkeyFunctions.append((_("Show Event Info Plugins"), "Infobar/showEventInfoPlugins", "EPG")) hotkeyFunctions.append((_("Show Single Service EPG"), "Infobar/openSingleServiceEPG", "EPG")) hotkeyFunctions.append((_("Show Multi Service EPG"), "Infobar/openMultiServiceEPG", "EPG")) hotkeyFunctions.append((_("Show Infobar EPG"), "Infobar/openInfoBarEPG", "EPG")) hotkeyFunctions.append((_("Main Menu"), "Infobar/mainMenu", "InfoBar")) hotkeyFunctions.append((_("Show Help"), "Infobar/showHelp", "InfoBar")) hotkeyFunctions.append((_("Toggle Infobar/SecondInfobar"), "Infobar/toggleShow", "InfoBar")) hotkeyFunctions.append((_("Show First Infobar"), "Infobar/showFirstInfoBar", "InfoBar")) hotkeyFunctions.append((_("Show Second Infobar"), "Infobar/showSecondInfoBar", "InfoBar")) hotkeyFunctions.append((_("Show Extension Selection"), "Infobar/showExtensionSelection", "InfoBar")) hotkeyFunctions.append((_("Show Plugin Selection"), "Infobar/showPluginBrowser", "InfoBar")) hotkeyFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) hotkeyFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) hotkeyFunctions.append((_("BackZap [0]"), "Infobar/BackZap", "InfoBar")) hotkeyFunctions.append((_("Volume down"), "Infobar/volumeDown", "InfoBar")) hotkeyFunctions.append((_("Volume up"), "Infobar/volumeUp", "InfoBar")) hotkeyFunctions.append((_("Switch Channel up in Infobar"), "Infobar/switchChannelUp", "InfoBar")) hotkeyFunctions.append((_("Switch Channel down in Infobar"), "Infobar/switchChannelDown", "InfoBar")) hotkeyFunctions.append((_("Show Service List"), "Infobar/openServiceList", "InfoBar")) hotkeyFunctions.append((_("History Zap Menu +"), "Infobar/historyZapForward", "InfoBar")) hotkeyFunctions.append((_("History Zap Menu -"), "Infobar/historyZapBackward", "InfoBar")) hotkeyFunctions.append((_("History back"), "Infobar/historyBack", "InfoBar")) hotkeyFunctions.append((_("History next"), "Infobar/historyNext", "InfoBar")) hotkeyFunctions.append((_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) hotkeyFunctions.append((_("Switch to Radio Mode"), "Infobar/showRadio", "InfoBar")) hotkeyFunctions.append((_("Switch to TV Mode"), "Infobar/showTv", "InfoBar")) hotkeyFunctions.append((_("Show Favourites List"), "Infobar/openFavouritesList", "InfoBar")) hotkeyFunctions.append((_("Show Satellites List"), "Infobar/openSatellites", "InfoBar")) hotkeyFunctions.append((_("Show Movies"), "Infobar/showMovies", "InfoBar")) hotkeyFunctions.append((_("Instant Record"), "Infobar/instantRecord", "InfoBar")) hotkeyFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) #hotkeyFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) #hotkeyFunctions.append((_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) hotkeyFunctions.append((_("Start Timeshift"), "Infobar/startTimeshift", "InfoBar")) hotkeyFunctions.append((_("Stop Timeshift"), "Infobar/stopTimeshift", "InfoBar")) hotkeyFunctions.append((_("Start Teletext"), "Infobar/startTeletext", "InfoBar")) hotkeyFunctions.append((_("Show Subservice Selection"), "Infobar/subserviceSelection", "InfoBar")) hotkeyFunctions.append((_("Show Subtitle Selection"), "Infobar/subtitleSelection", "InfoBar")) hotkeyFunctions.append((_("Letterbox Zoom"), "Infobar/vmodeSelection", "InfoBar")) hotkeyFunctions.append((_("ZoomInOut"), "InfobarGenerics/ZoomInOut", "InfoBar")) hotkeyFunctions.append((_("ZoomOff"), "InfobarGenerics/ZoomInOut", "InfoBar")) hotkeyFunctions.append((_("Do nothing"), "Void", "InfoBar")) if SystemInfo["PIPAvailable"]: hotkeyFunctions.append((_("Show Picture In Picture"), "Infobar/showPiP", "InfoBar")) hotkeyFunctions.append((_("Swap Picture In Picture"), "Infobar/swapPiP", "InfoBar")) hotkeyFunctions.append((_("Move Picture In Picture"), "Infobar/movePiP", "InfoBar")) hotkeyFunctions.append((_("Toggle Picture In Picture Zap"), "Infobar/togglePipzap", "InfoBar")) hotkeyFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI-In Full Screen"), "Infobar/HDMIInFull", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI-In Picture In Picture"), "Infobar/HDMIInPiP", "InfoBar")) hotkeyFunctions.append((_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup")) hotkeyFunctions.append((_("Software Update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) hotkeyFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) hotkeyFunctions.append((_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) hotkeyFunctions.append((_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) hotkeyFunctions.append((_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): hotkeyFunctions.append((plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) hotkeyFunctions.append((_("Network Adapter"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) hotkeyFunctions.append((_("Network Menu"), "Infobar/showNetworkMounts", "Setup")) hotkeyFunctions.append((_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) hotkeyFunctions.append((_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) hotkeyFunctions.append((_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) hotkeyFunctions.append((_("PowerTimer"), "Module/Screens.PowerTimerEdit/PowerTimerEditList", "Setup")) hotkeyFunctions.append((_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) hotkeyFunctions.append((_("Memory Info"), "Module/Screens.About/MemoryInfo", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: hotkeyFunctions.append((plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) hotkeyFunctions.append((_("Standby"), "Module/Screens.Standby/Standby", "Power")) hotkeyFunctions.append((_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) hotkeyFunctions.append((_("Restart Enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) hotkeyFunctions.append((_("Deep-Standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) hotkeyFunctions.append((_("SleepTimer"), "Module/Screens.SleepTimerEdit/SleepTimerEdit", "Power")) hotkeyFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) hotkeyFunctions.append((_("User Interface"), "Setup/userinterface", "Setup")) hotkeyFunctions.append((_("Recording Setup"), "Setup/recording", "Setup")) hotkeyFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup")) hotkeyFunctions.append((_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) hotkeyFunctions.append((_("Language"), "Module/Screens.LanguageSelection/LanguageSelection", "Setup")) hotkeyFunctions.append((_("Skin setup"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo"): hotkeyFunctions.append((_("Kodi Media Center"), "Kodi/", "Plugins")) if os.path.isdir("/etc/ppanel"): for x in [x for x in os.listdir("/etc/ppanel") if x.endswith(".xml")]: x = x[:-4] hotkeyFunctions.append((_("PPanel") + " " + x, "PPanel/" + x, "PPanels")) if os.path.isdir("/usr/scripts"): for x in [x for x in os.listdir("/usr/scripts") if x.endswith(".sh")]: x = x[:-3] hotkeyFunctions.append((_("Shellscript") + " " + x, "Shellscript/" + x, "Shellscripts")) return hotkeyFunctions
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[ButtonSetup] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break
def execHotkey(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) return twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) return elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + ".".join(selected[1:]) + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0].startswith("Zap"): if selected[0] == "ZapPanic": self.servicelist.history = [] self.pipShown() and self.showPiP() self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap = True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join(selected[1:])) self.close() else: self.show() from Screens.MovieSelection import defaultMoviePath moviepath = defaultMoviePath() if moviepath: config.movielist.last_videodir.value = moviepath elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) elif selected[0] == "Menu": from Screens.Menu import MainMenu, mdom root = mdom.getroot() for x in root.findall("menu"): y = x.find("id") if y is not None: id = y.get("val") if id and id == selected[1]: menu_screen = self.session.open(MainMenu, x) break
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and "selectedevent" not in plugin.__call__.__code__.co_varnames: if plugin.path[plugin.path.rfind("Plugins"):] in twinPaths: twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1 else: twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1 ButtonSetupFunctions.append( (plugin.name, "%s/%s" % (plugin.path[plugin.path.rfind("Plugins"):], str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]])), "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if plugin.path[plugin.path.rfind("Plugins"):] in twinPaths: twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1 else: twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1 ButtonSetupFunctions.append( (plugin.name, "%s/%s" % (plugin.path[plugin.path.rfind("Plugins"):], str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]])), "Plugins")) twinPlugins.append(plugin.name) ButtonSetupFunctions.append( (_("Show vertical Program Guide"), "Infobar/openVerticalEPG", "EPG")) ButtonSetupFunctions.append( (_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG")) ButtonSetupFunctions.append( (_("Main Menu"), "Infobar/showMainMenu", "InfoBar")) ButtonSetupFunctions.append( (_("Show help"), "Infobar/showHelp", "InfoBar")) ButtonSetupFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) ButtonSetupFunctions.append( (_("Volume down"), "Infobar/volumeDown", "InfoBar")) ButtonSetupFunctions.append( (_("Volume up"), "Infobar/volumeUp", "InfoBar")) ButtonSetupFunctions.append( (_("Show InfoBar"), "Infobar/toggleShow", "InfoBar")) ButtonSetupFunctions.append( (_("Show service list"), "Infobar/openServiceList", "InfoBar")) ButtonSetupFunctions.append( (_("Show favourites list"), "Infobar/openBouquets", "InfoBar")) ButtonSetupFunctions.append( (_("Show satellites list"), "Infobar/openSatellites", "InfoBar")) ButtonSetupFunctions.append( (_("History back"), "Infobar/historyBack", "InfoBar")) ButtonSetupFunctions.append( (_("History next"), "Infobar/historyNext", "InfoBar")) ButtonSetupFunctions.append( (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG")) ButtonSetupFunctions.append( (_("Show event details"), "Infobar/openEventView", "EPG")) ButtonSetupFunctions.append( (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG")) ButtonSetupFunctions.append( (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Enable digital downmix"), "Infobar/audioDownmixOn", "InfoBar")) ButtonSetupFunctions.append( (_("Disable digital downmix"), "Infobar/audioDownmixOff", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) ButtonSetupFunctions.append( (_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) ButtonSetupFunctions.append((_("Show servicelist or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Show movies"), "Infobar/showMovies", "InfoBar")) ButtonSetupFunctions.append( (_("Instant record"), "Infobar/instantRecord", "InfoBar")) ButtonSetupFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) ButtonSetupFunctions.append( (_("Start recording current event"), "Infobar/startRecordingCurrentEvent", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) ButtonSetupFunctions.append( (_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) ButtonSetupFunctions.append( (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) ButtonSetupFunctions.append( (_("Start teletext"), "Infobar/startTeletext", "InfoBar")) ButtonSetupFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) ButtonSetupFunctions.append((_("Show subtitle quick menu"), "Infobar/subtitleQuickMenu", "InfoBar")) ButtonSetupFunctions.append( (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) ButtonSetupFunctions.append( (_("Seekbar"), "Infobar/seekFwdVod", "InfoBar")) if BoxInfo.getItem("PIPAvailable"): ButtonSetupFunctions.append( (_("Show PiP"), "Infobar/showPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Swap PiP"), "Infobar/swapPiP", "InfoBar")) ButtonSetupFunctions.append( (_("Move PiP"), "Infobar/movePiP", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle PiPzap"), "Infobar/togglePipzap", "InfoBar")) ButtonSetupFunctions.append( (_("Cycle PiP(zap)"), "Infobar/activePiP", "InfoBar")) ButtonSetupFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) if BoxInfo.getItem("hdmihdin") or BoxInfo.getItem("hdmifhdin"): ButtonSetupFunctions.append( (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) ButtonSetupFunctions.append( (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) if BoxInfo.getItem("LcdLiveTV"): ButtonSetupFunctions.append( (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) if BoxInfo.getItem("canMultiBoot"): ButtonSetupFunctions.append( (_("MultiBoot Manager"), "Module/Screens.MultiBootManager/MultiBootManager", "InfoBar")) ButtonSetupFunctions.append( (_("Hotkey Settings"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup")) ButtonSetupFunctions.append( (_("Software Update"), "Module/Screens.SoftwareUpdate/SoftwareUpdate", "Setup")) if BoxInfo.getItem("ci"): ButtonSetupFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) ButtonSetupFunctions.append( (_("Videosetup"), "Module/Screens.VideoMode/VideoSetup", "Setup")) ButtonSetupFunctions.append( (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) ButtonSetupFunctions.append( (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) ButtonSetupFunctions.append( (_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) ButtonSetupFunctions.append( (_("Network Settings"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) ButtonSetupFunctions.append( (_("Network menu"), "Infobar/showNetworkMenu", "Setup")) ButtonSetupFunctions.append( (_("VPN"), "Module/Screens.NetworkSetup/NetworkOpenvpn", "Setup")) ButtonSetupFunctions.append( (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) ButtonSetupFunctions.append( (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) ButtonSetupFunctions.append( (_("SkinSelector"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) if BoxInfo.getItem("LCDSKINSetup"): ButtonSetupFunctions.append( (_("LCD SkinSelector"), "Module/Screens.SkinSelector/LcdSkinSelector", "Setup")) ButtonSetupFunctions.append( (_("RecordTimer"), "Module/Screens.Timers/RecordTimerOverview", "Setup")) ButtonSetupFunctions.append( (_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: ButtonSetupFunctions.append( (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) ButtonSetupFunctions.append( (_("Standby"), "Module/Screens.Standby/Standby", "Power")) ButtonSetupFunctions.append( (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) ButtonSetupFunctions.append( (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) ButtonSetupFunctions.append( (_("Deep Standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) ButtonSetupFunctions.append( (_("SleepTimer"), "Module/Screens.SleepTimer/SleepTimer", "Power")) ButtonSetupFunctions.append( (_("PowerTimer"), "Module/Screens.Timers/PowerTimerOverview", "Power")) ButtonSetupFunctions.append((_("Usage Setup"), "Setup/Usage", "Setup")) ButtonSetupFunctions.append( (_("User interface settings"), "Setup/UserInterface", "Setup")) ButtonSetupFunctions.append( (_("Recording Setup"), "Setup/Recording", "Setup")) ButtonSetupFunctions.append( (_("Harddisk Setup"), "Setup/HardDisk", "Setup")) ButtonSetupFunctions.append( (_("Subtitles Settings"), "Setup/Subtitle", "Setup")) ButtonSetupFunctions.append( (_("Language"), "Module/Screens.LocaleSelection/LocaleSelection", "Setup")) ButtonSetupFunctions.append( (_("OscamInfo Mainmenu"), "Module/Screens.OScamInfo/OscamInfoMenu", "Plugins")) ButtonSetupFunctions.append( (_("CCcamInfo Mainmenu"), "Module/Screens.CCcamInfo/CCcamInfoMain", "Plugins")) ButtonSetupFunctions.append( (_("Movieplayer"), "Infobar/showMoviePlayer", "Plugins")) if isdir("/etc/ppanels"): for file in [x for x in listdir("/etc/ppanels") if x.endswith(".xml")]: file = file[:-4] ButtonSetupFunctions.append( ("%s %s" % (_("PPanel"), file), "PPanel/%s" % file, "PPanels")) if isdir("/usr/script"): for file in [x for x in listdir("/usr/script") if x.endswith(".sh")]: file = file[:-3] ButtonSetupFunctions.append( ("%s %s" % (_("Shellscript"), file), "Shellscript/%s" % file, "Shellscripts")) ButtonSetupFunctions.append( (_("ScriptRunner"), "Module/Screens.ScriptRunner/ScriptRunner", "Plugins")) ButtonSetupFunctions.append( (_("QuickMenu"), "Module/Screens.QuickMenu/QuickMenu", "Plugins")) if isPluginInstalled("Kodi"): ButtonSetupFunctions.append( (_("Kodi MediaCenter"), "Kodi/", "Plugins")) if isPluginInstalled("BluetoothSetup"): ButtonSetupFunctions.append( (_("Bluetooth Setup"), "Bluetooth/", "Plugins")) if isPluginInstalled("Chromium"): ButtonSetupFunctions.append((_("Youtube TV"), "YoutubeTV/", "Plugins")) return ButtonSetupFunctions
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]), 'EPG')) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + '/' + str(twinPaths[plugin.path[24:]]), 'Plugins')) twinPlugins.append(plugin.name) ButtonSetupFunctions.append((_('Show graphical multi EPG'), 'Infobar/openGraphEPG', 'EPG')) ButtonSetupFunctions.append((_('Main menu'), 'Infobar/mainMenu', 'InfoBar')) ButtonSetupFunctions.append((_('Show help'), 'Infobar/showHelp', 'InfoBar')) ButtonSetupFunctions.append((_('Show extension selection'), 'Infobar/showExtensionSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Zap down'), 'Infobar/zapDown', 'InfoBar')) ButtonSetupFunctions.append((_('Zap up'), 'Infobar/zapUp', 'InfoBar')) ButtonSetupFunctions.append((_('Volume down'), 'Infobar/volumeDown', 'InfoBar')) ButtonSetupFunctions.append((_('Volume up'), 'Infobar/volumeUp', 'InfoBar')) ButtonSetupFunctions.append((_('Show Infobar'), 'Infobar/toggleShow', 'InfoBar')) ButtonSetupFunctions.append((_('Show service list'), 'Infobar/openServiceList', 'InfoBar')) ButtonSetupFunctions.append((_('Show favourites list'), 'Infobar/openBouquets', 'InfoBar')) ButtonSetupFunctions.append((_('Show satellites list'), 'Infobar/openSatellites', 'InfoBar')) ButtonSetupFunctions.append((_('History back'), 'Infobar/historyBack', 'InfoBar')) ButtonSetupFunctions.append((_('History next'), 'Infobar/historyNext', 'InfoBar')) ButtonSetupFunctions.append((_('Show eventinfo plugins'), 'Infobar/showEventInfoPlugins', 'EPG')) ButtonSetupFunctions.append((_('Show event details'), 'Infobar/openEventView', 'EPG')) ButtonSetupFunctions.append((_('Show single service EPG'), 'Infobar/openSingleServiceEPG', 'EPG')) ButtonSetupFunctions.append((_('Show multi channel EPG'), 'Infobar/openMultiServiceEPG', 'EPG')) ButtonSetupFunctions.append((_('Show Audioselection'), 'Infobar/audioSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Switch to radio mode'), 'Infobar/showRadio', 'InfoBar')) ButtonSetupFunctions.append((_('Switch to TV mode'), 'Infobar/showTv', 'InfoBar')) ButtonSetupFunctions.append((_('Show servicelist or movies'), 'Infobar/showServiceListOrMovies', 'InfoBar')) ButtonSetupFunctions.append((_('Show movies'), 'Infobar/showMovies', 'InfoBar')) ButtonSetupFunctions.append((_('Instant record'), 'Infobar/instantRecord', 'InfoBar')) ButtonSetupFunctions.append((_('Start instant recording'), 'Infobar/startInstantRecording', 'InfoBar')) ButtonSetupFunctions.append((_('Activate timeshift End'), 'Infobar/activateTimeshiftEnd', 'InfoBar')) ButtonSetupFunctions.append((_('Activate timeshift end and pause'), 'Infobar/activateTimeshiftEndAndPause', 'InfoBar')) ButtonSetupFunctions.append((_('Start timeshift'), 'Infobar/startTimeshift', 'InfoBar')) ButtonSetupFunctions.append((_('Stop timeshift'), 'Infobar/stopTimeshift', 'InfoBar')) ButtonSetupFunctions.append((_('Start teletext'), 'Infobar/startTeletext', 'InfoBar')) ButtonSetupFunctions.append((_('Show subservice selection'), 'Infobar/subserviceSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Show subtitle selection'), 'Infobar/subtitleSelection', 'InfoBar')) ButtonSetupFunctions.append((_('Letterbox zoom'), 'Infobar/vmodeSelection', 'InfoBar')) if SystemInfo['PIPAvailable']: ButtonSetupFunctions.append((_('Show PIP'), 'Infobar/showPiP', 'InfoBar')) ButtonSetupFunctions.append((_('Swap PIP'), 'Infobar/swapPiP', 'InfoBar')) ButtonSetupFunctions.append((_('Move PIP'), 'Infobar/movePiP', 'InfoBar')) ButtonSetupFunctions.append((_('Toggle PIPzap'), 'Infobar/togglePipzap', 'InfoBar')) ButtonSetupFunctions.append((_('Activate HbbTV (Redbutton)'), 'Infobar/activateRedButton', 'InfoBar')) ButtonSetupFunctions.append((_('Toggle HDMI-In full screen'), 'Infobar/HDMIInFull', 'InfoBar')) ButtonSetupFunctions.append((_('Toggle HDMI-In PiP'), 'Infobar/HDMIInPiP', 'InfoBar')) if SystemInfo['LcdLiveTV']: ButtonSetupFunctions.append((_('Toggle LCD LiveTV'), 'Infobar/ToggleLCDLiveTV', 'InfoBar')) ButtonSetupFunctions.append((_('Hotkey Setup'), 'Module/Screens.ButtonSetup/ButtonSetup', 'Setup')) ButtonSetupFunctions.append((_('Software update'), 'Module/Screens.SoftwareUpdate/UpdatePlugin', 'Setup')) ButtonSetupFunctions.append((_('CI (Common Interface) Setup'), 'Module/Screens.Ci/CiSelection', 'Setup')) ButtonSetupFunctions.append((_('Tuner Configuration'), 'Module/Screens.Satconfig/NimSelection', 'Scanning')) ButtonSetupFunctions.append((_('Manual Scan'), 'Module/Screens.ScanSetup/ScanSetup', 'Scanning')) ButtonSetupFunctions.append((_('Automatic Scan'), 'Module/Screens.ScanSetup/ScanSimple', 'Scanning')) for plugin in plugins.getPluginsForMenu('scan'): ButtonSetupFunctions.append((plugin[0], 'MenuPlugin/scan/' + plugin[2], 'Scanning')) ButtonSetupFunctions.append((_('Network setup'), 'Module/Screens.NetworkSetup/NetworkAdapterSelection', 'Setup')) ButtonSetupFunctions.append((_('Network menu'), 'Infobar/showNetworkMounts', 'Setup')) ButtonSetupFunctions.append((_('Plugin Browser'), 'Module/Screens.PluginBrowser/PluginBrowser', 'Setup')) ButtonSetupFunctions.append((_('Channel Info'), 'Module/Screens.ServiceInfo/ServiceInfo', 'Setup')) ButtonSetupFunctions.append((_('Timer'), 'Module/Screens.TimerEdit/TimerEditList', 'Setup')) ButtonSetupFunctions.append((_('Open AutoTimer'), 'Infobar/showAutoTimerList', 'Setup')) for plugin in plugins.getPluginsForMenu('system'): if plugin[2]: ButtonSetupFunctions.append((plugin[0], 'MenuPlugin/system/' + plugin[2], 'Setup')) ButtonSetupFunctions.append((_('Standby'), 'Module/Screens.Standby/Standby', 'Power')) ButtonSetupFunctions.append((_('Restart'), 'Module/Screens.Standby/TryQuitMainloop/2', 'Power')) ButtonSetupFunctions.append((_('Restart enigma'), 'Module/Screens.Standby/TryQuitMainloop/3', 'Power')) ButtonSetupFunctions.append((_('Deep standby'), 'Module/Screens.Standby/TryQuitMainloop/1', 'Power')) ButtonSetupFunctions.append((_('Usage Setup'), 'Setup/usage', 'Setup')) ButtonSetupFunctions.append((_('User interface settings'), 'Setup/userinterface', 'Setup')) ButtonSetupFunctions.append((_('Recording Setup'), 'Setup/recording', 'Setup')) ButtonSetupFunctions.append((_('Harddisk Setup'), 'Setup/harddisk', 'Setup')) ButtonSetupFunctions.append((_('Subtitles Settings'), 'Setup/subtitlesetup', 'Setup')) ButtonSetupFunctions.append((_('Language'), 'Module/Screens.LanguageSelection/LanguageSelection', 'Setup')) if os.path.isdir('/etc/ppanels'): for x in [ x for x in os.listdir('/etc/ppanels') if x.endswith('.xml') ]: x = x[:-4] ButtonSetupFunctions.append((_('PPanel') + ' ' + x, 'PPanel/' + x, 'PPanels')) if os.path.isdir('/usr/script'): for x in [ x for x in os.listdir('/usr/script') if x.endswith('.sh') ]: x = x[:-3] ButtonSetupFunctions.append((_('Shellscript') + ' ' + x, 'Shellscript/' + x, 'Shellscripts')) if os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/plugin.pyo'): ButtonSetupFunctions.append((_('EnhancedMovieCenter'), 'EMC/', 'Plugins')) return ButtonSetupFunctions
def __init__(self, session, parent): Screen.__init__(self, session) self.sort_mode = False self.selected_entry = None self.sub_menu_sort = None self["green"] = Label() self["yellow"] = Label() self["blue"] = Label() m_list = [] menuID = None for x in parent: #walk through the actual nodelist if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addItem(m_list, x) count += 1 elif x.tag == 'menu': item_level = int(x.get("level", 0)) if item_level <= config.usage.setup_level.index: self.addMenu(m_list, x) count += 1 elif x.tag == "id": menuID = x.get("val") count = 0 if menuID is not None: # menuupdater? if menuupdater.updatedMenuAvailable(menuID): for x in menuupdater.getUpdatedMenu(menuID): if x[1] == count: m_list.append( (x[0], boundFunction(self.runScreen, (x[2], x[3] + ", ")), x[4])) count += 1 self.menuID = menuID if config.ParentalControl.configured.value: ProtectedScreen.__init__(self) if menuID is not None: # plugins for l in plugins.getPluginsForMenu(menuID): # check if a plugin overrides an existing menu plugin_menuid = l[2] for x in m_list: if x[2] == plugin_menuid: m_list.remove(x) break if len(l) > 4 and l[4]: m_list.append( (l[0], boundFunction(l[1], self.session, self.close), l[2], l[3] or 50)) else: m_list.append( (l[0], boundFunction(l[1], self.session), l[2], l[3] or 50)) # for the skin: first try a menu_<menuID>, then Menu self.skinName = [] if menuID is not None: self.skinName.append("menu_" + menuID) self.skinName.append("Menu") self.menuID = menuID ProtectedScreen.__init__(self) if config.usage.menu_sort_mode.value == "user" and menuID == "mainmenu": plugin_list = [] id_list = [] for l in plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]): l.id = (l.name.lower()).replace(' ', '_') if l.id not in id_list: id_list.append(l.id) plugin_list.append( (l.name, boundFunction(l.__call__, session), l.id, 200)) self.list = m_list if menuID is not None and config.usage.menu_sort_mode.value == "user": self.sub_menu_sort = NoSave(ConfigDictionarySet()) self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue( self.menuID, "submenu") or {} idx = 0 for x in self.list: entry = list(self.list.pop(idx)) m_weight = self.sub_menu_sort.getConfigValue( entry[2], "sort") or entry[3] entry.append(m_weight) self.list.insert(idx, tuple(entry)) self.sub_menu_sort.changeConfigValue(entry[2], "sort", m_weight) idx += 1 self.full_list = list(m_list) if config.usage.menu_sort_mode.value == "a_z": # Sort by Name m_list.sort(key=self.sortByName) elif config.usage.menu_sort_mode.value == "user": self["blue"].setText(_("Edit mode on")) self.hide_show_entries() m_list = self.list else: # Sort by Weight m_list.sort(key=lambda x: int(x[3])) if config.usage.menu_show_numbers.value: m_list = [(str(x[0] + 1) + " " + x[1][0], x[1][1], x[1][2]) for x in enumerate(m_list)] self["menu"] = List(m_list) self["menu"].enableWrapAround = True if config.usage.menu_sort_mode.value == "user": self["menu"].onSelectionChanged.append(self.selectionChanged) self["actions"] = NumberActionMap( ["OkCancelActions", "MenuActions", "NumberActions"], { "ok": self.okbuttonClick, "cancel": self.closeNonRecursive, "menu": self.closeRecursive, #"0": self.resetSortOrder, "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 }) if config.usage.menu_sort_mode.value == "user": self["MoveActions"] = ActionMap( ["WizardActions"], { "left": self.keyLeft, "right": self.keyRight, "up": self.keyUp, "down": self.keyDown, }, -1) self["EditActions"] = ActionMap( ["ColorActions"], { "green": self.keyGreen, "yellow": self.keyYellow, "blue": self.keyBlue, }) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) if a is None: a = _(parent.get("text", "").encode("UTF-8")) else: t_history.reset() self["title"] = StaticText(a) Screen.setTitle(self, a) self.menu_title = a self["thistory"] = StaticText(t_history.thistory) history_len = len(t_history.thistory) self["title0"] = StaticText('') self["title1"] = StaticText('') self["title2"] = StaticText('') if history_len < 13: self["title0"] = StaticText(a) elif history_len < 21: self["title0"] = StaticText('') self["title1"] = StaticText(a) else: self["title0"] = StaticText('') self["title1"] = StaticText('') self["title2"] = StaticText(a) if (t_history.thistory == ''): t_history.thistory = str(a) + ' > ' else: t_history.thistory = t_history.thistory + str(a) + ' > ' self.number = 0 self.nextNumberTimer = eTimer() self.nextNumberTimer.callback.append(self.okbuttonClick)
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), 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.value: list.sort() else: list.sort(key=lambda x: int(x[3])) self["menu"] = List(list) self["actions"] = NumberActionMap(["OkCancelActions", "MenuActions", "NumberActions"], { "ok": self.okbuttonClick, "cancel": self.closeNonRecursive, "menu": self.closeRecursive, "1": self.keyNumberGlobal, "2": self.keyNumberGlobal, "3": self.keyNumberGlobal, "4": self.keyNumberGlobal, "5": self.keyNumberGlobal, "6": self.keyNumberGlobal, "7": self.keyNumberGlobal, "8": self.keyNumberGlobal, "9": self.keyNumberGlobal }) a = parent.get("title", "").encode("UTF-8") or None a = a and _(a) if a is None: a = _(parent.get("text", "").encode("UTF-8")) self["title"] = StaticText(a) Screen.setTitle(self, a) self.menu_title = a
def execButtonSetup(self, selected): if selected: selected = selected[1].split("/") if selected[0] == "Plugins": twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO ]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 if plugin.path[24:] + "/" + str(twinPaths[ plugin.path[24:]]) == "/".join(selected): self.runPlugin(plugin) break twinPlugins.append(plugin.name) elif selected[0] == "MenuPlugin": for plugin in plugins.getPluginsForMenu(selected[1]): if plugin[2] == selected[2]: self.runPlugin(plugin[1]) break elif selected[0] == "Infobar": if hasattr(self, selected[1]): exec "self." + selected[1] + "()" else: return 0 elif selected[0] == "Module": try: exec "from " + selected[1] + " import *" exec "self.session.open(" + ",".join(selected[2:]) + ")" except: print "[ButtonSetup] error during executing module %s, screen %s" % ( selected[1], selected[2]) elif selected[0] == "Setup": exec "from Screens.Setup import *" exec "self.session.open(Setup, \"" + selected[1] + "\")" elif selected[0] == "Zap": self.servicelist.servicelist.setCurrent( eServiceReference("/".join(selected[1:]))) self.servicelist.zap(enable_pipzap=True) if hasattr(self, "lastservice"): self.lastservice = eServiceReference("/".join( selected[1:])) self.close() else: self.show() elif selected[0] == "PPanel": ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml" if os.path.isfile(ppanelFileName) and os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import PPanel self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None) elif selected[0] == "Shellscript": command = '/usr/script/' + selected[1] + ".sh" if os.path.isfile(command) and os.path.isdir( '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'): from Plugins.Extensions.PPanel.ppanel import Execute self.session.open(Execute, selected[1] + " shellscript", None, command) elif selected[0] == "EMC": try: from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew from Screens.InfoBar import InfoBar open(showMoviesNew(InfoBar.instance)) except Exception as e: print('[EMCPlayer] showMovies exception:\n' + str(e))
def getButtonSetupFunctions(): ButtonSetupFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if plugin.path[24:] in twinPaths: twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 ButtonSetupFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "Plugins")) twinPlugins.append(plugin.name) ButtonSetupFunctions.append((_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG")) ButtonSetupFunctions.append((_("Main menu"), "Infobar/mainMenu", "InfoBar")) ButtonSetupFunctions.append((_("Show help"), "Infobar/showHelp", "InfoBar")) ButtonSetupFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) ButtonSetupFunctions.append((_("Show service list"), "Infobar/openServiceList", "InfoBar")) ButtonSetupFunctions.append((_("Show service list or movies"), "Infobar/showServiceListOrMovies", "InfoBar")) ButtonSetupFunctions.append((_("Show movies"), "Infobar/showMovies", "InfoBar")) ButtonSetupFunctions.append((_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar")) ButtonSetupFunctions.append((_("History back"), "Infobar/historyBack", "InfoBar")) ButtonSetupFunctions.append((_("History next"), "Infobar/historyNext", "InfoBar")) ButtonSetupFunctions.append((_("Show event info plugins"), "Infobar/showEventInfoPlugins", "EPG")) ButtonSetupFunctions.append((_("Show event details"), "Infobar/openEventView", "EPG")) ButtonSetupFunctions.append((_("Show EPG for current service"), "Infobar/openSingleServiceEPG", "EPG")) ButtonSetupFunctions.append((_("Show multi EPG"), "Infobar/openMultiServiceEPG", "EPG")) ButtonSetupFunctions.append((_("Show select audio track"), "Infobar/audioSelection", "InfoBar")) ButtonSetupFunctions.append((_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) ButtonSetupFunctions.append((_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) ButtonSetupFunctions.append((_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) ButtonSetupFunctions.append((_("Instant record"), "Infobar/instantRecord", "InfoBar")) ButtonSetupFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift end"), "Infobar/activateTimeshiftEnd", "InfoBar")) ButtonSetupFunctions.append((_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) ButtonSetupFunctions.append((_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) ButtonSetupFunctions.append((_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) ButtonSetupFunctions.append((_("Start teletext"), "Infobar/startTeletext", "InfoBar")) ButtonSetupFunctions.append((_("Show subservice selection"), "Infobar/subserviceSelection", "InfoBar")) ButtonSetupFunctions.append((_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) ButtonSetupFunctions.append((_("Seekbar"), "Infobar/seekFwdVod", "InfoBar")) if SystemInfo["PIPAvailable"]: ButtonSetupFunctions.append((_("Show PIP"), "Infobar/showPiP", "InfoBar")) ButtonSetupFunctions.append((_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) ButtonSetupFunctions.append((_("Move PIP"), "Infobar/movePiP", "InfoBar")) ButtonSetupFunctions.append((_("Toggle PIP-ZAP"), "Infobar/togglePipzap", "InfoBar")) ButtonSetupFunctions.append((_("Activate HbbTV (RedButton)"), "Infobar/activateRedButton", "InfoBar")) if SystemInfo["HasHDMIin"]: ButtonSetupFunctions.append((_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) ButtonSetupFunctions.append((_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) if SystemInfo["LcdLiveTV"]: ButtonSetupFunctions.append((_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar")) ButtonSetupFunctions.append((_("Do nothing"), "Void", "InfoBar")) ButtonSetupFunctions.append((_("Button setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup")) ButtonSetupFunctions.append((_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) ButtonSetupFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) ButtonSetupFunctions.append((_("Show stream clients"), "Module/Screens.StreamingClientsInfo/StreamingClientsInfo", "Setup")) ButtonSetupFunctions.append((_("Manual scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) ButtonSetupFunctions.append((_("Automatic scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): ButtonSetupFunctions.append((plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) ButtonSetupFunctions.append((_("Network Setup"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) ButtonSetupFunctions.append((_("Network menu"), "Infobar/showNetworkMounts", "Setup")) ButtonSetupFunctions.append((_("Plugin browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) ButtonSetupFunctions.append((_("Channel info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) ButtonSetupFunctions.append((_("Timers"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) ButtonSetupFunctions.append((_("Autotimer overview"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: ButtonSetupFunctions.append((plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) ButtonSetupFunctions.append((_("Power menu"), "Menu/shutdown", "Power")) ButtonSetupFunctions.append((_("Standby"), "Module/Screens.Standby/Standby", "Power")) ButtonSetupFunctions.append((_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) ButtonSetupFunctions.append((_("Restart GUI"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) ButtonSetupFunctions.append((_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) ButtonSetupFunctions.append((_("Usage setup"), "Setup/usage", "Setup")) ButtonSetupFunctions.append((_("User interface settings"), "Setup/userinterface", "Setup")) ButtonSetupFunctions.append((_("Recording and playback settings"), "Setup/recording", "Setup")) ButtonSetupFunctions.append((_("Skin setup"), "Module/Screens.SkinSelector/SkinSelector", "Setup")) ButtonSetupFunctions.append((_("Harddisk setup"), "Setup/harddisk", "Setup")) ButtonSetupFunctions.append((_("Subtitles settings"), "Setup/subtitlesetup", "Setup")) return ButtonSetupFunctions
def getHotkeyFunctions(): hotkeyFunctions = [] twinPlugins = [] twinPaths = {} pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "EPG")) twinPlugins.append(plugin.name) pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]) pluginlist.sort(key=lambda p: p.name) for plugin in pluginlist: if plugin.name not in twinPlugins and plugin.path: if twinPaths.has_key(plugin.path[24:]): twinPaths[plugin.path[24:]] += 1 else: twinPaths[plugin.path[24:]] = 1 hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]) , "Plugins")) twinPlugins.append(plugin.name) hotkeyFunctions.append((_("Open graphical multi EPG"), "Infobar/openGraphEPG", "EPG")) hotkeyFunctions.append((_("Open event view"), "Infobar/openEventView", "EPG")) hotkeyFunctions.append((_("Main menu"), "Infobar/mainMenu", "InfoBar")) hotkeyFunctions.append((_("Show help"), "Infobar/showHelp", "InfoBar")) hotkeyFunctions.append((_("Show extension selection"), "Infobar/showExtensionSelection", "InfoBar")) hotkeyFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar")) hotkeyFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar")) hotkeyFunctions.append((_("Switch channel up"), "Infobar/switchChannelUp", "InfoBar")) hotkeyFunctions.append((_("Switch channel down"), "Infobar/switchChannelDown", "InfoBar")) hotkeyFunctions.append((_("Open service list"), "Infobar/openServiceList", "InfoBar")) hotkeyFunctions.append((_("History back"), "Infobar/historyBack", "InfoBar")) hotkeyFunctions.append((_("History next"), "Infobar/historyNext", "InfoBar")) hotkeyFunctions.append((_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG")) hotkeyFunctions.append((_("Open single service EPG"), "Infobar/openSingleServiceEPG", "EPG")) hotkeyFunctions.append((_("Open multi Service EPG"), "Infobar/openMultiServiceEPG", "EPG")) hotkeyFunctions.append((_("Open Audioselection"), "Infobar/audioSelection", "InfoBar")) hotkeyFunctions.append((_("Switch to radio mode"), "Infobar/showRadio", "InfoBar")) hotkeyFunctions.append((_("Switch to TV mode"), "Infobar/showTv", "InfoBar")) hotkeyFunctions.append((_("Open favourites list"), "Infobar/openFavouritesList", "InfoBar")) hotkeyFunctions.append((_("Show movies"), "Infobar/showMovies", "InfoBar")) hotkeyFunctions.append((_("Instant record"), "Infobar/instantRecord", "InfoBar")) hotkeyFunctions.append((_("Start instant recording"), "Infobar/startInstantRecording", "InfoBar")) hotkeyFunctions.append((_("Activate timeshift End"), "Infobar/activateTimeshiftEnd", "InfoBar")) hotkeyFunctions.append((_("Activate timeshift end and pause"), "Infobar/activateTimeshiftEndAndPause", "InfoBar")) hotkeyFunctions.append((_("Start timeshift"), "Infobar/startTimeshift", "InfoBar")) hotkeyFunctions.append((_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar")) hotkeyFunctions.append((_("Start teletext"), "Infobar/startTeletext", "InfoBar")) hotkeyFunctions.append((_("Open subservice selection"), "Infobar/subserviceSelection", "InfoBar")) hotkeyFunctions.append((_("Open subtitle selection"), "Infobar/subtitleSelection", "InfoBar")) hotkeyFunctions.append((_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar")) if SystemInfo["PIPAvailable"]: hotkeyFunctions.append((_("Show PIP"), "Infobar/showPiP", "InfoBar")) hotkeyFunctions.append((_("Swap PIP"), "Infobar/swapPiP", "InfoBar")) hotkeyFunctions.append((_("Move PIP"), "Infobar/movePiP", "InfoBar")) hotkeyFunctions.append((_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar")) hotkeyFunctions.append((_("Activate HbbTV (Redbutton)"), "Infobar/activateRedButton", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar")) hotkeyFunctions.append((_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar")) hotkeyFunctions.append((_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup")) hotkeyFunctions.append((_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup")) hotkeyFunctions.append((_("CI (Common Interface) Setup"), "Module/Screens.Ci/CiSelection", "Setup")) hotkeyFunctions.append((_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection", "Scanning")) hotkeyFunctions.append((_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning")) hotkeyFunctions.append((_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple", "Scanning")) for plugin in plugins.getPluginsForMenu("scan"): hotkeyFunctions.append((plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning")) hotkeyFunctions.append((_("Network"), "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup")) hotkeyFunctions.append((_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser", "Setup")) hotkeyFunctions.append((_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup")) hotkeyFunctions.append((_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup")) hotkeyFunctions.append((_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup")) for plugin in plugins.getPluginsForMenu("system"): if plugin[2]: hotkeyFunctions.append((plugin[0], "MenuPlugin/system/" + plugin[2], "Setup")) hotkeyFunctions.append((_("Standby"), "Module/Screens.Standby/Standby", "Power")) hotkeyFunctions.append((_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power")) hotkeyFunctions.append((_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3", "Power")) hotkeyFunctions.append((_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1", "Power")) hotkeyFunctions.append((_("Usage Setup"), "Setup/usage", "Setup")) hotkeyFunctions.append((_("User interface settings"), "Setup/userinterface", "Setup")) hotkeyFunctions.append((_("Recording Setup"), "Setup/recording", "Setup")) hotkeyFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup")) hotkeyFunctions.append((_("Subtitles Settings"), "Setup/subtitlesetup", "Setup")) hotkeyFunctions.append((_("SleepTimer edit"), "Infobar/openSleepTimer", "NFR-Spezial")) hotkeyFunctions.append((_("Edit Red Panel"), "Infobar/OpenNFRRedPanelShow", "NFR-Spezial")) hotkeyFunctions.append((_("Edit Blue Panel"), "Infobar/OpenNFRBluePanelShow", "NFR-Spezial")) return hotkeyFunctions