def showCovers_adddetail_csfd(self, data, title): title_s = re.findall('<title>(.*?)\|', data, re.S) if title_s: if title_s[0] != "Vyhled\xc3\xa1v\xc3\xa1n\xc3\xad ": csfd_title = title_s[0] else: csfd_title = title print "EMC csfd: Movie name - %s" % csfd_title else: csfd_title = title bild = re.findall('<img src="(//img.csfd.cz/files/images/film/posters/.*?|//img.csfd.cz/posters/.*?)" alt="poster"', data, re.DOTALL | re.IGNORECASE) if bild: print "EMC csfd: Cover Select - %s" % title self.cover_count = self.cover_count + 1 csfd_url = "http:" + bild[0].replace('\\','').strip() self.menulist.append(showCoverlist(csfd_title, csfd_url, self.o_path, "csfd: ")) self["info"].setText((_("found") + " %s " + _("covers")) % (self.cover_count)) bild = re.findall('<h3>Plak.*?ty</h3>(.*?)</table>', data, re.S) if bild: bild1 = re.findall('style=\"background-image\: url\(\'(.*?)\'\)\;', bild[0], re.DOTALL | re.IGNORECASE) if bild1: for each in bild1: print "EMC csfd: Cover Select - %s" % title self.cover_count = self.cover_count + 1 csfd_url = "http:" + each.replace('\\','').strip() self.menulist.append(showCoverlist(csfd_title, csfd_url, self.o_path, "csfd: ")) self["info"].setText((_("found") + " %s " + _("covers")) % (self.cover_count)) else: print "EMC csfd 3 : no else covers - %s" % title else: print "EMC csfd 2 : no else covers - %s" % title else: print "EMC csfd 1 : keine infos gefunden - %s" % title
def Plugins(**kwargs): if debug: print pluginPrintname, "Setting entry points" list = [ PluginDescriptor( name = config.plugins.elektro.name.value, description = config.plugins.elektro.description.value + " " + _("Ver.") + " " + elektro_pluginversion, where = [ PluginDescriptor.WHERE_SESSIONSTART, PluginDescriptor.WHERE_AUTOSTART ], fnc = autostart, wakeupfnc = getNextWakeup) ] if config.plugins.elektro.menu.value == "plugin": list.append (PluginDescriptor( name = config.plugins.elektro.name.value, description = config.plugins.elektro.description.value + " " + _("Ver.") + " " + elektro_pluginversion, where = PluginDescriptor.WHERE_PLUGINMENU, icon = "elektro.png", fnc=main) ) else: list.append (PluginDescriptor( name = config.plugins.elektro.name.value, description = config.plugins.elektro.description.value + " " + _("Ver.") + " " + elektro_pluginversion, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main) ) return list
def cancel(self): global disableHDDread if config.plugins.FanControl.LogPath.value[-1:] != "/": config.plugins.FanControl.LogPath.value += "/" NeuStart = False if os.path.exists("/usr/lib/enigma2/python/Components/FanControl.py"): if not isDMMdisabled() and config.plugins.FanControl.DisableDMM.value: disableDMM() NeuStart = True if isDMMdisabled() and not config.plugins.FanControl.DisableDMM.value: enableDMM() NeuStart = True if config.plugins.FanControl.CheckHDDTemp.value == "auto" and config.plugins.FanControl.CheckHDDTemp.value != self.HDDmode: disableHDDread = True if config.plugins.FanControl.MonitorInExtension.value != self.MonitorMode: NeuStart = True for x in self["config"].list: x[1].save() if NeuStart: configfile.save() restartbox = self.session.openWithCallback(self.restartGUI,MessageBox,_("GUI needs a restart to apply the changes.\nDo you want to Restart the GUI now?"), MessageBox.TYPE_YESNO) restartbox.setTitle(_("Restart GUI now?")) else: self.close(False,self.session)
def getResults(self, data): data = data.replace('\/','') if config.plugins.tmdb.firsthit.value: # list = re.findall('"id":(.*?),.*?original_title":"(.*?)".*?"poster_path":"(.*?)".*?title":"(.*?)"', data, re.S) list = re.findall('.*?"poster_path":"(.*?)".*?"id":(.*?),.*?"original_title":"(.*?)".*?"title":"(.*?)"', data, re.S) if list: for coverPath,id,otitle,title in list: url_cover = "http://image.tmdb.org/t/p/%s/%s" % (config.plugins.tmdb.themoviedb_coversize.value, coverPath) url = "http://api.themoviedb.org/3/movie/%s?api_key=8789cfd3fbab7dccf1269c3d7d867aff&append_to_response=releases,trailers,casts&language=%s" % (id, config.plugins.tmdb.lang.value) cover = self.tempDir+id+".jpg" downloadPage(url_cover, cover).addCallback(self.openMovie, title, url, cover, id).addErrback(self.dataError) break else: print "[TMDb] no movie found." self['searchinfo'].setText(_("No Movie information found for %s") % self.text) else: urls = [] # list = re.findall('"id":(.*?),.*?original_title":"(.*?)".*?"poster_path":"(.*?)".*?title":"(.*?)"', data, re.S) list = re.findall('.*?"poster_path":"(.*?)".*?"id":(.*?),.*?"original_title":"(.*?)".*?"title":"(.*?)"', data, re.S) if list: for coverPath,id,otitle,title in list: url_cover = "http://image.tmdb.org/t/p/%s/%s" % (config.plugins.tmdb.themoviedb_coversize.value, coverPath) url = "http://api.themoviedb.org/3/movie/%s?api_key=8789cfd3fbab7dccf1269c3d7d867aff&append_to_response=releases,trailers,casts&language=%s" % (id, config.plugins.tmdb.lang.value) #print "[tmbd] " + title, url_cover, "\n", url urls.append(((title, url_cover, url, id),)) self['list'].setList(urls) self.getInfo() else: print "[TMDb] no movie found." self['searchinfo'].setText(_("No Movie information found for %s") % self.text)
def __init__(self, session): self.skin = MCS_GlobalSettings.skin Screen.__init__(self, session) self["actions"] = NumberActionMap( ["SetupActions", "OkCancelActions"], { "ok": self.keyOK, "cancel": self.close, "left": self.keyLeft, "right": self.keyRight, "0": self.keyNumber, "1": self.keyNumber, "2": self.keyNumber, "3": self.keyNumber, "4": self.keyNumber, "5": self.keyNumber, "6": self.keyNumber, "7": self.keyNumber, "8": self.keyNumber, "9": self.keyNumber, }, -1, ) self.list = [] self["configlist"] = ConfigList(self.list) self.list.append(getConfigListEntry(_("Show MC in Main-Menu"), config.plugins.mc_globalsettings.showinmainmenu)) self.list.append( getConfigListEntry(_("Show MC in Extension-Menu"), config.plugins.mc_globalsettings.showinextmenu) )
def createSetup(self): self.list = [] self.list.append(getConfigListEntry(_("Schedule MountAgain"), config.networkbrowser.automountpoll)) if config.networkbrowser.automountpoll.value: self.list.append(getConfigListEntry(_("Re-mount network shares every (in hours)"), config.networkbrowser.automountpolltimer)) self["config"].list = self.list self["config"].setList(self.list)
def conclusion_message(self): text = ''.join(self.error_messages) app_site = converter_env.web_app_site if converter_env.web_app_site is not None else _('scielo web site') status = '' result = _('updated/published on {app_site}').format(app_site=app_site) reason = '' update = True if self.xc_status == 'rejected': update = False status = validation_status.STATUS_BLOCKING_ERROR if self.total_to_convert > 0: if self.total_not_converted > 0: reason = _('because it is not complete ({value} were not converted). ').format(value=str(self.total_not_converted) + '/' + str(self.total_to_convert)) else: reason = _('because there are blocking errors in the package. ') else: reason = _('because there are blocking errors in the package. ') elif self.xc_status == 'ignored': update = False reason = _('because no document has changed. ') elif self.xc_status == 'accepted': status = validation_status.STATUS_WARNING reason = _(' even though there are some fatal errors. Note: These errors must be fixed in order to have good quality of bibliometric indicators and services. ') elif self.xc_status == 'approved': status = validation_status.STATUS_OK reason = '' else: status = validation_status.STATUS_FATAL_ERROR reason = _('because there are blocking errors in the package. ') action = _('will not be') if update: action = _('will be') text = u'{status}: {issueid} {action} {result} {reason}'.format(status=status, issueid=self.acron_issue_label, result=result, reason=reason, action=action) text = html_reports.p_message(_('converted') + ': ' + str(self.total_converted) + '/' + str(self.total_to_convert), False) + html_reports.p_message(text, False) return text
def createSetup(self): self.list = [] params = BrowserPositionSetting().getPosition() vbcfg.setPosition(params) left = params[0] width = params[1] top = params[2] height = params[3] self.dst_left = ConfigSlider(default = left, increment = 5, limits = (0, 720)) self.dst_width = ConfigSlider(default = width, increment = 5, limits = (0, 720)) self.dst_top = ConfigSlider(default = top, increment = 5, limits = (0, 576)) self.dst_height = ConfigSlider(default = height, increment = 5, limits = (0, 576)) self.dst_left_entry = getConfigListEntry(_("left"), self.dst_left) self.dst_width_entry = getConfigListEntry(_("width"), self.dst_width) self.dst_top_entry = getConfigListEntry(_("top"), self.dst_top) self.dst_height_entry = getConfigListEntry(_("height"), self.dst_height) self.list.append(self.dst_left_entry) self.list.append(self.dst_width_entry) self.list.append(self.dst_top_entry) self.list.append(self.dst_height_entry) self["config"].list = self.list self["config"].l.setList(self.list)
def openFilterByDescriptionChoice(self): from ServiceProvider import ServiceCenter from enigma import eServiceReference, iServiceInformation from MovieSelection import SHOW_ALL_MOVIES serviceHandler = ServiceCenter.getInstance() descr = [] l = serviceHandler.list(self.list.root) while 1: serviceref = l.getNext() if not serviceref.valid(): break if serviceref.flags & eServiceReference.mustDescent: continue info = serviceHandler.info(serviceref) if not info: continue description = (info.getInfoString(serviceref, iServiceInformation.sDescription),) if description[0] != "" and not description in descr: descr.append(description) descr = sorted(descr) descr.insert(0, (_(SHOW_ALL_MOVIES), )) current = self.list.filter_description selection = 0 for index, item in enumerate(descr): if item[0] == current: selection = index break self.session.openWithCallback(self.filterByDescription, ChoiceBox, title=_("Select movie by description:"), list=descr, selection=selection)
def downloadListMultiSatCallback(self, ret): self["info"].setText("%s" %(_("Downloading succesfull! Parsing ..."))) try: if os.path.exists('/tmp/multisat'): os.system("rm -rf /tmp/multisat") os.mkdir('/tmp/multisat', 644) os.system("tar -xzf /tmp/multisat.tar.gz -C/tmp/multisat") os.system("rm -f /tmp/multisat.tar.gz") idx = 0 self.list.clearList() f = open("/tmp/multisat/satlist.lst", "r") for line in f: m = line.split(";") self.list.addSelection(m[0], "/tmp/multisat/"+m[1], idx, False) idx += 1 f.close() if self.list is not None: self["info"].setText("%s" %(_("Press ok button to select satellite"))) except Exception, e: print "Error:", e self["info"].setText("%s\n%s" %(_("Parsing failed!"),e))
def __updateGUI(self): if toggleSeenButton: perc = self.list.getMovieStatus() if perc > 50: toggleSeenButton.setText(_("Mark as unseen")) else: toggleSeenButton.setText(_("Mark as seen"))
def executeCommand(self, command): printl("", self, "S") pipe = popen(command) if pipe: data = pipe.read(8192) pipe.close() if data is not None and data != "": # plugin is installed self.session.open(MessageBox, _("Information:\n") + data, MessageBox.TYPE_INFO) else: # plugin is not install if self.check == "gst": self.session.openWithCallback(self.installStreamingLibs, MessageBox, _("The selected plugin is not installed!\n Do you want to proceed to install?"), MessageBox.TYPE_YESNO) elif self.check == "curl": self.session.openWithCallback(self.installCurlLibs, MessageBox, _("The selected plugin is not installed!\n Do you want to proceed to install?"), MessageBox.TYPE_YESNO) elif self.check == "dreamplex": # for now we do nothing at this point pass else: printl("no proper value i self.check", self, "W") printl("", self, "C")
def __init__(self, session): Screen.__init__(self, session) config.hdmicec.input_address = ConfigText(default = "0", visible_width = 50, fixed_size = False) config.hdmicec.input_value1 = ConfigText(default = "0", visible_width = 50, fixed_size = False) config.hdmicec.input_value2 = ConfigText(default = "", visible_width = 50, fixed_size = False) config.hdmicec.input_value3 = ConfigText(default = "", visible_width = 50, fixed_size = False) config.hdmicec.input_value4 = ConfigText(default = "", visible_width = 50, fixed_size = False) config.hdmicec.avvolup = NoSave(ConfigNothing()) config.hdmicec.avvoldown = NoSave(ConfigNothing()) config.hdmicec.avvolmute = NoSave(ConfigNothing()) config.hdmicec.avpwroff = NoSave(ConfigNothing()) config.hdmicec.avpwron = NoSave(ConfigNothing()) config.hdmicec.tvpwroff = NoSave(ConfigNothing()) config.hdmicec.tvpwron = NoSave(ConfigNothing()) self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText(_("Connect")) self["key_blue"] = StaticText(_("Disconnect")) self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions", "NumberActions" ], { "ok": self.keyOk, "cancel": self.keyCancel, "red": self.keyCancel, "green": self.keySave, "yellow": self.keyConnect, "blue": self.keyDisconnect, }, -2) self.list = [] ConfigListScreen.__init__(self, self.list,session = session) self.createSetup()
def getMusicSections(self, selection): printl("", self, "S") mainMenuList = [] plugin = selection[2] #e.g. Plugin.MENU_MOVIES # ARTISTS params = copy.deepcopy(selection[3]) url = params['t_url'] params['t_url'] = url + "?type=8" mainMenuList.append((_("by Artists"), plugin, "artistsEntry", params)) printl("mainMenuList 1: " + str(mainMenuList), self, "D") #ALBUMS params = copy.deepcopy(selection[3]) params['t_url'] = url + "?type=9" mainMenuList.append((_("by Albums"), plugin, "albumsEntry", params)) printl("mainMenuList 2: " + str(mainMenuList), self, "D") self["menu"].setList(mainMenuList) self.refreshMenu(0) printl("mainMenuList: " + str(mainMenuList), self, "D") printl("", self, "C")
def Control(self, command, value, startcommand = "enigmalight -m 0 -f", callback = None): log("",self,"Control: c:%s v:%s" %(command, value)) #Set ConfigFile s_command = startcommand + " -c " + str(config.plugins.enigmalight.configfilepath.value) #Don't use config file for client -> host if config.plugins.enigmalight.network_onoff.value: host = str(config.plugins.enigmalight.address.getText()) port = str(config.plugins.enigmalight.port.getText()) s_command = "enigmalight -s " + host + ":" + port if value == "configtest": s_command = startcommand + " -c /tmp/enigmalight.conf.new" control = { 'command': command, 'value': value, 'startcommand': s_command} if config.plugins.enigmalight.network_onoff.value == True: #self.getPid(control,None,self.checkIfRunningFinisched) #only network mode self.checkIfRunningFinisched(control,None) elif os.path.isfile(str(config.plugins.enigmalight.configfilepath.value)) is True: # getpid and execute command self.checkIfRunning -> DoControl self.checkIfRunningFinisched(control,None) else: showMessage(self.session, _(elightconf_notfound), "W") self.setStatusBarInfo(_("Configfile not found!"))
def __init__(self, session, initDir, myType): printl("", self, "S") Screen.__init__(self, session) self.myType = myType inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"] inhibitMounts = [] self["filelist"] = FileList(initDir, showFiles=False, inhibitMounts=inhibitMounts, inhibitDirs=inhibitDirs) self["target"] = Label() self["target"].setText(initDir) self["actions"] = ActionMap(["WizardActions", "DirectionActions", "ColorActions", "EPGSelectActions"], { "back": self.cancel, "left": self.left, "right": self.right, "up": self.up, "down": self.down, "ok": self.ok, "green": self.green, "red": self.cancel }, -1) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) printl("", self, "C")
def killEnigmalightFinisched(self, result, retval, extra_args = None): log("",self) (values, callback) = extra_args log("",self,"values " + str(values)) log("",self,"result " + str(result)) log("",self,"retval " + str(retval)) log("",self,"callback " + str(callback)) time.sleep(1) if len(str(result)) == 0: self.setStatusBarInfo(_("Enigmalight killed.")) if config.plugins.enigmalight.message_onoff.getValue(): showMessage(self.session,_("Enigmalight killed.","I")) else: self.setStatusBarInfo(_("Enigmalight not killed!")) if config.plugins.enigmalight.message_onoff.getValue(): showMessage(self.session,_("Enigmalight not killed\nresult: %s") %(str(result)),"I") if callback != None: if self.callbackArgs != None: callback(self.callbackArgs) # now do callback from saved callback else: callback()
def __init__(self, _session, _url=None, _title=None): self.mUrl = _url self.mTitle = _title self.mBookmarkManager = BookmarkManager.getInstance() self.mSession = _session Screen.__init__(self, _session) self["actions"] = ActionMap(["DirectionActions", "OkCancelActions","ColorActions", "NumberActions"], { "ok" : self.keyOK, "cancel": self.keyCancel, "red" : self.keyRed, "green" : self.keyGreen, "yellow": self.keyYellow, "blue" : self.keyBlue, "0" : self.keyNumber, },-2) self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Add")) self["key_yellow"] = StaticText(_("Edit")) self["key_blue"] = StaticText(_("Delete")) self["key_0"] = StaticText(_("Set as Startpage")) self.mBookmarkList = self.setBookmarkList() self["bookmarklist"] = MenuList(self.mBookmarkList) self.onLayoutFinish.append(self.layoutFinished)
def __init__(self, session, device, partition): Screen.__init__(self, session) self.device = device self.partition = partition self.mountpoints = MountPoints() self.mountpoints.read() self.list = [] self.list.append('Mount as main hdd') self.list.append('Mount as /media/usb') self.list.append('Mount as /media/usb1') self.list.append('Mount as /media/usb2') self.list.append('Mount as /media/usb3') self.list.append('Mount as /media/cf') self.list.append('Mount as /media/mmc1') self.list.append('Mount on custom path') self['menu'] = MenuList(self.list) self['key_green'] = Button('') self['key_red'] = Button(_('Ok')) self['key_blue'] = Button(_('Exit')) self['key_yellow'] = Button('') self['actions'] = ActionMap(['OkCancelActions', 'ColorActions'], {'blue': self.quit, 'red': self.ok, 'ok': self.ok, 'cancel': self.quit}, -2) self.onShown.append(self.setWindowTitle)
def __init__(self, session): from Components.Sources.StaticText import StaticText Screen.__init__(self, session) self.skinName = "Setup" self.setup_title = _("Setup Mount Again") self.setTitle(_(self.setup_title)) self["HelpWindow"] = Pixmap() self["HelpWindow"].hide() self["VKeyIcon"] = Boolean(False) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self.onChangedEntry = [ ] self.list = [] ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) self.createSetup() self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], { "green": self.keySave, "red": self.keyCancel, "cancel": self.keyCancel, "ok": self.keySave, }, -2)
def Plugins(**kwargs): p = PluginDescriptor(where=[PluginDescriptor.WHERE_SESSIONSTART], fnc=sessionstart) p.weight = 100 #webif should start as last plugin return [p, # PluginDescriptor(where=[PluginDescriptor.WHERE_NETWORKCONFIG_READ], fnc=networkstart), PluginDescriptor(name=_("Webinterface"), description=_("Configuration for the Webinterface"), where=[PluginDescriptor.WHERE_PLUGINMENU], icon="plugin.png", fnc=openconfig)]
def __init__(self, session, iface ,plugin_path): self.skin_path = plugin_path self.session = session self.hostname = None self.restartLanRef = None Screen.__init__(self, session) self.onChangedEntry = [ ] self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { "ok": self.keyOK, "back": self.exit, "cancel": self.exit, "red": self.exit, }) self["key_red"] = StaticText(_("Close")) self["introduction"] = StaticText(_("Press OK to select.")) self.list = [] self["config"] = List(self.list) self.updateList() self.onClose.append(self.cleanup) self.onShown.append(self.setWindowTitle) if not self.selectionChanged in self["config"].onSelectionChanged: self["config"].onSelectionChanged.append(self.selectionChanged) self.selectionChanged()
def Plugins(**kwargs): from EnhancedMovieCenter import EMCVersion descriptors = [] descriptors.append(PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART, fnc=autostart)) show_p = [PluginDescriptor.WHERE_PLUGINMENU] if config.EMC.extmenu_plugin.value: show_p.append(PluginDescriptor.WHERE_EXTENSIONSMENU) descriptors.append( PluginDescriptor( name="EMC " + EMCVersion + " (Setup)", description="Enhanced Movie Center " + _("configuration"), icon="EnhancedMovieCenter.png", where=show_p, fnc=pluginOpen, ) ) if config.EMC.extmenu_list.value and not config.EMC.ml_disable.value: descriptors.append( PluginDescriptor( name="Enhanced Movie Center", description="Enhanced Movie Center " + _("movie manipulation list"), where=PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=recordingsOpen, ) ) return descriptors
def handleLeave(self, how): self.playerClosed() self.is_closing = True if how == "ask": if config.usage.setup_level.index < 2: # -expert list = ( (_("Yes"), "quit"), (_("No"), "continue") ) else: loop_msg = self.endless_loop and _("No, but stop endless loop") or _("No, but start endless loop") list = ( (_("Yes"), "quit"), (_("Yes, returning to movie list"), "movielist"), (_("Yes, and delete this movie"), "quitanddelete"), (_("Yes, and after deleting return to movie list"), "returnanddelete"), (_("No"), "continue"), (_("No, but restart from begin"), "restart"), (loop_msg, "toggle_loop") ) from Screens.ChoiceBox import ChoiceBox self.session.openWithCallback(self.leavePlayerConfirmed, ChoiceBox, title=_("Stop playing this movie?"), list=list) else: self.leavePlayerConfirmed([True, how])
def createSetup(self): self.list = [] self.mountusingEntry = getConfigListEntry(_("Mount using"), self.mountusingConfigEntry) self.list.append(self.mountusingEntry) self.activeEntry = getConfigListEntry(_("Active"), self.activeConfigEntry) self.list.append(self.activeEntry) self.sharenameEntry = getConfigListEntry(_("Local share name"), self.sharenameConfigEntry) self.list.append(self.sharenameEntry) self.mounttypeEntry = getConfigListEntry(_("Mount type"), self.mounttypeConfigEntry) self.list.append(self.mounttypeEntry) self.ipEntry = getConfigListEntry(_("Server IP"), self.ipConfigEntry) self.list.append(self.ipEntry) self.sharedirEntry = getConfigListEntry(_("Server share"), self.sharedirConfigEntry) self.list.append(self.sharedirEntry) self.hdd_replacementEntry = getConfigListEntry(_("use as HDD replacement"), self.hdd_replacementConfigEntry) self.list.append(self.hdd_replacementEntry) self.optionsEntry = getConfigListEntry(_("Mount options"), self.optionsConfigEntry) self.list.append(self.optionsEntry) if self.mounttypeConfigEntry.value == "cifs": self.usernameEntry = getConfigListEntry(_("Username"), self.usernameConfigEntry) self.list.append(self.usernameEntry) self.passwordEntry = getConfigListEntry(_("Password"), self.passwordConfigEntry) self.list.append(self.passwordEntry) self["config"].list = self.list self["config"].l.setList(self.list) self["config"].onSelectionChanged.append(self.selectionChanged)
def selectionChanged(self): current = self["list"].getCurrent() self.listindex = self["list"].getIndex() if current: if len(current[0]) >= 2: name = str(current[2]) if current[0][0] in ("nfsShare", "smbShare"): self["infotext"].setText(_("Press OK to mount this share!")) name = str(current[0][2]) + ' ( ' + str(current[0][1]) + ' )' else: name = str(current[2]) selectedhost = current[0][2] if selectedhost in self.expanded: self["infotext"].setText(_("Press OK to collapse this host")) else: self["infotext"].setText(_("Press OK to expand this host")) if current[0][0] == "nfsShare": desc = str(current[0][4]) elif current[0][0] == "smbShare": desc = str(current[0][3]) else: desc = "" else: name = "" desc = "" else: name = "" desc = "" for cb in self.onChangedEntry: cb(name, desc)
def updateTarget(self): currFolder = str(self["filelist"].getCurrentDirectory()) currFile = str(self.filelist.getCurrentDirectory()) + str(self.filelist.getFilename()) if currFolder is not None: self["help"].setText(_("Selected file: %s") %(currFile)) else: self["help"].setText(_("Invalid Location"))
def NASpowerdown(Nname,Nuser,Npass,Ncommand,Nport): from telnetlib import Telnet if Nname == "": return _("no Name") l=_("Connection Error") try: tn = Telnet(Nname, Nport, 5) l="" if Nuser != "": l = l + tn.expect(['ogin:','sername'],10)[2] l = l + tn.read_very_lazy() tn.write('%s\r' % Nuser) if Npass != "": l = l + tn.read_until('assword:',10) l = l + tn.read_very_lazy() tn.write('%s\r' % Npass) l = l + tn.expect(['#',">"],10)[2] l = l + tn.read_very_lazy() tn.write('%s\r' % Ncommand) l = l + tn.expect(['#',">"],20)[2] l = l + tn.read_very_lazy() if config.plugins.elektro.NASwait.value == True: tt = time() + 90 l = l + "\n waiting...\n" while tt>time() and ping.doOne(Nname,1) != None: sleep(2) tn.write('exit\r') l = l + tn.expect(['#',">"],5)[2] l = l + tn.read_very_lazy() tn.close() finally: return l
def __init__(self, session, device): Screen.__init__(self, session) boxinfo = BoxInfo() boxinfo.detectBox() self.device = device self.list = [] self.list.append(getConfigListEntry(_('Standby timeout:'), config.usage.hdd_standby)) ConfigListScreen.__init__(self, self.list) self['key_green'] = Button('') self['key_red'] = Button(_('Ok')) self['key_blue'] = Button(_('Exit')) self['key_yellow'] = Button('') self['model'] = Label('Model: unknow') self['serial'] = Label('Serial: unknow') self['firmware'] = Label('Firmware: unknow') self['cylinders'] = Label('Cylinders: unknow') self['heads'] = Label('Heads: unknow') self['sectors'] = Label('Sectors: unknow') self['readDisk'] = Label('Read disk speed: unknow') self['readCache'] = Label('Read disk cache speed: unknow') self['temp'] = Label('Disk temperature: unknow') self['actions'] = ActionMap(['OkCancelActions', 'ColorActions'], {'blue': self.keyCancel, 'red': self.keySave, 'cancel': self.keyCancel}, -2) self.onLayoutFinish.append(self.drawInfo) self.onShown.append(self.setWindowTitle)
def __init__(self, session, args = 0): self.session = session Screen.__init__(self, session) self.list = [] for i in range(7): self.list.append(getConfigListEntry(" 1. " + weekdays[i] + ": " + _("Wakeup"), config.plugins.elektro.wakeup[i])) self.list.append(getConfigListEntry(" 1. " + weekdays[i] + ": " + _("Sleep"), config.plugins.elektro.sleep[i])) self.list.append(getConfigListEntry(" 1. " + _("Next day starts at"), config.plugins.elektro.nextday, _("If the box is supposed to enter deep standby e.g. monday night at 1 AM, it actually is already tuesday. To enable this anyway, differing next day start time can be specified here."))) for i in range(7): self.list.append(getConfigListEntry(" 2. " + weekdays[i] + ": " + _("Wakeup"), config.plugins.elektro.wakeup2[i])) self.list.append(getConfigListEntry(" 2. " + weekdays[i] + ": " + _("Sleep"), config.plugins.elektro.sleep2[i])) self.list.append(getConfigListEntry(" 2. " + _("Next day starts at"), config.plugins.elektro.nextday2, _("If the box is supposed to enter deep standby e.g. monday night at 1 AM, it actually is already tuesday. To enable this anyway, differing next day start time can be specified here."))) ConfigListScreen.__init__(self, self.list) self["key_red"] = Button(_("Cancel")) self["key_green"] = Button(_("Ok")) self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], { "red": self.cancel, "green": self.save, "save": self.save, "cancel": self.cancel, "ok": self.save, }, -2)
def layoutFinished(self): self.setTitle(_("EMC Playlist Setup"))