def formatFinished(self): if not (self.failedJob or needHDDFormat()): msg = "Your %s %s will restart now.\n" % (getMachineBrand(), getMachineName()) msg += "If you are setting up your %s, the setup will continue after the restart." % getMachineName() self.session.openWithCallback(self.tryReboot, MessageBox, _(msg), type=MessageBox.TYPE_INFO, timeout=10) else: msg = "Formatting the internal disk of your %s %s has failed." % (getMachineBrand(), getMachineName()) msg += "\n\nPress OK to retry the format, POWER to shut down, or EXIT to skip the format." msg += "\n\nIf the internal HDD was pre-installed in your %s, please note down any error messages below and call %s support." % (getMachineName(), getMachineBrand()) self["text"].setText(msg) errs = "" if self.failedTask: errs = self.failedTask.name if self.failedJob and self.failedJob.name: if self.failedJob.name.endswith(_("...")): failedJobname = self.failedJob.name[:-len(_("..."))] if errs: errs += " in job" errs += " " + failedJobname if not errs: errs = "Disk format" errs += " failed:\n" if self.failedConditions: errs += '\n'.join(x.getErrorMessage(self.failedTask) for x in self.failedConditions) else: errs += "No error information available" self["errors"].setText(errs) self["errors"].show() self["poweractions"].setEnabled(True) if self.failedJob: job_manager.errorCB(False)
def addItems(self, list, parentNode): for x in parentNode: if not x.tag: continue if x.tag == 'item': item_level = int(x.get('level', 0)) if not self.onNotifiers: self.onNotifiers.append(self.levelChanged) self.onClose.append(self.removeNotifier) if item_level > self.onNotifiers.index: continue requires = x.get('requires') if requires and requires.startswith('config.'): item = eval(requires or '') if item.value and not item.value == '0': SystemInfo[requires] = True else: SystemInfo[requires] = False if requires and not SystemInfo.get(requires, False): continue item_text = _(x.get('text', '??').encode('UTF-8')) item_text = item_text.replace('%s %s', '%s %s' % (getMachineBrand(), getMachineName())) item_description = _(x.get('description', ' ').encode('UTF-8')) item_description = item_description.replace('%s %s', '%s %s' % (getMachineBrand(), getMachineName())) b = eval(x.text or '') if b == '': continue item = b if not isinstance(item, ConfigNothing): list.append((item_text, item, item_description))
def Start_Flashing(self): print "Start Flashing" if getBoxType() in "dm7080" "dm820": os.system('/usr/lib/enigma2/python/Plugins/Extensions/dBackup/bin/swaproot 0') else: if os.path.exists(ofgwritePath): text = _("Flashing: ") if self.simulate: text += _("Simulate (no write)") cmd = "%s -n -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp) self.close() message = "echo -e '\n" message += _('Show only found image and mtd partitions.\n') message += "'" else: text += _("root and kernel") cmd = "%s -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp) message = "echo -e '\n" message += _('ofgwrite will stop enigma2 now to run the flash.\n') message += _('Your %s %s will freeze during the flashing process.\n') % (getMachineBrand(), getMachineName()) message += _('Please: DO NOT reboot your %s %s and turn off the power.\n') % (getMachineBrand(), getMachineName()) message += _('The image or kernel will be flashing and auto booted in few minutes.\n') if self.box() == 'gb800solo': message += _('GB800SOLO takes about 20 mins !!\n') message += "'" self.session.open(Console, text,[message, cmd])
def __init__(self, session, retvalue=1): self.skin = """<screen name="QuitMainloopScreen" position="fill" flags="wfNoBorder"> <ePixmap pixmap="icons/input_info.png" position="c-27,c-60" size="53,53" alphatest="on" /> <widget name="text" position="center,c+5" size="720,100" font="Regular;22" halign="center" /> </screen>""" Screen.__init__(self, session) from Components.Label import Label text = { 1: _("Your %s %s is shutting down") % (getMachineBrand(), getMachineName()), 2: _("Your %s %s is rebooting") % (getMachineBrand(), getMachineName()), 3: _("The user interface of your %s %s is restarting") % (getMachineBrand(), getMachineName()), 4: _("Your front processor will be upgraded\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()), 5: _("The user interface of your %s %s is restarting\ndue to an error in mytest.py") % (getMachineBrand(), getMachineName()), 42: _("Upgrade in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()), 43: _("Reflash in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()), 44: _("Your front panel will be upgraded\nThis may take a few minutes")}.get(retvalue) self["text"] = Label(text) import os text2 = { 1: _("Shutting down"), 2: _("Rebooting"), 3: _("GUI restarting"), 4: _("Front processor upgrade"), 5: _("GUI restarting"), 42: _("Upgrading"), 43: _("Reflashing"), 44: _("Front panel upgrade")}.get(retvalue) cmd = "echo " + text2 + " > /dev/dbox/oled0" os.system(cmd)
def Start_Flashing(self): print "Start Flashing" #######################fix multiboot################### os.system('rm /sbin/init;ln -sfn /sbin/init.sysvinit /sbin/init') if os.path.exists(ofgwritePath): text = _("Flashing: ") if self.simulate: text += _("Simulate (no write)") cmd = "%s -n -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp) self.close() message = "echo -e '\n" message += _('Show only found image and mtd partitions.\n') message += "'" else: text += _("root and kernel") cmd = "%s -r -k %s > /dev/null 2>&1" % (ofgwritePath, flashTmp) message = "echo -e '\n" message += _('ofgwrite will stop enigma2 now to run the flash.\n') message += _('Your %s %s will freeze during the flashing process.\n') % (getMachineBrand(), getMachineName()) message += _('Please: DO NOT reboot your %s %s and turn off the power.\n') % (getMachineBrand(), getMachineName()) message += _('The image or kernel will be flashing and auto booted in few minutes.\n') if self.box() == 'gb800solo': message += _('GB800SOLO takes about 20 mins !!\n') message += "'" self.session.open(Console, text,[message, cmd])
def __init__(self, session): self.session = session self.plugin_path = mp_globals.pluginPath self.skin_path = mp_globals.pluginPath + '/skins' self.skin = '\n\t\t<screen name="defaultGenre" position="center,center" size="900,655" backgroundColor="#00060606" flags="wfNoBorder">\n\t\t\t<widget name="title" position="20,10" size="500,40" backgroundColor="#00101214" transparent="1" zPosition="10" font="Regular; 26" valign="center" halign="left" />\n\t\t\t<widget source="global.CurrentTime" render="Label" position="730,8" size="150,30" backgroundColor="#00101214" transparent="1" zPosition="1" font="Regular; 26" valign="center" halign="right" foregroundColor="#00dcdcdc">\n\t\t\t\t<convert type="ClockToText">Format:%-H:%M</convert>\n\t\t\t</widget>\n\t\t\t<widget source="global.CurrentTime" render="Label" position="580,39" size="300,20" backgroundColor="#00101214" transparent="1" zPosition="1" font="Regular;18" valign="center" halign="right" foregroundColor="#00dcdcdc">\n\t\t\t\t<convert type="ClockToText">Format:%A, %d.%m.%Y</convert>\n\t\t\t</widget>\n\t\t\t<widget name="ContentTitle" position="0,60" size="900,25" backgroundColor="#00aaaaaa" zPosition="5" foregroundColor="#00000000" font="Regular;22" halign="center" />\n\t\t\t<widget name="genreList" position="0,135" size="900,450" backgroundColor="#00101214" scrollbarMode="showOnDemand" transparent="0" />\n\t\t\t<widget name="name" position="20,95" size="860,30" foregroundColor="#00e5b243" backgroundColor="#00101214" transparent="1" font="Regular;26" valign="top" />\n\t\t\t<ePixmap pixmap="buttons/red.png" position="60,630" size="25,25" alphatest="blend" />\n\t\t\t<widget name="key_red" position="60,605" size="100,30" transparent="1" font="Regular; 20" backgroundColor="#00101214" valign="bottom" halign="center" />\n\t\t</screen>' Screen.__init__(self, session) self['actions'] = ActionMap(['OkCancelActions', 'ShortcutActions', 'WizardActions', 'ColorActions', 'SetupActions', 'NumberActions', 'MenuActions'], {'ok': self.keyOK, 'cancel': self.keyCancel, 'red': self.keyGreen}, -1) self['title'] = Label(USER_Version) self['ContentTitle'] = Label(_('Channel selection')) self['name'] = Label('') self['key_red'] = Label(_('Load')) mypath = resolveFilename(SCOPE_PLUGINS) if getMachineBrand() == 'Miraclebox': self.user_path = mypath + 'Extensions/EGAMIFaq/channels_3.xml' elif getMachineBrand() == 'Sezam': self.user_path = mypath + 'Extensions/EGAMIFaq/channels_2.xml' elif getMachineBrand() == 'UNiBOX': self.user_path = mypath + 'Extensions/EGAMIFaq/channels_1.xml' else: self.user_path = mypath + 'Extensions/EGAMIFaq/channels.xml' self.keyLocked = True self.genreliste = [] self.chooseMenuList = MenuList([], enableWrapAround=True, content=eListboxPythonMultiContent) self.chooseMenuList.l.setFont(0, gFont('Regular', 23)) self.chooseMenuList.l.setItemHeight(25) self['genreList'] = self.chooseMenuList self.onLayoutFinish.append(self.layoutFinished)
def checkNetworkStateFinished(self, result, retval, extra_args=None): if "bad address" in result: self.session.openWithCallback( self.InstallPackageFailed, MessageBox, _("Your %s %s is not connected to the internet, please check your network settings and try again.") % (getMachineBrand(), getMachineName()), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True, ) elif ("wget returned 1" or "wget returned 255" or "404 Not Found") in result: self.session.openWithCallback( self.InstallPackageFailed, MessageBox, _("Sorry feeds are down for maintenance, please try again later."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True, ) else: self.session.openWithCallback( self.InstallPackage, MessageBox, _("Your %s %s will be restarted after the installation of service.\nReady to install %s ?") % (getMachineBrand(), getMachineName(), self.service_name), MessageBox.TYPE_YESNO, )
def delay(self, val): message = _("Changes need a system restart to take effect.\nRestart your %s %s now?") % ( getMachineBrand(), getMachineName(), ) ybox = self.session.openWithCallback(self.restartBox, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_("Restart %s %s.") % (getMachineBrand(), getMachineName()))
def addItems(self, list, parentNode): for x in parentNode: if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) item_tunerlevel = int(x.get("tunerlevel", 0)) item_rectunerlevel = int(x.get("rectunerlevel", 0)) item_tuxtxtlevel = int(x.get("tt_level", 0)) if not self.onNotifiers: self.onNotifiers.append(self.levelChanged) self.onClose.append(self.removeNotifier) if item_level > config.usage.setup_level.index: continue if (item_tuxtxtlevel == 1) and (config.usage.tuxtxt_font_and_res.value != "expert_mode"): continue if item_tunerlevel == 1 and not config.usage.frontend_priority.value in ("expert_mode", "experimental_mode"): continue if item_tunerlevel == 2 and not config.usage.frontend_priority.value == "experimental_mode": continue if item_rectunerlevel == 1 and not config.usage.recording_frontend_priority.value in ("expert_mode", "experimental_mode"): continue if item_rectunerlevel == 2 and not config.usage.recording_frontend_priority.value == "experimental_mode": continue requires = x.get("requires") if requires and requires.startswith('config.'): item = eval(requires or "") if item.value and not item.value == "0": SystemInfo[requires] = True else: SystemInfo[requires] = False if requires and not SystemInfo.get(requires, False): continue if self.PluginLanguageDomain: item_text = dgettext(self.PluginLanguageDomain, x.get("text", "??").encode("UTF-8")) item_description = dgettext(self.PluginLanguageDomain, x.get("description", " ").encode("UTF-8")) else: item_text = _(x.get("text", "??").encode("UTF-8")) item_description = _(x.get("description", " ").encode("UTF-8")) item_text = item_text.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName())) item_description = item_description.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName())) b = eval(x.text or "") if b == "": continue #add to configlist item = b # the first b is the item itself, ignored by the configList. # the second one is converted to string. if not isinstance(item, ConfigNothing): list.append((item_text, item, item_description))
def populate(self): self["lab1"] = StaticText(_("Virtuosso Image Xtreme")) self["lab2"] = StaticText(_("By Team ViX")) model = None AboutText = "" self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com") if getMachineBrand() == 'Vu+': self["lab3"] = StaticText(_("Support at") + " www.vuplus-support.com") elif getMachineBrand() == 'Xtrend': self["lab3"] = StaticText(_("Support at") + " www.xtrend-support.com") elif getMachineBrand() == 'Odin': self["lab3"] = StaticText(_("Support at") + " www.odin-support.com") AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName()) if path.exists('/proc/stb/info/chipset'): AboutText += _("Chipset:\tBCM%s") % about.getChipSetString() + "\n" AboutText += _("CPU:\t%s") % about.getCPUString() + "\n" AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n" AboutText += _("Version:\t%s") % getImageVersion() + "\n" AboutText += _("Build:\t%s") % getImageBuild() + "\n" AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n" string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers:\t%s") % driversdate + "\n" AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n" fp_version = getFPVersion() if fp_version is None: fp_version = "" elif fp_version != 0: fp_version = _("Frontprocessor version: %d") % fp_version AboutText += fp_version + "\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value') and getBoxType() not in ('gbquad'): f = open('/proc/stb/sensors/temp0/value', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in ('gbquad'): f = open('/proc/stb/fp/temp_sensor', 'r') tempinfo = f.read() f.close() if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("System temperature: %s") % tempinfo.replace('\n', '') + mark + "C\n\n" self["AboutScrollLabel"] = ScrollLabel(AboutText)
def __init__(self, session, retvalue=1, timeout=-1, default_yes = True): self.retval = retvalue self.ptsmainloopvalue = retvalue recordings = session.nav.getRecordings(False,Components.RecordingConfig.recType(config.recording.warn_box_restart_rec_types.getValue())) jobs = len(job_manager.getPendingJobs()) inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(Screens.InfoBar.InfoBar.instance) self.connected = False reason = "" next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() # if jobs: # reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n' # if jobs == 1: # job = job_manager.getPendingJobs()[0] # if job.name == "VFD Checker": # reason = "" # else: # reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))) # else: # reason += (_("%d jobs are running in the background!") % jobs) + '\n' if inTimeshift: reason = _("You seem to be in timeshift!") + '\n' default_yes = True timeout=30 if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n' default_yes = False timeout=30 if reason and inStandby: session.nav.record_event.append(self.getRecordEvent) self.skinName = "" elif reason and not inStandby: text = { 1: _("Really shutdown now?"), 2: _("Really reboot now?"), 3: _("Really restart now?"), 4: _("Really upgrade the frontprocessor and reboot now?"), 9: _("The user interface of your %s %s is restarting") % (getMachineBrand(), getMachineName()), 16: _("Really reboot into Recovery Mode?"), 42: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), 43: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), 44: _("Really upgrade the front panel and reboot now?"), 45: _("Really WOL now?")}.get(retvalue) if text: MessageBox.__init__(self, session, reason+text, type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes) self.skinName = "MessageBoxSimple" session.nav.record_event.append(self.getRecordEvent) self.connected = True self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) return self.skin = """<screen position="1310,0" size="0,0"/>""" Screen.__init__(self, session) self.close(True)
def __init__(self, session, retvalue=1, timeout=-1, default_yes = True): self.retval = retvalue self.ptsmainloopvalue = retvalue recordings = session.nav.getRecordings() jobs = [] for job in job_manager.getPendingJobs(): if job.name != dgettext('vix', 'SoftcamCheck'): jobs.append(job) inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(Screens.InfoBar.InfoBar.instance) self.connected = False reason = "" next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() if config.usage.task_warning.value and len(jobs): reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", len(jobs)) % len(jobs)) + '\n' if len(jobs) == 1: job = jobs[0] reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))) else: reason += (_("%d jobs are running in the background!") % len(jobs)) + '\n' if inTimeshift: reason = _("You seem to be in timeshift!") + '\n' if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): default_yes = False reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n' if eStreamServer.getInstance().getConnectedClients() or StreamServiceList: reason += _("A client is streaming from this box!") + '\n' if reason and inStandby: session.nav.record_event.append(self.getRecordEvent) self.skinName = "" elif reason and not inStandby: text = { QUIT_SHUTDOWN: _("Really shutdown now?"), QUIT_REBOOT: _("Really reboot now?"), QUIT_RESTART: _("Really restart now?"), QUIT_MAINT: _("Really reboot into Recovery Mode?"), QUIT_UPGRADE_FP: _("Really upgrade the frontprocessor and reboot now?"), QUIT_UPGRADE_PROGRAM: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), QUIT_IMAGE_RESTORE: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()) }.get(retvalue) if text: MessageBox.__init__(self, session, "%s\n%s" % (reason, text), type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes) self.skinName = "MessageBoxSimple" session.nav.record_event.append(self.getRecordEvent) self.connected = True self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) return self.skin = """<screen position="1310,0" size="0,0"/>""" Screen.__init__(self, session) self.close(True)
def key_red(self): msg = _('Enter the city name:') city = '' if getMachineBrand() == "Miraclebox": city ="Stockholm" elif getMachineBrand() == "Sezam": city = "Moscow" elif getMachineBrand() == "Beyonwiz": city = "Canberra" else: city = "Berlin" self.session.openWithCallback(self.goSelect, InputBox, title=msg, windowTitle=_('Change city'), text=city)
def createSetupList(self): currentItem = self["config"].getCurrent() self.list = [] for x in self.setup: if not x.tag: continue if x.tag == 'item': item_level = int(x.get("level", 0)) if item_level > config.usage.setup_level.index: continue requires = x.get("requires") if requires and not requires.startswith('config.'): if requires.startswith('!'): if SystemInfo.get(requires[1:], False): continue elif not SystemInfo.get(requires, False): continue conditional = x.get("conditional") if conditional and not eval(conditional): continue # this block is just for backwards compatibility if requires and requires.startswith('config.'): item = eval(requires) if not (item.value and not item.value == "0"): continue if self.PluginLanguageDomain: item_text = dgettext(self.PluginLanguageDomain, x.get("text", "??").encode("UTF-8")) item_description = dgettext(self.PluginLanguageDomain, x.get("description", " ").encode("UTF-8")) else: item_text = _(x.get("text", "??").encode("UTF-8")) item_description = _(x.get("description", " ").encode("UTF-8")) item_text = item_text.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName())) item_description = item_description.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName())) b = eval(x.text or "") if b == "": continue #add to configlist item = b # the first b is the item itself, ignored by the configList. # the second one is converted to string. if not isinstance(item, ConfigNothing): self.list.append((item_text, item, item_description)) self["config"].setList(self.list) if config.usage.sort_settings.value: self["config"].list.sort() self.moveToItem(currentItem)
def __init__(self, session, retvalue=1, timeout=-1, default_yes = True): self.retval = retvalue self.ptsmainloopvalue = retvalue recordings = session.nav.getRecordings() jobs = [] for job in job_manager.getPendingJobs(): if job.name != dgettext('vix', 'SoftcamCheck'): jobs.append(job) inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(Screens.InfoBar.InfoBar.instance) self.connected = False reason = "" next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() if len(jobs): reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", len(jobs)) % len(jobs)) + '\n' if len(jobs) == 1: job = jobs[0] reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))) else: reason += (_("%d jobs are running in the background!") % len(jobs)) + '\n' if inTimeshift: reason = _("You seem to be in timeshift!") + '\n' if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): default_yes = False reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n' if reason and inStandby: session.nav.record_event.append(self.getRecordEvent) self.skinName = "" elif reason and not inStandby: text = { 1: _("Really shutdown now?"), 2: _("Really reboot now?"), 3: _("Really restart now?"), 4: _("Really upgrade the front processor and reboot now?"), 42: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), 43: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), 44: _("Really upgrade the front panel and reboot now?") }.get(retvalue) if text: MessageBox.__init__(self, session, reason+text, type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes) self.skinName = "MessageBoxSimple" session.nav.record_event.append(self.getRecordEvent) self.connected = True self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) return self.skin = """<screen position="1310,0" size="0,0"/>""" Screen.__init__(self, session) self.close(True)
def __init__(self, session, retvalue = 1): self.skin = '<screen name="QuitMainloopScreen" position="fill" flags="wfNoBorder">\n\t\t\t<ePixmap pixmap="icons/input_info.png" position="c-27,c-60" size="53,53" alphatest="on" />\n\t\t\t<widget name="text" position="center,c+5" size="720,100" font="Regular;22" halign="center" />\n\t\t</screen>' Screen.__init__(self, session) from Components.Label import Label text = {1: _('Your %s %s is shutting down') % (getMachineBrand(), getMachineName()), 2: _('Your %s %s is rebooting') % (getMachineBrand(), getMachineName()), 3: _('The user interface of your %s %s is restarting') % (getMachineBrand(), getMachineName()), 4: _('Your frontprocessor will be upgraded\nPlease wait until your %s %s reboots\nThis may take a few minutes') % (getMachineBrand(), getMachineName()), 5: _('The user interface of your %s %s is restarting\ndue to an error in mytest.py') % (getMachineBrand(), getMachineName()), 42: _('Upgrade in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes') % (getMachineBrand(), getMachineName()), 43: _('Reflash in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes') % (getMachineBrand(), getMachineName()), 44: _('Your front panel will be upgraded\nThis may take a few minutes'), 45: _('Your %s %s goes to WOL') % (getMachineBrand(), getMachineName())}.get(retvalue) self['text'] = Label(text)
def __init__(self, session, parent): Screen.__init__(self, session, parent=parent) self["selected"] = StaticText("ViX:" + getImageVersion()) AboutText = _("Model: %s %s\n") % (getMachineBrand(), getMachineName()) if path.exists('/proc/stb/info/chipset'): chipset = open('/proc/stb/info/chipset', 'r').read() AboutText += _("Chipset: BCM%s") % chipset.replace('\n', '') + "\n" AboutText += _("Version: %s") % getImageVersion() + "\n" AboutText += _("Build: %s") % getImageBuild() + "\n" AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n" string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers: %s") % driversdate + "\n" AboutText += _("Last update: %s") % getEnigmaVersionString() + "\n\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value'): tempinfo = open('/proc/stb/sensors/temp0/value', 'r').read() elif path.exists('/proc/stb/fp/temp_sensor'): tempinfo = open('/proc/stb/fp/temp_sensor', 'r').read() if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("System temperature: %s") % tempinfo.replace('\n', '') + mark + "C\n\n" self["AboutText"] = StaticText(AboutText)
def __init__(self, session): MessageBox.__init__(self, session, _("When you do a factory reset, you will lose ALL your configuration data\n" "(including bouquets, services, satellite data ...)\n" "After completion of factory reset, your %s %s will restart automatically!\n\n" "Really do a factory reset?") % (getMachineBrand(), getMachineName()), MessageBox.TYPE_YESNO, default = False) self.setTitle(_("Factory reset")) self.skinName = "MessageBox"
def __init__(self, session, device): Screen.__init__(self, session) self.inputDevice = device iInputDevices.currentDevice = self.inputDevice self.onChangedEntry = [ ] self.setup_title = _("Input device setup") self.isStepSlider = None self.enableEntry = None self.repeatEntry = None self.delayEntry = None self.nameEntry = None self.enableConfigEntry = None self.list = [ ] ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry) self["actions"] = ActionMap(["SetupActions", "MenuActions"], { "cancel": self.keyCancel, "save": self.apply, "menu": self.closeRecursive, }, -2) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_yellow"] = StaticText() self["key_blue"] = StaticText() self["introduction"] = StaticText() # for generating strings into .po only devicenames = [_("%s %s front panel") % (getMachineBrand(), getMachineName()),_("%s %s front panel") % (getMachineBrand(), getMachineName()),_("%s %s remote control (native)") % (getMachineBrand(), getMachineName()),_("%s %s advanced remote control (native)") % (getMachineBrand(), getMachineName()),_("%s %s ir keyboard") % (getMachineBrand(), getMachineName()),_("%s %s ir mouse") % (getMachineBrand(), getMachineName())] self.createSetup() self.onLayoutFinish.append(self.layoutFinished) self.onClose.append(self.cleanup)
def P_screenshot(self, request): box = {} box['brand'] = "dmm" if getMachineBrand() == 'Vu+': box['brand'] = "vuplus" elif getMachineBrand() == 'GigaBlue': box['brand'] = "gigablue" elif getMachineBrand() == 'Edision': box['brand'] = "edision" elif getMachineBrand() == 'iQon': box['brand'] = "iqon" elif getMachineBrand() == 'Technomate': box['brand'] = "techomate" elif fileExists("/proc/stb/info/azmodel"): box['brand'] = "azbox" return { "box": box }
def startActualUpgrade(self, answer): if not answer or not answer[1]: self.close() return if answer[1] == 'menu': message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')' choices = [(_('View the changes'), 'changes'), (_('Update and ask to reboot'), 'hot'), (_('Upgrade and reboot system'), 'cold')] choices.append((_('Update channel list only'), 'channels')) choices.append((_('Cancel'), '')) upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight) upgrademessage.setTitle(_('Software update')) elif answer[1] == 'changes': from Plugins.Extensions.EGAMINews.plugin import EGAMIMainNews self.session.openWithCallback(self.startActualUpgrade, EGAMIMainNews) elif answer[1] == 'backup': self.doSettingsBackup() elif answer[1] == 'imagebackup': self.doImageBackup() elif answer[1] == 'channels': self.channellist_only = 1 self.slider.setValue(1) self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={'installed_only': True}) elif answer[1] == 'cold': self.session.open(TryQuitMainloop, retvalue=42) self.close() else: self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args={'test_only': False})
def checkNetworkStateFinished(self, result, retval, extra_args=None): if "bad address" in result: self.session.openWithCallback( self.close, MessageBox, _("Your %s %s is not connected to the internet, please check your network settings and try again.") % (getMachineBrand(), getMachineName()), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True, ) elif ("wget returned 1" or "wget returned 255" or "404 Not Found") in result: self.session.openWithCallback( self.close, MessageBox, _( "Sorry feeds are down for maintenance, please try again later. If this issue persists please check openvix.co.uk or world-of-satellite.com." ), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True, ) elif "Collected errors" in result: self.session.openWithCallback( self.close, MessageBox, _("A background update check is in progress, please wait a few minutes and try again."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True, ) else: self.startCheck()
def __init__(self, session, args = 0): Screen.__init__(self, session) self.session = session self.MODEL = getBoxType() self.OEM = getBrandOEM() self.MACHINENAME = getMachineName() self.MACHINEBRAND = getMachineBrand() print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM self["key_green"] = Button("USB") self["key_red"] = Button("HDD") self["key_blue"] = Button(_("Exit")) self["key_yellow"] = Button("") self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB.")) self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic.")) self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "blue": self.quit, "yellow": self.yellow, "green": self.green, "red": self.red, "cancel": self.quit, }, -2)
def __init__(self, url, outfile, headers=None): client.HTTPDownloader.__init__( self, url, outfile, headers=headers, agent="%s %s HTTP Downloader" % (getMachineBrand(), getMachineName()) ) self.status = None self.progress_callback = None self.deferred = defer.Deferred()
def startActualUpgrade(self, answer): if not answer or not answer[1]: self.close() return if answer[1] == 'menu': if config.softwareupdate.updateisunstable.value == '1': message = _('The current update may be unstable') + '\n' + _('Are you sure you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')' elif config.softwareupdate.updateisunstable.value == '0': message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')' choices = [(_('Upgrade and reboot system'), 'cold')] if not self.SettingsBackupDone and not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value: choices.append((_('Perform a settings backup, making a backup before updating is strongly advised.'), 'backup')) if not self.ImageBackupDone and not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value: choices.append((_('Perform a full image backup'), 'imagebackup')) choices.append((_('Cancel'), '')) upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight) upgrademessage.setTitle(_('Software update')) elif answer[1] == 'changes': self.session.openWithCallback(self.startActualUpgrade, SoftwareUpdateChanges) elif answer[1] == 'backup': self.doSettingsBackup() elif answer[1] == 'imagebackup': self.doImageBackup() elif answer[1] == 'channels': self.channellist_only = 1 self.slider.setValue(1) self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={'installed_only': True}) elif answer[1] == 'cold': if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value or config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value: self.doAutoBackup() else: self.session.open(TryQuitMainloop, retvalue=42) self.close()
def __init__(self, session, parent): Screen.__init__(self, session, parent=parent) self['selected'] = StaticText('MediaSat:' + getImageVersion()) AboutText = _('Model: %s %s\n') % (getMachineBrand(), getMachineName()) if path.exists('/proc/stb/info/chipset'): chipset = open('/proc/stb/info/chipset', 'r').read() AboutText += _('Chipset: BCM%s') % chipset.replace('\n', '') + '\n' AboutText += _('Version: %s') % getImageVersion() + '\n' AboutText += _('Build: %s') % getImageBuild() + '\n' AboutText += _('Kernel: %s') % about.getKernelVersionString() + '\n' string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _('Drivers: %s') % driversdate + '\n' AboutText += _('Last update: %s') % getEnigmaVersionString() + '\n\n' tempinfo = '' if path.exists('/proc/stb/sensors/temp0/value'): tempinfo = open('/proc/stb/sensors/temp0/value', 'r').read() elif path.exists('/proc/stb/fp/temp_sensor'): tempinfo = open('/proc/stb/fp/temp_sensor', 'r').read() if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _('System temperature: %s') % tempinfo.replace('\n', '') + mark + 'C\n\n' self['AboutText'] = StaticText(AboutText)
def showMessageBox(self): if config.usage.boot_action.getValue() == 'normal': message = _("Your %s %s was not shutdown properly.\n\n" "Do you want to put it in %s?") % (getMachineBrand(), getMachineName(), config.usage.shutdownNOK_action.getValue()) self.session.openWithCallback(self.MsgBoxClosed, MessageBox, message, MessageBox.TYPE_YESNO, timeout = 60, default = True) else: self.MsgBoxClosed(True)
def __init__(self, session): MessageBox.__init__( self, session, _( "When you do a factory reset, you will lose ALL your configuration data\n" "(including bouquets, services, satellite data ...)\n" "After completion of factory reset, your %s %s will restart automatically!\n\n" "Really do a factory reset?" ) % (getMachineBrand(), getMachineName()), MessageBox.TYPE_YESNO, default=False, ) self.setTitle(_("Factory reset")) self.skinName = "MessageBox" if self.isProtected() and config.ParentalControl.servicepin[0].value: self.onFirstExecBegin.append( boundFunction( self.session.openWithCallback, self.pinEntered, PinInput, pinList=[x.value for x in config.ParentalControl.servicepin], triesEntry=config.ParentalControl.retries.servicepin, title=_("Please enter the correct pin code"), windowTitle=_("Enter pin code"), ) )
def green(self): sel = self["imageList"].l.getCurrentSelection() if sel == None: print"Nothing to select !!" return file_name = self.imagePath + "/" + sel self.filename = file_name box = self.box() brand = getMachineBrand() self.hide() if self.Online: if self.imagesCounter == 0: url = self.feedurl + "/" + brand + "/" + box + "/" + sel else: url = self.feedurl + "/" + brand + "/" + box + "/" + sel print "URL:", url u = urllib2.urlopen(url) f = open(file_name, 'wb') meta = u.info() file_size = int(meta.getheaders("Content-Length")[0]) print "Downloading: %s Bytes: %s" % (sel, file_size) job = ImageDownloadJob(url, file_name, sel) job.afterEvent = "close" job_manager.AddJob(job) job_manager.failed_jobs = [] self.session.openWithCallback(self.ImageDownloadCB, JobView, job, backgroundable = False, afterEventChangeable = False) else: if sel == str(flashTmp): self.Start_Flashing() else: self.unzip_image(self.filename, flashPath)
def imageInfo(self): AboutText = _("OpenHDF Full-Image Backupscript\n") AboutText += _("Support at") + " www.hdfreaks.cc\n\n" AboutText += _("[Image Info's]\n") AboutText += _("Model: %s %s\n") % (getMachineBrand(), getMachineName()) AboutText += _("Backup Date: %s\n") % strftime("%Y-%m-%d", localtime(self.START)) if path.exists('/proc/stb/info/chipset'): AboutText += _("Chipset: BCM%s") % about.getChipSetString().lower().replace('\n','').replace('bcm','') + "\n" #AboutText += _("CPU: %s") % about.getCPUString() + "\n" AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n" AboutText += _("Version: %s") % getImageVersion() + "\n" AboutText += _("Build: %s") % getImageBuild() + "\n" AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n" string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers:\t%s") % driversdate + "\n" AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n" AboutText += _("[Enigma2 Settings]\n") AboutText += commands.getoutput("cat /etc/enigma2/settings") AboutText += _("\n[Installed Plugins]\n") AboutText += commands.getoutput("opkg list_installed | grep enigma2-plugin-") return AboutText
def getAboutText(): AboutText = "" AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName()) AboutText += _("OEM Model:\t\t%s\n") % getMachineBuild() bootloader = "" if path.exists('/sys/firmware/devicetree/base/bolt/tag'): f = open('/sys/firmware/devicetree/base/bolt/tag', 'r') bootloader = f.readline().replace('\x00', '').replace('\n', '') f.close() AboutText += _("Bootloader:\t\t%s\n") % (bootloader) if path.exists('/proc/stb/info/chipset'): AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n" cpuMHz = "" if getMachineBuild() in ('vusolo4k','vuultimo4k','vuzero4k'): cpuMHz = " (1,5 GHz)" elif getMachineBuild() in ('formuler1tc','formuler1', 'triplex', 'tiviaraplus'): cpuMHz = " (1,3 GHz)" elif getMachineBuild() in ('u5','u5pvr','h9'): cpuMHz = " (1,6 GHz)" elif getMachineBuild() in ('vuuno4kse','vuuno4k','dm900','dm920', 'gb7252', 'dags7252','xc7439','8100s'): cpuMHz = " (1,7 GHz)" elif getMachineBuild() in ('sf5008','et13000','et1x000','hd52','hd51','sf4008','vs1500','h7'): try: import binascii f = open('/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb') clockfrequency = f.read() f.close() cpuMHz = " (%s MHz)" % str(round(int(binascii.hexlify(clockfrequency), 16)/1000000,1)) except: cpuMHz = " (1,7 GHz)" else: if path.exists('/proc/cpuinfo'): f = open('/proc/cpuinfo', 'r') temp = f.readlines() f.close() try: for lines in temp: lisp = lines.split(': ') if lisp[0].startswith('cpu MHz'): #cpuMHz = " (" + lisp[1].replace('\n', '') + " MHz)" cpuMHz = " (" + str(int(float(lisp[1].replace('\n', '')))) + " MHz)" break except: pass AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n" AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n" imagestarted = "" bootname = '' if path.exists('/boot/bootname'): f = open('/boot/bootname', 'r') bootname = f.readline().split('=')[1] f.close() if path.exists('/boot/STARTUP'): f = open('/boot/STARTUP', 'r') f.seek(22) image = f.read(1) f.close() if bootname: bootname = " (%s)" %bootname AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n" elif path.exists('/boot/cmdline.txt'): f = open('/boot/cmdline.txt', 'r') f.seek(38) image = f.read(1) f.close() if bootname: bootname = " (%s)" %bootname AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n" AboutText += _("Version:\t%s") % getImageVersion() + "\n" AboutText += _("Build:\t%s") % getImageBuild() + "\n" AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n" string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers:\t%s") % driversdate + "\n" AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n" AboutText += _("Python:\t%s") % about.getPythonVersionString() + "\n" if getMachineBuild() not in ('h9','vuzero4k','sf5008','et13000','et1x000','hd51','hd52','vusolo4k','vuuno4k','vuuno4kse','vuultimo4k','sf4008','dm820','dm7080','dm900','dm920', 'gb7252', 'dags7252', 'vs1500','h7','xc7439','8100s','u5','u5pvr'): AboutText += _("Installed:\t%s") % about.getFlashDateString() + "\n" AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n" fp_version = getFPVersion() if fp_version is None: fp_version = "" elif fp_version != 0: fp_version = _("Frontprocessor version: %s") % fp_version AboutText += fp_version + "\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value'): f = open('/proc/stb/sensors/temp0/value', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/fp/temp_sensor'): f = open('/proc/stb/fp/temp_sensor', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/sensors/temp/value'): f = open('/proc/stb/sensors/temp/value', 'r') tempinfo = f.read() f.close() if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("System temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" tempinfo = "" if path.exists('/proc/stb/fp/temp_sensor_avs'): f = open('/proc/stb/fp/temp_sensor_avs', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): try: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() except: tempinfo = "" if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("Processor temperature:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" AboutLcdText = AboutText.replace('\t', ' ') return AboutText, AboutLcdText
def activate(self): global DSsave, RSsave, RBsave, aeDSsave, wasPowerTimerWakeup, wakeupEnd next_state = self.state + 1 self.log(5, "activating state %d" % next_state) if next_state == 1 and (self.timerType == TIMERTYPE.AUTOSTANDBY or self.timerType == TIMERTYPE.AUTODEEPSTANDBY): eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.keyPressed) self.begin = time() + int(self.autosleepdelay) * 60 if self.end <= self.begin: self.end = self.begin if next_state == self.StatePrepared: self.log(6, "prepare ok, waiting for begin") self.next_activation = self.begin self.backoff = 0 return True elif next_state == self.StateRunning: if os.path.exists( "/tmp/was_powertimer_wakeup") and not wasPowerTimerWakeup: wasPowerTimerWakeup = int( open("/tmp/was_powertimer_wakeup", "r").read()) and True or False if wasPowerTimerWakeup and time() >= wakeupEnd: resetTimerWakeup() # if this timer has been cancelled, just go to "end" state. if self.cancelled: return True if self.failed: return True if self.timerType == TIMERTYPE.WAKEUP: if Screens.Standby.inStandby: Screens.Standby.inStandby.Power() return True elif self.timerType == TIMERTYPE.WAKEUPTOSTANDBY: return True elif self.timerType == TIMERTYPE.STANDBY: if not Screens.Standby.inStandby: # not already in standby Notifications.AddNotificationWithCallback( self.sendStandbyNotification, MessageBox, _("A finished powertimer wants to set your\n%s %s to standby. Do that now?" ) % (getMachineBrand(), getMachineName()), timeout=180) return True elif self.timerType == TIMERTYPE.AUTOSTANDBY: if not Screens.Standby.inStandby: # not already in standby Notifications.AddNotificationWithCallback( self.sendStandbyNotification, MessageBox, _("A finished powertimer wants to set your\n%s %s to standby. Do that now?" ) % (getMachineBrand(), getMachineName()), timeout=180) if self.autosleeprepeat == "once": eActionMap.getInstance().unbindAction( '', self.keyPressed) return True else: self.begin = time() + int(self.autosleepdelay) * 60 if self.end <= self.begin: self.end = self.begin else: self.begin = time() + int(self.autosleepdelay) * 60 if self.end <= self.begin: self.end = self.begin elif self.timerType == TIMERTYPE.AUTODEEPSTANDBY: if wasPowerTimerWakeup or ( NavigationInstance.instance.RecordTimer.isRecording() or abs(NavigationInstance.instance.RecordTimer. getNextRecordingTime() - time()) <= 900 or abs(NavigationInstance.instance.RecordTimer. getNextZapTime() - time()) <= 900) or ( self.autosleepinstandbyonly == 'yes' and not Screens.Standby.inStandby): self.do_backoff() # retry self.begin = time() + self.backoff if self.end <= self.begin: self.end = self.begin return False if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open if self.autosleeprepeat == "once": self.disabled = True if Screens.Standby.inStandby: # in standby print "[PowerTimer] quitMainloop #1" quitMainloop(1) return True else: Notifications.AddNotificationWithCallback( self.sendTryQuitMainloopNotification, MessageBox, _("A finished powertimer wants to shutdown your %s %s.\nDo that now?" ) % (getMachineBrand(), getMachineName()), timeout=180) if self.autosleeprepeat == "once": eActionMap.getInstance().unbindAction( '', self.keyPressed) return True else: self.begin = time() + int(self.autosleepdelay) * 60 if self.end <= self.begin: self.end = self.begin elif self.timerType == TIMERTYPE.DEEPSTANDBY: if wasPowerTimerWakeup or NavigationInstance.instance.RecordTimer.isRecording( ) or abs(NavigationInstance.instance.RecordTimer. getNextRecordingTime() - time()) <= 900 or abs(NavigationInstance.instance. RecordTimer.getNextZapTime() - time()) <= 900: if int(self.repeated) > 0 and not DSsave: self.DSbegin = self.begin self.DSend = self.end DSsave = True self.do_backoff() # retry self.begin = time() + self.backoff if self.end <= self.begin: self.end = self.begin return False if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open if DSsave: DSsave = False self.begin = self.DSbegin self.end = self.DSend if Screens.Standby.inStandby: # in standby print "[PowerTimer] quitMainloop #2" quitMainloop(1) else: Notifications.AddNotificationWithCallback( self.sendTryQuitMainloopNotification, MessageBox, _("A finished powertimer wants to shutdown your %s %s.\nDo that now?" ) % (getMachineBrand(), getMachineName()), timeout=180) return True elif self.timerType == TIMERTYPE.REBOOT: if wasPowerTimerWakeup or NavigationInstance.instance.RecordTimer.isRecording( ) or abs(NavigationInstance.instance.RecordTimer. getNextRecordingTime() - time()) <= 900 or abs(NavigationInstance.instance. RecordTimer.getNextZapTime() - time()) <= 900: if int(self.repeated) > 0 and not RBsave: self.RBbegin = self.begin self.RBend = self.end RBsave = True self.do_backoff() # retry self.begin = time() + self.backoff if self.end <= self.begin: self.end = self.begin return False if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open if RBsave: RBsave = False self.begin = self.RBbegin self.end = self.RBend if Screens.Standby.inStandby: # in standby print "[PowerTimer] quitMainloop #3" quitMainloop(2) else: Notifications.AddNotificationWithCallback( self.sendTryToRebootNotification, MessageBox, _("A finished powertimer wants to reboot your %s %s.\nDo that now?" ) % (getMachineBrand(), getMachineName()), timeout=180) return True elif self.timerType == TIMERTYPE.RESTART: if wasPowerTimerWakeup or NavigationInstance.instance.RecordTimer.isRecording( ) or abs(NavigationInstance.instance.RecordTimer. getNextRecordingTime() - time()) <= 900 or abs(NavigationInstance.instance. RecordTimer.getNextZapTime() - time()) <= 900: if int(self.repeated) > 0 and not RSsave: self.RSbegin = self.begin self.RSend = self.end RSsave = True self.do_backoff() # retry self.begin = time() + self.backoff if self.end <= self.begin: self.end = self.begin return False if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open if RSsave: RSsave = False self.begin = self.RSbegin self.end = self.RSend if Screens.Standby.inStandby: # in standby print "[PowerTimer] quitMainloop #4" quitMainloop(3) else: Notifications.AddNotificationWithCallback( self.sendTryToRestartNotification, MessageBox, _("A finished powertimer wants to restart the user interface.\nDo that now?" ), timeout=180) return True elif next_state == self.StateEnded: resetTimerWakeup() NavigationInstance.instance.PowerTimer.saveTimer() if self.afterEvent == AFTEREVENT.STANDBY: if not Screens.Standby.inStandby: # not already in standby Notifications.AddNotificationWithCallback( self.sendStandbyNotification, MessageBox, _("A finished powertimer wants to set your\n%s %s to standby. Do that now?" ) % (getMachineBrand(), getMachineName()), timeout=180) elif self.afterEvent == AFTEREVENT.DEEPSTANDBY: if NavigationInstance.instance.RecordTimer.isRecording( ) or abs(NavigationInstance.instance.RecordTimer. getNextRecordingTime() - time()) <= 900 or abs(NavigationInstance.instance. RecordTimer.getNextZapTime() - time()) <= 900: if int(self.repeated) > 0 and not aeDSsave: self.aeDSbegin = self.begin self.aeDSend = self.end aeDSsave = True self.do_backoff() # retry self.begin = time() + self.backoff if self.end <= self.begin: self.end = self.begin return False if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open if aeDSsave: aeDSsave = False self.begin = self.aeDSbegin self.end = self.aeDSend if Screens.Standby.inStandby: # in standby print "[PowerTimer] quitMainloop #5" quitMainloop(1) else: Notifications.AddNotificationWithCallback( self.sendTryQuitMainloopNotification, MessageBox, _("A finished power timer wants to shut down\nyour %s %s. Shutdown now?" ) % (getMachineBrand(), getMachineName()), timeout=180) return True
def getNumVideoDecoders(): numVideoDecoders = 0 while fileExists("/dev/dvb/adapter0/video%d" % numVideoDecoders, "f"): numVideoDecoders += 1 return numVideoDecoders def countFrontpanelLEDs(): numLeds = fileExists("/proc/stb/fp/led_set_pattern") and 1 or 0 while fileExists("/proc/stb/fp/led%d_pattern" % numLeds): numLeds += 1 return numLeds SystemInfo["MachineBrand"] = getMachineBrand() SystemInfo["MachineName"] = getMachineName() SystemInfo["DeveloperImage"] = getImageType().lower() != "release" SystemInfo["CommonInterface"] = eDVBCIInterfaces.getInstance().getNumOfSlots() SystemInfo["CommonInterfaceCIDelay"] = fileCheck("/proc/stb/tsmux/rmx_delay") for cislot in range(0, SystemInfo["CommonInterface"]): SystemInfo["CI%dSupportsHighBitrates" % cislot] = fileCheck( "/proc/stb/tsmux/ci%d_tsclk" % cislot) SystemInfo["CI%dRelevantPidsRoutingSupport" % cislot] = fileCheck( "/proc/stb/tsmux/ci%d_relevant_pids_routing" % cislot) SystemInfo["NumVideoDecoders"] = getNumVideoDecoders() SystemInfo["Udev"] = not fileExists("/dev/.devfsd") SystemInfo["PIPAvailable"] = SystemInfo["NumVideoDecoders"] > 1 SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance( ).canMeasureFrontendInputPower() SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
from boxbranding import getBoxType, getMachineBrand, getMachineBuild, getBrandOEM from Tools.StbHardware import getFPVersion import os boxtype = getBoxType() machinebuild = getMachineBuild() machinebrand = getMachineBrand() brandoem = getBrandOEM() class RcModel: def __init__(self): pass def rcIsDefault(self): if self.getRcFolder() != 'dmm0': return False return True def readFile(self, target): fp = open(target, 'r') out = fp.read() fp.close() return out.split()[0] def process(self, line): if line.lower().startswith('config.usage.rc_model='): parts = line.split('=') folder = parts[-1].rstrip() if os.path.isfile('/usr/share/enigma2/rc_models/' + folder + '/rc.png') and os.path.isfile(
def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_DOWNLOAD: self.status.setText(_('Downloading')) else: if event == IpkgComponent.EVENT_UPGRADE: if self.sliderPackages.has_key(param): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_('Upgrading')) if param not in self.processed_packages: self.processed_packages.append(param) self.packages += 1 else: if event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_('Installing')) if param not in self.processed_packages: self.processed_packages.append(param) self.packages += 1 else: if event == IpkgComponent.EVENT_REMOVE: self.package.setText(param) self.status.setText(_('Removing')) if param not in self.processed_packages: self.processed_packages.append(param) self.packages += 1 else: if event == IpkgComponent.EVENT_CONFIGURING: self.package.setText(param) self.status.setText(_('Configuring')) else: if event == IpkgComponent.EVENT_MODIFIED: self.ipkg.write('Y') else: if event == IpkgComponent.EVENT_ERROR: self['actions'].setEnabled(True) else: if event == IpkgComponent.EVENT_DONE: if self.updating: self.updating = False if config.usage.use_package_conffile.value == True: upgrade_args = { 'use_maintainer': True, 'test_only': False } else: upgrade_args = { 'use_maintainer': False, 'test_only': False } if config.usage.use_force_overwrite.value: upgrade_args[ 'force_overwrite'] = True else: upgrade_args[ 'force_overwrite'] = False self.ipkg.startCmd( IpkgComponent.CMD_UPGRADE, args=upgrade_args) elif self.error == 0: self.slider.setValue(4) self.activityTimer.stop() self.activityslider.setValue(0) self.package.setText( _('Done - Installed or upgraded %d packages' ) % self.packages) self.status.setText(self.oktext) self['actions'].setEnabled(True) else: self.activityTimer.stop() self.activityslider.setValue(0) error = _( 'your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your STB.' ) % (getMachineBrand(), getMachineName()) if self.packages == 0: error = _( 'No packages were upgraded yet. So you can check your network and try again.' ) if self.updating: error = _( "Your %s %s isn't connected to the internet properly. Please check it and try again." ) % (getMachineBrand(), getMachineName()) self.status.setText( _('Error') + ' - ' + error) self['actions'].setEnabled(True)
def __evVideoDecodeError(self): currPlay = self.session.nav.getCurrentService() sTagVideoCodec = currPlay.info().getInfoString(iServiceInformation.sTagVideoCodec) print("[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % sTagVideoCodec) self.session.open(MessageBox, _("This %s %s cannot decode %s streams!") % (getMachineBrand(), getMachineName(), sTagVideoCodec), type = MessageBox.TYPE_INFO, timeout = 20 )
def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_DOWNLOAD: self.status.setText(_("Downloading")) elif event == IpkgComponent.EVENT_UPGRADE: if self.sliderPackages.has_key(param): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText( _("Upgrading") + ": %s/%s" % (self.packages, self.total_packages)) if not param in self.processed_packages: self.processed_packages.append(param) self.packages += 1 elif event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_("Installing")) if not param in self.processed_packages: self.processed_packages.append(param) self.packages += 1 elif event == IpkgComponent.EVENT_REMOVE: self.package.setText(param) self.status.setText(_("Removing")) if not param in self.processed_packages: self.processed_packages.append(param) self.packages += 1 elif event == IpkgComponent.EVENT_CONFIGURING: self.package.setText(param) self.status.setText(_("Configuring")) elif event == IpkgComponent.EVENT_MODIFIED: if config.plugins.softwaremanager.overwriteConfigFiles.value in ( "N", "Y"): self.ipkg.write(True and config.plugins.softwaremanager. overwriteConfigFiles.getValue()) else: self.session.openWithCallback( self.modificationCallback, MessageBox, _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?" ) % param) elif event == IpkgComponent.EVENT_ERROR: self.error += 1 elif event == IpkgComponent.EVENT_DONE: if self.updating: self.updating = False self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST) elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST: from urllib import urlopen import socket currentTimeoutDefault = socket.getdefaulttimeout() socket.setdefaulttimeout(3) try: config.softwareupdate.updateisunstable.setValue( urlopen("http://www.droidsat.org/status").read()) except: config.softwareupdate.updateisunstable.setValue('1') socket.setdefaulttimeout(currentTimeoutDefault) self.total_packages = None if config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value: self.total_packages = len(self.ipkg.getFetchedList()) message = _( "The current update may be unstable") + "\n" + _( "Are you sure you want to update your %s %s ?" ) % (getMachineBrand(), getMachineName()) + "\n(" + ( ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")" elif config.softwareupdate.updateisunstable.value == '0': self.total_packages = len(self.ipkg.getFetchedList()) message = _("Do you want to update your %s %s ?") % ( getMachineBrand(), getMachineName()) + "\n(" + ( ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")" if self.total_packages: global ocram for package_tmp in self.ipkg.getFetchedList(): if package_tmp[0].startswith( 'enigma2-plugin-picons-tv-ocram'): ocram = ocram + '[ocram-picons] ' + package_tmp[ 0].split('enigma2-plugin-picons-tv-ocram.')[ 1] + 'updated ' + package_tmp[2] + '\n' elif package_tmp[0].startswith( 'enigma2-plugin-settings-ocram'): ocram = ocram + '[ocram-settings] ' + package_tmp[ 0].split('enigma2-plugin-picons-tv-ocram.')[ 1] + 'updated ' + package_tmp[2] + '\n' config.softwareupdate.updatefound.setValue(True) choices = [(_("View the changes"), "changes"), (_("Upgrade and reboot system"), "cold")] if path.exists( "/usr/lib/enigma2/python/Plugins/SystemPlugins/ViX/BackupManager.pyo" ): if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value: choices.append( (_("Perform a settings backup,") + '\n\t' + _("making a backup before updating") + '\n\t' + _("is strongly advised."), "backup")) if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value: choices.append((_("Perform a full image backup"), "imagebackup")) choices.append((_("Update channel list only"), "channels")) choices.append((_("Cancel"), "")) upgrademessage = self.session.openWithCallback( self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name="SoftwareUpdateChoices") upgrademessage.setTitle(_('Software update')) else: upgrademessage = self.session.openWithCallback( self.close, MessageBox, _("Nothing to upgrade"), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True) upgrademessage.setTitle(_('Software update')) elif self.channellist_only > 0: if self.channellist_only == 1: self.setEndMessage( _("Could not find installed channel list.")) elif self.channellist_only == 2: self.slider.setValue(2) self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name}) self.channellist_only += 1 elif self.channellist_only == 3: self.slider.setValue(3) self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name}) self.channellist_only += 1 elif self.channellist_only == 4: self.showUpdateCompletedMessage() eDVBDB.getInstance().reloadBouquets() eDVBDB.getInstance().reloadServicelist() elif self.error == 0: self.showUpdateCompletedMessage() else: self.activityTimer.stop() self.activityslider.setValue(0) error = _( "Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s." ) % (getMachineBrand(), getMachineName(), getMachineBrand(), getMachineName()) if self.packages == 0: error = _("No updates available. Please try again later.") if self.updating: error = _( "Update failed. Your %s %s does not have a working internet connection." ) % (getMachineBrand(), getMachineName()) self.status.setText(_("Error") + " - " + error) elif event == IpkgComponent.EVENT_LISTITEM: if 'enigma2-plugin-settings-' in param[ 0] and self.channellist_only > 0: self.channellist_name = param[0] self.channellist_only = 2 #print event, "-", param pass
def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_DOWNLOAD: self.status.setText(_("Downloading")) elif event == IpkgComponent.EVENT_UPGRADE: if param in self.sliderPackages: self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_("Upgrading") + ": %s/%s" % (self.packages, self.total_packages)) if not param in self.processed_packages: self.processed_packages.append(param) self.packages += 1 elif event == IpkgComponent.EVENT_INSTALL: self.package.setText(param) self.status.setText(_("Installing")) if not param in self.processed_packages: self.processed_packages.append(param) self.packages += 1 elif event == IpkgComponent.EVENT_REMOVE: self.package.setText(param) self.status.setText(_("Removing")) if not param in self.processed_packages: self.processed_packages.append(param) self.packages += 1 elif event == IpkgComponent.EVENT_CONFIGURING: self.package.setText(param) self.status.setText(_("Configuring")) elif event == IpkgComponent.EVENT_MODIFIED: if config.plugins.softwaremanager.overwriteConfigFiles.value in ("N", "Y"): self.ipkg.write(True and config.plugins.softwaremanager.overwriteConfigFiles.value) else: self["actions"].setEnabled(True) self.session.openWithCallback( self.modificationCallback, MessageBox, _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?") % param ) elif event == IpkgComponent.EVENT_ERROR: self.error += 1 self.updating = False elif event == IpkgComponent.EVENT_DONE: if self.updating: self.updating = False self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST) elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST: self.total_packages = None if getImageType() != 'release' or (config.softwareupdate.updateisunstable.value == 1 and config.softwareupdate.updatebeta.value): self.total_packages = len(self.ipkg.getFetchedList()) message = _("The current update may be unstable") + "\n" + _("Are you sure you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(" + (ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")" elif config.softwareupdate.updateisunstable.value == 0: self.total_packages = len(self.ipkg.getFetchedList()) message = _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(" + (ngettext("%s updated package available", "%s updated packages available", self.total_packages) % self.total_packages) + ")" if self.total_packages is not None and self.total_packages > 150: message += " " + _("Reflash recommended!") if self.total_packages: global ocram ocram = '' for package_tmp in self.ipkg.getFetchedList(): if package_tmp[0].startswith('enigma2-plugin-picons-snp'): ocram = ocram + '[ocram-picons] ' + package_tmp[0].split('enigma2-plugin-picons-snp-')[1].replace('.', ' ') + ' updated ' + package_tmp[2].replace('--', ' ') + '\n' elif package_tmp[0].startswith('enigma2-plugin-picons-srp'): ocram = ocram + '[ocram-picons] ' + package_tmp[0].split('enigma2-plugin-picons-srp-')[1].replace('.', ' ') + ' updated ' + package_tmp[2].replace('--', ' ') + '\n' config.softwareupdate.updatefound.setValue(True) choices = [(_("View the changes"), "changes"), (_("Upgrade and reboot system"), "cold")] if isPluginInstalled("ViX"): if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value: choices.append((_("Perform a settings backup,") + '\n\t' + _("making a backup before updating") + '\n\t' + _("is strongly advised."), "backup")) if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value: choices.append((_("Perform a full image backup"), "imagebackup")) choices.append((_("Update channel list only"), "channels")) choices.append((_("Cancel"), "")) self["actions"].setEnabled(True) upgrademessage = self.session.openWithCallback(self.startActualUpgrade, UpdateChoices, text=message, list=choices, skin_name="SoftwareUpdateChoices", var=self.trafficLight) upgrademessage.setTitle(self.getTitle()) else: message = _("No updates found, Press OK to exit this screen.") choices = [(_("Nothing to upgrade"), "")] self["actions"].setEnabled(True) upgrademessage = self.session.openWithCallback(self.startActualUpgrade, UpdateChoices, text=message, list=choices, skin_name="SoftwareUpdateChoices", var=self.trafficLight) upgrademessage.setTitle(self.getTitle()) elif self.channellist_only > 0: if self.channellist_only == 1: self.setEndMessage(_("Could not find installed channel list.")) elif self.channellist_only == 2: self.slider.setValue(2) self.ipkg.startCmd(IpkgComponent.CMD_REMOVE, {'package': self.channellist_name}) self.channellist_only += 1 elif self.channellist_only == 3: self.slider.setValue(3) self.ipkg.startCmd(IpkgComponent.CMD_INSTALL, {'package': self.channellist_name}) self.channellist_only += 1 elif self.channellist_only == 4: self.showUpdateCompletedMessage() eDVBDB.getInstance().reloadBouquets() eDVBDB.getInstance().reloadServicelist() elif self.error == 0: self.showUpdateCompletedMessage() else: self.activityTimer.stop() self.activityslider.setValue(0) error = _("Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s.") % (getMachineBrand(), getMachineName(), getMachineBrand(), getMachineName()) if self.packages == 0: if self.error != 0: error = _("Problem retrieving update list.\nIf this issue persists please check/report on forum") else: error = _("A background update check is in progress,\nplease wait a few minutes and try again.") if self.updating: error = _("Update failed. Your %s %s does not have a working internet connection.") % (getMachineBrand(), getMachineName()) self.status.setText(_("Error") + " - " + error) self["actions"].setEnabled(True) elif event == IpkgComponent.EVENT_LISTITEM: if 'enigma2-plugin-settings-' in param[0] and self.channellist_only > 0: self.channellist_name = param[0] self.channellist_only = 2 #print( event, "-", param) pass
def restartGUI(self, ret=None): self.session.open(Console, title=_("Your %s %s will Restart...") % (getMachineBrand(), getMachineName()), cmdlist=["killall -9 enigma2"])
def getHeader(): imageversion = about.getImageVersionString() ret = 'EGAMI ' + imageversion + ' - ' ret += '%s %s\n' % (getMachineBrand(), getMachineName()) return ret
def getTranslation(self, text): return _(text).replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
def getFeedsErrorMessage(self): global error #feedstatus = feedsstatuscheck.getFeedsBool() # This is forcing an additional HTTP request so don't do it. Also the output was incorrect so the messages didn't show, just an empty MessageBox. if self.feedstatus == -2: return _("Your %s %s has no internet access, please check your network settings and make sure you have network cable connected and try again.") % (getMachineBrand(), getMachineName()) elif self.feedstatus == -3: return _("Your %s %s has no network access, please check your network settings and make sure you have network cable connected and try again.") % (getMachineBrand(), getMachineName()) elif self.feedstatus == 404: return _("Your %s %s is not able to connect to the feeds, please try again later. If this persists please report on the OpenViX forum at world-of-satellite.com.") % (getMachineBrand(), getMachineName()) elif self.feedstatus in ('updating', 403): return _("Sorry feeds are down for maintenance, please try again later. If this issue persists please check openvix.co.uk or world-of-satellite.com.") elif error:
def titleEditDone(self, cutlist): t = self.current_edit_title t.titleEditDone(cutlist) if t.VideoType != 0: self.session.openWithCallback(self.DVDformatCB, MessageBox, text=_("The DVD standard doesn't support H.264 (HDTV) video streams. Do you want to create a %s %s format data DVD (which will not play in stand-alone DVD players) instead?") % (getMachineBrand(), getMachineName()), type=MessageBox.TYPE_YESNO) else: self.updateTitleList()
def __init__(self, session, retvalue=1, timeout=-1, default_yes=True): self.retval = retvalue self.ptsmainloopvalue = retvalue recordings = session.nav.getRecordings( False, Components.RecordingConfig.recType( config.recording.warn_box_restart_rec_types.getValue())) jobs = len(job_manager.getPendingJobs()) inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus( Screens.InfoBar.InfoBar.instance) self.connected = False reason = "" next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() # if jobs: # reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n' # if jobs == 1: # job = job_manager.getPendingJobs()[0] # if job.name == "VFD Checker": # reason = "" # else: # reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))) # else: # reason += (_("%d jobs are running in the background!") % jobs) + '\n' if inTimeshift: reason = _("You seem to be in timeshift!") + '\n' default_yes = True timeout = 30 if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): default_yes = False reason = _( "Recording(s) are in progress or coming up in few seconds!" ) + '\n' if reason and inStandby: session.nav.record_event.append(self.getRecordEvent) self.skinName = "" elif reason and not inStandby: text = { 1: _("Really shutdown now?"), 2: _("Really reboot now?"), 3: _("Really restart now?"), 4: _("Really upgrade the frontprocessor and reboot now?"), 42: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), 43: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), 44: _("Really upgrade the front panel and reboot now?"), 45: _("Really WOL now?") }.get(retvalue) if text: MessageBox.__init__(self, session, reason + text, type=MessageBox.TYPE_YESNO, timeout=timeout, default=default_yes) self.skinName = "MessageBoxSimple" session.nav.record_event.append(self.getRecordEvent) self.connected = True self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) return self.skin = """<screen position="1310,0" size="0,0"/>""" Screen.__init__(self, session) self.close(True)
from Components.ActionMap import ActionMap from Components.config import config from Components.AVSwitch import AVSwitch from Components.Console import Console from Components.ImportChannels import ImportChannels from Components.Harddisk import internalHDDNotSleeping from Components.SystemInfo import SystemInfo from GlobalActions import globalActionMap from enigma import eDVBVolumecontrol, eTimer, eDVBLocalTimeHandler, eServiceReference import Screens.InfoBar from boxbranding import getMachineBrand, getMachineName, getBoxType from Tools.HardwareInfo import HardwareInfo inStandby = None MACHINEBRAND = getMachineBrand() MACHINENAME = getMachineName() BOXTYPE = getBoxType() def setLCDModeMinitTV(value): try: f = open("/proc/stb/lcd/mode", "w") f.write(value) f.close() except: pass class Standby2(Screen): def Power(self): print "[Standby] leave standby" if os.path.exists("/usr/script/Standby.sh"):
def __init__(self, session, args = 0): Screen.__init__(self, session) self.session = session self.selection = 0 self.MODEL = getBoxType() self.OEM = getBrandOEM() self.MACHINEBUILD = getMachineBuild() self.MACHINENAME = getMachineName() self.MACHINEBRAND = getMachineBrand() self.IMAGEFOLDER = getImageFolder() self.UBINIZE_ARGS = getMachineUBINIZE() self.MKUBIFS_ARGS = getMachineMKUBIFS() self.MTDKERNEL = getMachineMtdKernel() self.MTDROOTFS = getMachineMtdRoot() self.ROOTFSBIN = getMachineRootFile() self.KERNELBIN = getMachineKernelFile() self.ROOTFSTYPE = getImageFileSystem() if self.MACHINEBUILD in ("hd51","vs1500","h7"): self.MTDBOOT = "mmcblk0p1" self.EMMCIMG = "disk.img" elif self.MACHINEBUILD in ("xc7439"): self.MTDBOOT = "mmcblk1p1" self.EMMCIMG = "emmc.img" else: self.MTDBOOT = "none" self.EMMCIMG = "none" print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM print "[FULL BACKUP] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER print "[FULL BACKUP] UBINIZE = >%s<" %self.UBINIZE_ARGS print "[FULL BACKUP] MKUBIFS = >%s<" %self.MKUBIFS_ARGS print "[FULL BACKUP] MTDBOOT = >%s<" %self.MTDBOOT print "[FULL BACKUP] MTDKERNEL = >%s<" %self.MTDKERNEL print "[FULL BACKUP] MTDROOTFS = >%s<" %self.MTDROOTFS print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE print "[FULL BACKUP] EMMCIMG = >%s<" %self.EMMCIMG self.list = self.list_files("/boot") self["key_green"] = StaticText("USB") self["key_red"] = StaticText("HDD") self["key_blue"] = StaticText(_("Exit")) if SystemInfo["HaveMultiBoot"]: self["key_yellow"] = StaticText(_("STARTUP")) self["info-multi"] = Label(_("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install.")) else: self["key_yellow"] = StaticText("") self["info-multi"] = Label(" ") self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB.")) self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic.")) self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "blue": self.quit, "yellow": self.yellow, "green": self.green, "red": self.red, "cancel": self.quit, }, -2)
def getInfo(session=None, need_fullinfo=False): # TODO: get webif versione somewhere! info = {} global STATICBOXINFO if not (STATICBOXINFO is None or need_fullinfo): return STATICBOXINFO info['brand'] = getMachineBrand() info['model'] = getMachineName() info['boxtype'] = getBoxType() info['machinebuild'] = getMachineBuild() try: info['lcd'] = getLcd() except: # temporary due OE-A info['lcd'] = 0 try: info['grabpip'] = getGrabPip() except: # temporary due OE-A info['grabpip'] = 0 chipset = "unknown" if fileExists("/etc/.box"): f = open("/etc/.box", 'r') model = f.readline().strip().lower() f.close() if model.startswith("ufs") or model.startswith("ufc"): if model in ("ufs910", "ufs922", "ufc960"): chipset = "SH4 @266MHz" else: chipset = "SH4 @450MHz" elif model in ("topf", "tf7700hdpvr"): chipset = "SH4 @266MHz" elif model.startswith("azbox"): f = open("/proc/stb/info/model", 'r') model = f.readline().strip().lower() f.close() if model == "me": chipset = "SIGMA 8655" elif model == "minime": chipset = "SIGMA 8653" else: chipset = "SIGMA 8634" elif model.startswith("spark"): if model == "spark7162": chipset = "SH4 @540MHz" else: chipset = "SH4 @450MHz" elif fileExists("/proc/stb/info/azmodel"): f = open("/proc/stb/info/model", 'r') model = f.readline().strip().lower() f.close() if model == "me": chipset = "SIGMA 8655" elif model == "minime": chipset = "SIGMA 8653" else: chipset = "SIGMA 8634" elif fileExists("/proc/stb/info/model"): f = open("/proc/stb/info/model", 'r') model = f.readline().strip().lower() f.close() if model == "tf7700hdpvr": chipset = "SH4 @266MHz" elif model == "nbox": chipset = "STi7100 @266MHz" elif model == "arivalink200": chipset = "STi7109 @266MHz" elif model in ("adb2850", "adb2849", "dsi87"): chipset = "STi7111 @450MHz" elif model in ("sagemcom88", "esi88"): chipset = "STi7105 @450MHz" elif model.startswith("spark"): if model == "spark7162": chipset = "STi7162 @540MHz" else: chipset = "STi7111 @450MHz" elif model == "dm800": chipset = "bcm7401" elif model == "dm800se": chipset = "bcm7405" elif model == "dm500hd": chipset = "bcm7405" elif model == "dm7020hd": chipset = "bcm7405" elif model == "dm8000": chipset = "bcm7400" elif model == "dm820": chipset = "bcm7435" elif model == "dm7080": chipset = "bcm7435" elif model == "dm520": chipset = "bcm73625" elif model == "dm525": chipset = "bcm73625" elif model == "dm900": chipset = "bcm7252S" elif model == "dm920": chipset = "bcm7252S" if fileExists("/proc/stb/info/chipset"): f = open("/proc/stb/info/chipset", 'r') chipset = f.readline().strip() f.close() info['chipset'] = chipset memFree = 0 for line in open("/proc/meminfo", 'r'): parts = line.split(':') key = parts[0].strip() if key == "MemTotal": info['mem1'] = parts[1].strip().replace("kB", _("kB")) elif key in ("MemFree", "Buffers", "Cached"): memFree += int(parts[1].strip().split(' ', 1)[0]) info['mem2'] = "%s %s" % (memFree, _("kB")) info['mem3'] = _("%s free / %s total") % (info['mem2'], info['mem1']) try: f = open("/proc/uptime", "rb") uptime = int(float(f.readline().split(' ', 2)[0].strip())) f.close() uptimetext = '' if uptime > 86400: d = uptime / 86400 uptime = uptime % 86400 uptimetext += '%dd ' % d uptimetext += "%d:%.2d" % (uptime / 3600, (uptime % 3600) / 60) except: # noqa: E722 uptimetext = "?" info['uptime'] = uptimetext info["webifver"] = OPENWEBIFVER info['imagedistro'] = getImageDistro() info['friendlyimagedistro'] = getFriendlyImageDistro() info['oever'] = getOEVersion() info['imagever'] = getImageVersion() ib = getImageBuild() if ib: info['imagever'] = info['imagever'] + "." + ib info['enigmaver'] = getEnigmaVersionString() info['driverdate'] = getDriverDate() info['kernelver'] = about.getKernelVersionString() try: from Tools.StbHardware import getFPVersion except ImportError: from Tools.DreamboxHardware import getFPVersion try: info['fp_version'] = getFPVersion() except: # noqa: E722 info['fp_version'] = None friendlychipsetdescription = _("Chipset") friendlychipsettext = info['chipset'].replace("bcm", "Broadcom ") if friendlychipsettext in ("7335", "7356", "7362", "73625", "7424", "7425", "7429"): friendlychipsettext = "Broadcom " + friendlychipsettext if not (info['fp_version'] is None or info['fp_version'] == 0): friendlychipsetdescription = friendlychipsetdescription + " (" + _( "Frontprocessor Version") + ")" friendlychipsettext = friendlychipsettext + " (" + str( info['fp_version']) + ")" info['friendlychipsetdescription'] = friendlychipsetdescription info['friendlychipsettext'] = friendlychipsettext info['tuners'] = [] for i in range(0, nimmanager.getSlotCount()): print "[OpenWebif] -D- tuner '%d' '%s' '%s'" % ( i, nimmanager.getNimName(i), nimmanager.getNim(i).getSlotName()) info['tuners'].append({ "name": nimmanager.getNim(i).getSlotName(), "type": nimmanager.getNimName(i) + " (" + nimmanager.getNim(i).getFriendlyType() + ")", "rec": "", "live": "" }) info['ifaces'] = [] ifaces = iNetwork.getConfiguredAdapters() for iface in ifaces: info['ifaces'].append({ "name": iNetwork.getAdapterName(iface), "friendlynic": getFriendlyNICChipSet(iface), "linkspeed": getLinkSpeed(iface), "mac": iNetwork.getAdapterAttribute(iface, "mac"), "dhcp": iNetwork.getAdapterAttribute(iface, "dhcp"), "ipv4method": getIPv4Method(iface), "ip": formatIp(iNetwork.getAdapterAttribute(iface, "ip")), "mask": formatIp(iNetwork.getAdapterAttribute(iface, "netmask")), "v4prefix": sum([ bin(int(x)).count('1') for x in formatIp( iNetwork.getAdapterAttribute(iface, "netmask")).split('.') ]), "gw": formatIp(iNetwork.getAdapterAttribute(iface, "gateway")), "ipv6": getAdapterIPv6(iface)['addr'], "ipmethod": getIPMethod(iface), "firstpublic": getAdapterIPv6(iface)['firstpublic'] }) info['hdd'] = [] for hdd in harddiskmanager.hdd: dev = hdd.findMount() if dev: stat = os.statvfs(dev) free = stat.f_bavail * stat.f_frsize / 1048576. else: free = -1 if free <= 1024: free = "%i %s" % (free, _("MB")) else: free = free / 1024. free = "%.1f %s" % (free, _("GB")) size = hdd.diskSize() * 1000000 / 1048576. if size > 1048576: size = "%.1f %s" % ((size / 1048576.), _("TB")) elif size > 1024: size = "%.1f %s" % ((size / 1024.), _("GB")) else: size = "%d %s" % (size, _("MB")) iecsize = hdd.diskSize() # Harddisks > 1000 decimal Gigabytes are labelled in TB if iecsize > 1000000: iecsize = (iecsize + 50000) // float(100000) / 10 # Omit decimal fraction if it is 0 if (iecsize % 1 > 0): iecsize = "%.1f %s" % (iecsize, _("TB")) else: iecsize = "%d %s" % (iecsize, _("TB")) # Round harddisk sizes beyond ~300GB to full tens: 320, 500, 640, 750GB elif iecsize > 300000: iecsize = "%d %s" % (((iecsize + 5000) // 10000 * 10), _("GB")) # ... be more precise for media < ~300GB (Sticks, SSDs, CF, MMC, ...): 1, 2, 4, 8, 16 ... 256GB elif iecsize > 1000: iecsize = "%d %s" % (((iecsize + 500) // 1000), _("GB")) else: iecsize = "%d %s" % (iecsize, _("MB")) info['hdd'].append({ "model": hdd.model(), "capacity": size, "labelled_capacity": iecsize, "free": free, "mount": dev, "friendlycapacity": _("%s free / %s total") % (free, size + ' ("' + iecsize + '")') }) info['shares'] = [] autofiles = ('/etc/auto.network', '/etc/auto.network_vti') for autofs in autofiles: if fileExists(autofs): method = "autofs" for line in file(autofs).readlines(): if not line.startswith('#'): # Replace escaped spaces that can appear inside credentials with underscores # Not elegant but we wouldn't want to expose credentials on the OWIF anyways tmpline = line.replace("\ ", "_") tmp = tmpline.split() if not len(tmp) == 3: continue name = tmp[0].strip() type = "unknown" if "cifs" in tmp[1]: # Linux still defaults to SMBv1 type = "SMBv1.0" settings = tmp[1].split(",") for setting in settings: if setting.startswith("vers="): type = setting.replace("vers=", "SMBv") elif "nfs" in tmp[1]: type = "NFS" # Default is r/w mode = _("r/w") settings = tmp[1].split(",") for setting in settings: if setting == "ro": mode = _("r/o") uri = tmp[2] parts = [] parts = tmp[2].split(':') if parts[0] is "": server = uri.split('/')[2] uri = uri.strip()[1:] else: server = parts[0] ipaddress = None if server: # Will fail on literal IPs try: # Try IPv6 first, as will Linux if has_ipv6: tmpaddress = None tmpaddress = getaddrinfo(server, 0, AF_INET6) if tmpaddress: ipaddress = "[" + list( tmpaddress)[0][4][0] + "]" # Use IPv4 if IPv6 fails or is not present if ipaddress is None: tmpaddress = None tmpaddress = getaddrinfo(server, 0, AF_INET) if tmpaddress: ipaddress = list(tmpaddress)[0][4][0] except: # noqa: E722 pass friendlyaddress = server if ipaddress is not None and not ipaddress == server: friendlyaddress = server + " (" + ipaddress + ")" info['shares'].append({ "name": name, "method": method, "type": type, "mode": mode, "path": uri, "host": server, "ipaddress": ipaddress, "friendlyaddress": friendlyaddress }) # TODO: fstab info['transcoding'] = TRANSCODING info['EX'] = '' if session: try: # gets all current stream clients for images using eStreamServer # TODO: merge eStreamServer and streamList # TODO: get tuner info for streams # TODO: get recoding/timer info if more than one info['streams'] = [] try: streams = [] from enigma import eStreamServer streamServer = eStreamServer.getInstance() if streamServer is not None: for x in streamServer.getConnectedClients(): servicename = ServiceReference( x[1]).getServiceName() or "(unknown service)" if int(x[2]) == 0: strtype = "S" else: strtype = "T" info['streams'].append({ "ref": x[1], "name": servicename, "ip": x[0], "type": strtype }) except Exception, error: print "[OpenWebif] -D- no eStreamServer %s" % error recs = NavigationInstance.instance.getRecordings() if recs: # only one stream and only TV from Plugins.Extensions.OpenWebif.controllers.stream import streamList s_name = '' # s_cip = '' print "[OpenWebif] -D- streamList count '%d'" % len(streamList) if len(streamList) == 1: from Screens.ChannelSelection import service_types_tv # from enigma import eEPGCache # epgcache = eEPGCache.getInstance() serviceHandler = eServiceCenter.getInstance() services = serviceHandler.list( eServiceReference('%s ORDER BY name' % (service_types_tv))) channels = services and services.getContent("SN", True) s = streamList[0] srefs = s.ref.toString() for channel in channels: if srefs == channel[0]: s_name = channel[1] + ' (' + s.clientIP + ')' break print "[OpenWebif] -D- s_name '%s'" % s_name # only for debug for stream in streamList: srefs = stream.ref.toString() print "[OpenWebif] -D- srefs '%s'" % srefs sname = '' timers = [] for timer in NavigationInstance.instance.RecordTimer.timer_list: if timer.isRunning() and not timer.justplay: timers.append( timer.service_ref.getServiceName().replace( '\xc2\x86', '').replace('\xc2\x87', '')) print "[OpenWebif] -D- timer '%s'" % timer.service_ref.getServiceName( ) # TODO: more than one recording if len(timers) == 1: sname = timers[0] if sname == '' and s_name != '': sname = s_name print "[OpenWebif] -D- recs count '%d'" % len(recs) for rec in recs: feinfo = rec.frontendInfo() frontendData = feinfo and feinfo.getAll(True) if frontendData is not None: cur_info = feinfo.getTransponderData(True) if cur_info: nr = frontendData['tuner_number'] info['tuners'][nr]['rec'] = getOrbitalText( cur_info) + ' / ' + sname service = session.nav.getCurrentService() if service is not None: sname = service.info().getName() feinfo = service.frontendInfo() frontendData = feinfo and feinfo.getAll(True) if frontendData is not None: cur_info = feinfo.getTransponderData(True) if cur_info: nr = frontendData['tuner_number'] info['tuners'][nr]['live'] = getOrbitalText( cur_info) + ' / ' + sname except Exception, error: info['EX'] = error
def postFlashActionCallback(self, answer): restoreSettings = False restoreAllPlugins = False restoreSettingsnoPlugin = False if answer is not None: if answer[1] != "abort" and not self.recordcheck: self.recordcheck = True rec = self.session.nav.RecordTimer.isRecording() next_rec_time = self.session.nav.RecordTimer.getNextRecordingTime( ) if rec or (next_rec_time > 0 and (next_rec_time - time.time()) < 360): self.answer = answer self.session.openWithCallback( self.recordWarning, MessageBox, _("Recording(s) are in progress or coming up in few seconds!" ) + '\n' + _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), default=False) return if answer[1] == "restoresettings": restoreSettings = True if answer[1] == "restoresettingsnoplugin": restoreSettings = True restoreSettingsnoPlugin = True if answer[1] == "restoresettingsandallplugins": restoreSettings = True restoreAllPlugins = True if restoreSettings: self.SaveEPG() if answer[1] != "abort": if restoreSettings: try: if not os.path.exists('/media/hdd/images/config'): os.makedirs('/media/hdd/images/config') open('/media/hdd/images/config/settings', 'w').close() except: print "[FlashOnline] postFlashActionCallback: failed to create /media/hdd/images/config/settings" else: if os.path.exists('/media/hdd/images/config/settings'): os.unlink('/media/hdd/images/config/settings') if restoreAllPlugins: try: if not os.path.exists('/media/hdd/images/config'): os.makedirs('/media/hdd/images/config') open('/media/hdd/images/config/plugins', 'w').close() except: print "[FlashOnline] postFlashActionCallback: failed to create /media/hdd/images/config/plugins" else: if os.path.exists('/media/hdd/images/config/plugins'): os.unlink('/media/hdd/images/config/plugins') if restoreSettingsnoPlugin: try: if not os.path.exists('/media/hdd/images/config'): os.makedirs('/media/hdd/images/config') open('/media/hdd/images/config/noplugins', 'w').close() except: print "[FlashOnline] postFlashActionCallback: failed to create /media/hdd/images/config/noplugins" else: if os.path.exists('/media/hdd/images/config/noplugins'): os.unlink('/media/hdd/images/config/noplugins') if restoreSettings or restoreAllPlugins or restoreSettingsnoPlugin: if config.plugins.softwaremanager.restoremode.value is not None: try: if not os.path.exists('/media/hdd/images/config'): os.makedirs('/media/hdd/images/config') if config.plugins.softwaremanager.restoremode.value == "slow": if not os.path.exists( '/media/hdd/images/config/slow'): open('/media/hdd/images/config/slow', 'w').close() if os.path.exists( '/media/hdd/images/config/fast'): os.unlink('/media/hdd/images/config/fast') if os.path.exists( '/media/hdd/images/config/turbo'): os.unlink('/media/hdd/images/config/turbo') elif config.plugins.softwaremanager.restoremode.value == "fast": if not os.path.exists( '/media/hdd/images/config/fast'): open('/media/hdd/images/config/fast', 'w').close() if os.path.exists( '/media/hdd/images/config/slow'): os.unlink('/media/hdd/images/config/slow') if os.path.exists( '/media/hdd/images/config/turbo'): os.unlink('/media/hdd/images/config/turbo') elif config.plugins.softwaremanager.restoremode.value == "turbo": if not os.path.exists( '/media/hdd/images/config/turbo'): open('/media/hdd/images/config/turbo', 'w').close() if os.path.exists( '/media/hdd/images/config/slow'): os.unlink('/media/hdd/images/config/slow') if os.path.exists( '/media/hdd/images/config/fast'): os.unlink('/media/hdd/images/config/fast') except: print "[FlashOnline] postFlashActionCallback: failed to create restore mode flagfile" self.startDownload() else: self.abort() else: self.abort()
def __init__(self, session, retvalue=QUIT_SHUTDOWN, timeout=-1, default_yes=True): self.retval = retvalue self.ptsmainloopvalue = retvalue recordings = session.nav.getRecordings( False, Components.RecordingConfig.recType( config.recording.warn_box_restart_rec_types.getValue())) jobs = len(job_manager.getPendingJobs()) inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus( Screens.InfoBar.InfoBar.instance) self.connected = False reason = "" next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() # if jobs: # reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n' # if jobs == 1: # job = job_manager.getPendingJobs()[0] # if job.name == "VFD Checker": # reason = "" # else: # reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end))) # else: # reason += (_("%d jobs are running in the background!") % jobs) + '\n' if inTimeshift: reason = _("You seem to be in timeshift!") + '\n' default_yes = True timeout = 30 elif recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): reason = _( "Recording(s) are in progress or coming up in few seconds!" ) + '\n' default_yes = False timeout = 30 elif eStreamServer.getInstance().getConnectedClients( ) or StreamServiceList: reason = _("Client is streaming from this box!") default_yes = False timeout = 30 elif mediaFilesInUse(session) and retvalue in ( QUIT_SHUTDOWN, QUIT_REBOOT, QUIT_UPGRADE_FP, QUIT_UPGRADE_PROGRAM, QUIT_UPGRADE_FRONTPANEL): reason = _("A file from media is in use!") default_yes = False timeout = 30 if reason and inStandby: session.nav.record_event.append(self.getRecordEvent) self.skinName = "" elif reason and not inStandby: text = { QUIT_SHUTDOWN: _("Really shutdown now?"), QUIT_REBOOT: _("Really reboot now?"), QUIT_RESTART: _("Really restart now?"), QUIT_UPGRADE_FP: _("Really upgrade the frontprocessor and reboot now?"), QUIT_MAINT: _("Really reboot into Recovery Mode?"), QUIT_UPGRADE_PROGRAM: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), QUIT_IMAGE_RESTORE: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), QUIT_UPGRADE_FRONTPANEL: _("Really upgrade the front panel and reboot now?"), QUIT_WOLSHUTDOWN: _("Really WOL now?") }.get(retvalue) if text: MessageBox.__init__(self, session, reason + text, type=MessageBox.TYPE_YESNO, timeout=timeout, default=default_yes) self.skinName = "MessageBoxSimple" session.nav.record_event.append(self.getRecordEvent) self.connected = True self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) return self.skin = """<screen position="1310,0" size="0,0"/>""" Screen.__init__(self, session) self.close(True)
def restartGUI(self, ret=None): self.session.open(Console, title=_("Your %s %s will Reboot...") % (getMachineBrand(), getMachineName()), cmdlist=["init 4;reboot"])
def populate(self): self["lab1"] = StaticText(_("Virtuosso Image Xtreme")) self["lab2"] = StaticText(_("By Team ViX")) model = None AboutText = "" self["lab3"] = StaticText( _("Support at") + " www.world-of-satellite.com") AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName()) if about.getChipSetString() != _("unavailable"): if about.getIsBroadcom(): AboutText += _( "Chipset:\tBCM%s\n") % about.getChipSetString().upper() else: AboutText += _( "Chipset:\t%s\n") % about.getChipSetString().upper() AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(), about.getCPUSpeedString(), about.getCpuCoresString()) imageSubBuild = "" if getImageType() != 'release': imageSubBuild = ".%s" % getImageDevBuild() AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion( ), getImageBuild(), imageSubBuild, getImageType().title()) skinWidth = getDesktop(0).size().width() skinHeight = getDesktop(0).size().height() string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers:\t%s\n") % driversdate AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString() AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString( ).replace("GStreamer ", "") AboutText += _("Python:\t%s\n") % about.getPythonVersionString() AboutText += _("Installed:\t%s\n") % about.getFlashDateString() AboutText += _("Last update:\t%s\n") % getEnigmaVersionString() AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _( " (%s x %s)") % (skinWidth, skinHeight) + "\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value'): f = open('/proc/stb/sensors/temp0/value', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/fp/temp_sensor'): f = open('/proc/stb/fp/temp_sensor', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/sensors/temp/value'): f = open('/proc/stb/sensors/temp/value', 'r') tempinfo = f.read() f.close() # if tempinfo and int(tempinfo.replace('\n', '')) > 0: # mark = str('\xc2\xb0') # AboutText += _("System temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" tempinfo = "" if path.exists('/proc/stb/fp/temp_sensor_avs'): f = open('/proc/stb/fp/temp_sensor_avs', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): try: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() except: tempinfo = "" if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("Processor temp:\t%s") % tempinfo.replace( '\n', '').replace(' ', '') + mark + "C\n" AboutLcdText = AboutText.replace('\t', ' ') fp_version = getFPVersion() if fp_version is None: fp_version = "" elif fp_version != 0: fp_version = _("FP version:\t%s") % fp_version AboutText += fp_version + "\n" bootloader = "" if path.exists('/sys/firmware/devicetree/base/bolt/tag'): f = open('/sys/firmware/devicetree/base/bolt/tag', 'r') bootloader = f.readline().replace('\x00', '').replace('\n', '') f.close() AboutText += _("Bootloader:\t%s\n") % (bootloader) self["AboutScrollLabel"] = ScrollLabel(AboutText)
def __init__(self, session, retvalue=1, timeout=-1, default_yes=True): self.retval = retvalue self.ptsmainloopvalue = retvalue recordings = session.nav.getRecordings() jobs = [] for job in job_manager.getPendingJobs(): if job.name != dgettext('vix', 'SoftcamCheck'): jobs.append(job) inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus( Screens.InfoBar.InfoBar.instance) self.connected = False reason = "" next_rec_time = -1 if not recordings: next_rec_time = session.nav.RecordTimer.getNextRecordingTime() if config.usage.task_warning.value and len(jobs): reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", len(jobs)) % len(jobs)) + '\n' if len(jobs) == 1: job = jobs[0] reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100 * job.progress / float(job.end))) else: reason += (_("%d jobs are running in the background!") % len(jobs)) + '\n' if inTimeshift: reason = _("You seem to be in timeshift!") + '\n' if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360): default_yes = False reason = _( "Recording(s) are in progress or coming up in few seconds!" ) + '\n' if reason and inStandby: session.nav.record_event.append(self.getRecordEvent) self.skinName = "" elif reason and not inStandby: text = { 1: _("Really shutdown now?"), 2: _("Really reboot now?"), 3: _("Really restart now?"), 4: _("Really upgrade the frontprocessor and reboot now?"), 42: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()), 43: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()) }.get(retvalue) if text: MessageBox.__init__(self, session, reason + text, type=MessageBox.TYPE_YESNO, timeout=timeout, default=default_yes) self.skinName = "MessageBoxSimple" session.nav.record_event.append(self.getRecordEvent) self.connected = True self.onShow.append(self.__onShow) self.onHide.append(self.__onHide) return self.skin = """<screen position="1310,0" size="0,0"/>""" Screen.__init__(self, session) self.close(True)
def getInfo(): # TODO: get webif versione somewhere! info = {} info['brand'] = getMachineBrand() info['model'] = getMachineName() info['boxtype'] = getBoxType() info['machinebuild'] = getMachineBuild() chipset = "unknown" if fileExists("/etc/.box"): f = open("/etc/.box", 'r') model = f.readline().strip().lower() f.close() if model.startswith("ufs") or model.startswith("ufc"): if model in ("ufs910", "ufs922", "ufc960"): chipset = "SH4 @266MHz" else: chipset = "SH4 @450MHz" elif model in ("topf", "tf7700hdpvr"): chipset = "SH4 @266MHz" elif model.startswith("azbox"): f = open("/proc/stb/info/model", 'r') model = f.readline().strip().lower() f.close() if model == "me": chipset = "SIGMA 8655" elif model == "minime": chipset = "SIGMA 8653" else: chipset = "SIGMA 8634" elif model.startswith("spark"): if model == "spark7162": chipset = "SH4 @540MHz" else: chipset = "SH4 @450MHz" elif fileExists("/proc/stb/info/azmodel"): f = open("/proc/stb/info/model", 'r') model = f.readline().strip().lower() f.close() if model == "me": chipset = "SIGMA 8655" elif model == "minime": chipset = "SIGMA 8653" else: chipset = "SIGMA 8634" elif fileExists("/proc/stb/info/model"): f = open("/proc/stb/info/model", 'r') model = f.readline().strip().lower() f.close() if model == "tf7700hdpvr": chipset = "SH4 @266MHz" elif model == "nbox": chipset = "STi7100 @266MHz" elif model == "arivalink200": chipset = "STi7109 @266MHz" elif model in ("adb2850", "adb2849", "dsi87"): chipset = "STi7111 @450MHz" elif model in ("sagemcom88", "esi88"): chipset = "STi7105 @450MHz" elif model.startswith("spark"): if model == "spark7162": chipset = "STi7162 @540MHz" else: chipset = "STi7111 @450MHz" if fileExists("/proc/stb/info/chipset"): f = open("/proc/stb/info/chipset", 'r') chipset = f.readline().strip() f.close() info['chipset'] = chipset memFree = 0 for line in open("/proc/meminfo", 'r'): parts = line.split(':') key = parts[0].strip() if key == "MemTotal": info['mem1'] = parts[1].strip() elif key in ("MemFree", "Buffers", "Cached"): memFree += int(parts[1].strip().split(' ', 1)[0]) info['mem2'] = "%s kB" % memFree try: f = open("/proc/uptime", "rb") uptime = int(float(f.readline().split(' ', 2)[0].strip())) f.close() uptimetext = '' if uptime > 86400: d = uptime / 86400 uptime = uptime % 86400 uptimetext += '%dd ' % d uptimetext += "%d:%.2d" % (uptime / 3600, (uptime % 3600) / 60) except: uptimetext = "?" info['uptime'] = uptimetext info["webifver"] = getOpenWebifVer() info['imagedistro'] = getImageDistro() info['oever'] = getOEVersion() info['imagever'] = getImageVersion() + '.' + getImageBuild() info['enigmaver'] = getEnigmaVersionString() info['driverdate'] = getDriverDate() info['kernelver'] = about.getKernelVersionString() try: from Tools.StbHardware import getFPVersion except ImportError: from Tools.DreamboxHardware import getFPVersion info['fp_version'] = getFPVersion() info['tuners'] = [] for i in range(0, nimmanager.getSlotCount()): info['tuners'].append({ "name": nimmanager.getNim(i).getSlotName(), "type": nimmanager.getNimName(i) + " (" + nimmanager.getNim(i).getFriendlyType() + ")" }) info['ifaces'] = [] ifaces = iNetwork.getConfiguredAdapters() for iface in ifaces: info['ifaces'].append({ "name": iNetwork.getAdapterName(iface), "mac": iNetwork.getAdapterAttribute(iface, "mac"), "dhcp": iNetwork.getAdapterAttribute(iface, "dhcp"), "ip": formatIp(iNetwork.getAdapterAttribute(iface, "ip")), "mask": formatIp(iNetwork.getAdapterAttribute(iface, "netmask")), "v4prefix": sum([ bin(int(x)).count('1') for x in formatIp( iNetwork.getAdapterAttribute(iface, "netmask")).split('.') ]), "gw": formatIp(iNetwork.getAdapterAttribute(iface, "gateway")), "ipv6": getAdapterIPv6(iface)['addr'], "firstpublic": getAdapterIPv6(iface)['firstpublic'] }) info['hdd'] = [] for hdd in harddiskmanager.hdd: dev = hdd.findMount() if dev: stat = os.statvfs(dev) free = int((stat.f_bfree / 1024) * (stat.f_bsize / 1024)) else: free = -1 if free <= 1024: free = "%i MB" % free else: free = free / 1024. free = "%.3f GB" % free size = hdd.diskSize() * 1000000 / 1048576. if size > 1048576: size = "%.2f TB" % (size / 1048576.) elif size > 1024: size = "%.1f GB" % (size / 1024.) else: size = "%d MB" % size iecsize = hdd.diskSize() # Harddisks > 1000 decimal Gigabytes are labelled in TB if iecsize > 1000000: iecsize = (iecsize + 50000) // float(100000) / 10 # Omit decimal fraction if it is 0 if (iecsize % 1 > 0): iecsize = "%.1f TB" % iecsize else: iecsize = "%d TB" % iecsize # Round harddisk sizes beyond ~300GB to full tens: 320, 500, 640, 750GB elif iecsize > 300000: iecsize = "%d GB" % ((iecsize + 5000) // 10000 * 10) # ... be more precise for media < ~300GB (Sticks, SSDs, CF, MMC, ...): 1, 2, 4, 8, 16 ... 256GB elif iecsize > 1000: iecsize = "%d GB" % ((iecsize + 500) // 1000) else: iecsize = "%d MB" % iecsize info['hdd'].append({ "model": hdd.model(), "capacity": size, "labelled_capacity": iecsize, "free": free }) info['transcoding'] = False if (info['model'] in ("Solo4K", "Solo²", "Duo²", "Solo SE", "Quad", "Quad Plus") or info['machinebuild'] in ('inihdp', 'hd2400', 'et10000', 'xpeedlx3', 'ew7356', 'dags3', 'dags4')): if os.path.exists( eEnv.resolve( '${libdir}/enigma2/python/Plugins/SystemPlugins/TransCodingSetup/plugin.pyo' ) ) or os.path.exists( eEnv.resolve( '${libdir}/enigma2/python/Plugins/SystemPlugins/TranscodingSetup/plugin.pyo' ) ) or os.path.exists( eEnv.resolve( '${libdir}/enigma2/python/Plugins/SystemPlugins/MultiTransCodingSetup/plugin.pyo' )): info['transcoding'] = True info['kinopoisk'] = False lang = ['ru', 'uk', 'lv', 'lt', 'et'] for l in lang: if l in language.getLanguage(): info['kinopoisk'] = True global STATICBOXINFO STATICBOXINFO = info return info
def delay(self, val): message = _("Changes need a system restart to take effect.\nRestart your %s %s now?") % (getMachineBrand(), getMachineName()) ybox = self.session.openWithCallback(self.restartBox, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_("Restart %s %s.") % (getMachineBrand(), getMachineName()))
import boxbranding print "getMachineBuild=%s<" % boxbranding.getMachineBuild() print "getMachineMake=%s<" % boxbranding.getMachineMake() print "getMachineProcModel=%s<" % boxbranding.getMachineProcModel() print "getMachineBrand=%s<" % boxbranding.getMachineBrand() print "getMachineName=%s<" % boxbranding.getMachineName() print "getMachineMtdKernel=%s<" % boxbranding.getMachineMtdKernel() print "getMachineKernelFile=%s<" % boxbranding.getMachineKernelFile() print "getMachineMtdRoot=%s<" % boxbranding.getMachineMtdRoot() print "getMachineRootFile=%s<" % boxbranding.getMachineRootFile() print "getMachineMKUBIFS=%s<" % boxbranding.getMachineMKUBIFS() print "getMachineUBINIZE=%s<" % boxbranding.getMachineUBINIZE() print "getBoxType=%s<" % boxbranding.getBoxType() print "getBrandOEM=%s<" % boxbranding.getBrandOEM() print "getOEVersion=%s<" % boxbranding.getOEVersion() print "getDriverDate=%s<" % boxbranding.getDriverDate() print "getImageVersion=%s<" % boxbranding.getImageVersion() print "getImageBuild=%s<" % boxbranding.getImageBuild() print "getImageDevBuild=%s<" % boxbranding.getImageDevBuild() print "getImageType=%s<" % boxbranding.getImageType() print "getImageDistro=%s<" % boxbranding.getImageDistro() print "getImageFolder=%s<" % boxbranding.getImageFolder() print "getImageFileSystem=%s<" % boxbranding.getImageFileSystem() print "getImageArch=%s<" % boxbranding.getImageArch()
def __init__(self, session): Screen.__init__(self, session) self.setTitle(_("About")) hddsplit = skin.parameters.get("AboutHddSplit", 0) AboutText = _("Model: %s %s") % (getMachineBrand(), getMachineName()) + "\n" AboutText += _("Image: ") + about.getImageTypeString() + "\n" AboutText += _( "Kernel version: ") + about.getKernelVersionString() + "\n" if path.exists('/proc/stb/info/chipset'): AboutText += _("Chipset: %s") % about.getChipSetString() + "\n" AboutText += _("CPU: %s") % about.getCPUString() + "\n" AboutText += _("Version: %s") % getImageVersion() + "\n" imagestarted = "" bootname = '' if path.exists('/boot/bootname'): f = open('/boot/bootname', 'r') bootname = f.readline().split('=')[1] f.close() if getMachineBuild() in ('cc1', 'sf8008'): if path.exists('/boot/STARTUP'): f = open('/boot/STARTUP', 'r') f.seek(5) image = f.read(4) if image == "emmc": image = "1" elif image == "usb0": f.seek(13) image = f.read(1) if image == "1": image = "2" elif image == "3": image = "3" elif image == "5": image = "4" elif image == "7": image = "5" f.close() if bootname: bootname = " (%s)" % bootname AboutText += _("Selected Image:\t%s" ) % "STARTUP_" + image + bootname + "\n" if path.exists('/boot/STARTUP'): f = open('/boot/STARTUP', 'r') f.seek(22) image = f.read(1) f.close() if bootname: bootname = " (%s)" % bootname AboutText += _( "Image started:\t%s") % "STARTUP_" + image + bootname + "\n" AboutText += _("Build: %s") % getImageBuild() + "\n" if path.exists('/proc/stb/info/release') and getBoxType() in ( 'et7000', 'et7500', 'et8500'): realdriverdate = open("/proc/stb/info/release", 'r') for line in realdriverdate: tmp = line.strip() AboutText += _("Drivers: %s") % tmp + "\n" realdriverdate.close() else: string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers: %s") % driversdate + "\n" EnigmaVersion = "Enigma: " + about.getEnigmaVersionString() self["EnigmaVersion"] = StaticText(EnigmaVersion) AboutText += EnigmaVersion + "\n" AboutText += _( "Enigma (re)starts: %d\n") % config.misc.startCounter.value GStreamerVersion = "GStreamer: " + about.getGStreamerVersionString( ).replace("GStreamer", "") self["GStreamerVersion"] = StaticText(GStreamerVersion) AboutText += GStreamerVersion + "\n" ImageVersion = _("Last upgrade: ") + about.getImageVersionString() self["ImageVersion"] = StaticText(ImageVersion) AboutText += ImageVersion + "\n" AboutText += _( "Python version: ") + about.getPythonVersionString() + "\n" + "\n" AboutText += _( "Enigma (re)starts: %d\n") % config.misc.startCounter.value fp_version = getFPVersion() if fp_version is None: fp_version = "" else: fp_version = _("Frontprocessor version: %s") % fp_version AboutText += fp_version + "\n" self["FPVersion"] = StaticText(fp_version) skinWidth = getDesktop(0).size().width() skinHeight = getDesktop(0).size().height() AboutText += _("Skin Name: %s") % config.skin.primary_skin.value[ 0:-9] + _(" (%s x %s)") % (skinWidth, skinHeight) + "\n" if path.exists('/etc/enigma2/EtRcType'): rfp = open('/etc/enigma2/EtRcType', "r") Remote = rfp.read() rfp.close AboutText += _("Remote control type") + _(": ") + Remote + "\n" else: AboutText += _("Remote control type") + _( ": ") + iRcTypeControl.getBoxType() + "\n" if path.exists('/proc/stb/ir/rc/type'): fp = open('/proc/stb/ir/rc/type', "r") RcID = fp.read() fp.close AboutText += _("Remote control ID") + _(": ") + RcID self["TunerHeader"] = StaticText(_("Detected NIMs:")) AboutText += "\n" + _("Detected NIMs:") + "\n" nims = nimmanager.nimListCompressed() for count in range(len(nims)): if count < 4: self["Tuner" + str(count)] = StaticText(nims[count]) else: self["Tuner" + str(count)] = StaticText("") AboutText += nims[count] + "\n" self["HDDHeader"] = StaticText(_("Detected HDD:")) AboutText += "\n" + _("Detected HDD:") + "\n" hddlist = harddiskmanager.HDDList() hddinfo = "" if hddlist: formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s\n(%s, %.1f %sB %s)" for count in range(len(hddlist)): if hddinfo: hddinfo += "\n" hdd = hddlist[count][1] if int(hdd.free()) > 1024: hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free() / 1024.0, "G", _("free")) else: hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free(), "M", _("free")) else: hddinfo = _("none") self["hddA"] = StaticText(hddinfo) AboutText += hddinfo + "\n\n" + _("Network Info:") for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\n" + x[0] + ": " + x[1] self["AboutScrollLabel"] = ScrollLabel(AboutText) self["key_green"] = Button(_("Troubleshoot")) self["key_red"] = Button(_("Latest Commits")) self["key_yellow"] = Button(_("Memory Info")) self["key_blue"] = Button(_("%s ") % getMachineName() + _("picture")) self["actions"] = ActionMap( [ "ColorActions", "SetupActions", "DirectionActions", "ChannelSelectEPGActions" ], { "cancel": self.close, "ok": self.close, "info": self.showTranslationInfo, "red": self.showCommits, "green": self.showTroubleshoot, "yellow": self.showMemoryInfo, "blue": self.showModelPic, "up": self["AboutScrollLabel"].pageUp, "down": self["AboutScrollLabel"].pageDown })
def populate(self): self["lab1"] = StaticText(_("Open Black Hole")) self["lab2"] = StaticText(_("From the BH Team")) model = None AboutText = "" self["lab3"] = StaticText(_("Support at %s") % "www.vuplus-community.net") AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName()) if about.getChipSetString() != _("unavailable"): if SystemInfo["HasHiSi"]: AboutText += _("Chipset:\tHiSilicon %s\n") % about.getChipSetString().upper() elif about.getIsBroadcom(): AboutText += _("Chipset:\tBroadcom %s\n") % about.getChipSetString().upper() else: AboutText += _("Chipset:\t%s\n") % about.getChipSetString().upper() AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(), about.getCPUSpeedString(), about.getCpuCoresString()) imageSubBuild = "" if getImageType() != 'release': imageSubBuild = ".%s" % getImageDevBuild() AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title()) if SystemInfo["canMultiBoot"]: image = GetCurrentImage() bootmode = "" part = "" if SystemInfo["canMode12"]: bootmode = "bootmode = %s" %GetCurrentImageMode() if SystemInfo["HasHiSi"]: if image != 0: part = "%s%s" %(SystemInfo["canMultiBoot"][2], image*2) image += 1 else: part = "MMC" image += 1 AboutText += _("Image Slot:\t%s") % "STARTUP_" + str(image) + " " + part + " " + bootmode + "\n" skinWidth = getDesktop(0).size().width() skinHeight = getDesktop(0).size().height() string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers:\t%s\n") % driversdate AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString() AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","") AboutText += _("Python:\t%s\n") % about.getPythonVersionString() AboutText += _("Installed:\t%s\n") % about.getFlashDateString() AboutText += _("Last update:\t%s\n") % getEnigmaVersionString() AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _(" (%s x %s)") % (skinWidth, skinHeight) + "\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value'): f = open('/proc/stb/sensors/temp0/value', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/fp/temp_sensor'): f = open('/proc/stb/fp/temp_sensor', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/sensors/temp/value'): f = open('/proc/stb/sensors/temp/value', 'r') tempinfo = f.read() f.close() if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("System temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" tempinfo = "" if path.exists('/proc/stb/fp/temp_sensor_avs'): f = open('/proc/stb/fp/temp_sensor_avs', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): try: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() except: tempinfo = "" elif path.exists('/proc/hisi/msp/pm_cpu'): try: for line in open('/proc/hisi/msp/pm_cpu').readlines(): line = [x.strip() for x in line.strip().split(":")] if line[0] in ("Tsensor"): temp = line[1].split("=") temp = line[1].split(" ") tempinfo = temp[2] except: tempinfo = "" if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("Processor temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" AboutLcdText = AboutText.replace('\t', ' ') fp_version = getFPVersion() if fp_version is None: fp_version = "" elif fp_version != 0: fp_version = _("FP version:\t%s") % fp_version AboutText += fp_version + "\n" bootloader = "" if path.exists('/sys/firmware/devicetree/base/bolt/tag'): f = open('/sys/firmware/devicetree/base/bolt/tag', 'r') bootloader = f.readline().replace('\x00', '').replace('\n', '') f.close() AboutText += _("Bootloader:\t%s\n") % (bootloader) self["AboutScrollLabel"] = ScrollLabel(AboutText)
def createSetup(self, widget): self.list = [] self.entryName = getConfigListEntry( _("Name"), self.timerentry_name, _("The name the recording will get.\nA manually entered name will override naming extracted from the EPG. Clear the name and move the selection away to return to updating the name from the EPG" )) self.list.append(self.entryName) self.entryDescription = getConfigListEntry( _("Description"), self.timerentry_description, _("The description of the recording.\nA manually entered description will override naming extracted from the EPG. Clear the description and move the selection away to return to updating the description from the EPG" )) self.list.append(self.entryDescription) self.timerJustplayEntry = getConfigListEntry( _("Timer type"), self.timerentry_justplay, _("Choose between record and ZAP.")) self.list.append(self.timerJustplayEntry) self.timerTypeEntry = getConfigListEntry( _("Repeat type"), self.timerentry_type, _("A repeating timer or just once?")) self.list.append(self.timerTypeEntry) if self.timerentry_type.value == "once": self.frequencyEntry = None else: # repeated self.frequencyEntry = getConfigListEntry( _("Repeats"), self.timerentry_repeated, _("The type of repetition required: daily, weekly on a specified day, on weekdays (Mon-Fri), or regularly on specified days." )) self.list.append(self.frequencyEntry) self.repeatedbegindateEntry = getConfigListEntry( _("Starting on"), self.timerentry_repeatedbegindate, _("The timer becomes active (but doesn't necessarily run) on this date." )) self.list.append(self.repeatedbegindateEntry) if self.timerentry_repeated.value == "daily": pass if self.timerentry_repeated.value == "weekdays": pass if self.timerentry_repeated.value == "weekly": self.list.append( getConfigListEntry( _("Weekday"), self.timerentry_weekday, _("The day of the week the timer runs."))) if self.timerentry_repeated.value == "user": self.list.append( getConfigListEntry( _("Monday"), self.timerentry_day[0], _("Enable/disable the timer on Mondays."))) self.list.append( getConfigListEntry( _("Tuesday"), self.timerentry_day[1], _("Enable/disable the timer on Tuesdays."))) self.list.append( getConfigListEntry( _("Wednesday"), self.timerentry_day[2], _("Enable/disable the timer on Wednesdays."))) self.list.append( getConfigListEntry( _("Thursday"), self.timerentry_day[3], _("Enable/disable the timer on Thursdays."))) self.list.append( getConfigListEntry( _("Friday"), self.timerentry_day[4], _("Enable/disable the timer on Fridays."))) self.list.append( getConfigListEntry( _("Saturday"), self.timerentry_day[5], _("Enable/disable the timer on Saturdays."))) self.list.append( getConfigListEntry( _("Sunday"), self.timerentry_day[6], _("Enable/disable the timer on Sundays."))) if self.timerentry_justplay.value != "zap": self.list.append( getConfigListEntry( _("Generate name and description for new events"), self.timerentry_renamerepeat, _("Generate a new name and description from the EPG for each run of the timer." ))) self.entryDate = getConfigListEntry(_("Date"), self.timerentry_date, _("The date the timer starts.")) if self.timerentry_type.value == "once": self.list.append(self.entryDate) self.entryStartTime = getConfigListEntry( _("Start time"), self.timerentry_starttime, _("The time the timer starts.")) self.list.append(self.entryStartTime) self.entryShowEndTime = getConfigListEntry( _("Set end time"), self.timerentry_showendtime, _("Set the time the ZAP timer completes and performs any \"After event\" action." )) if self.timerentry_justplay.value == "zap": self.list.append(self.entryShowEndTime) self.entryEndTime = getConfigListEntry( _("End time"), self.timerentry_endtime, _("The time the timer completes and the \"After event\" action is taken. If the end time is earlier than the start time of the timer, the completion action takes place at that time on the following day." )) if self.timerentry_justplay.value != "zap" or self.timerentry_showendtime.value: self.list.append(self.entryEndTime) self.channelEntry = getConfigListEntry( _("Channel"), self.timerentry_service, _("The channel for this timer.")) self.list.append(self.channelEntry) self.dirname = getConfigListEntry( _("Location"), self.timerentry_dirname, _("Where the recording will be saved.")) self.tagsSet = getConfigListEntry( _("Tags"), self.timerentry_tagsset, _("Choose a tag to make searching for the recording easier.")) if self.timerentry_justplay.value != "zap": if config.usage.setup_level.index >= 2: # expert+ self.list.append(self.dirname) if getPreferredTagEditor(): self.list.append(self.tagsSet) self.list.append( getConfigListEntry( _("After event"), self.timerentry_afterevent, _("Action taken on the completion of the timer. \"Auto\" lets your %s %s return to the state it was in when the timer started. \"Do nothing\", \"Go to standby\" and \"Go to deep standby\" do exactly that." ) % (getMachineBrand(), getMachineName()))) self.list.append( getConfigListEntry( _("Recording type"), self.timerentry_recordingtype, _("\"Descramble & record ECM\" allows the recording to be descrambled later if descrambling while recording failed. \"Don't descramble, record ECM\" saves a scrambled recording that can be descrambled on playback. \"Normal\" means descramble while recording and don't record ECM." ))) self[widget].list = self.list self[widget].l.setList(self.list)
def imageInfo(self): AboutText = _("Full Image Backup ") AboutText += _("By opendroid Image Team") + "\n" AboutText += _("Support at") + " www.droidsat.org\n\n" AboutText += _("[Image Info]\n") AboutText += _("Model: %s %s\n") % (getMachineBrand(), getMachineName()) AboutText += _("Backup Date: %s\n") % strftime("%Y-%m-%d", localtime(self.START)) if path.exists('/proc/stb/info/chipset'): AboutText += _("Chipset: BCM%s") % about.getChipSetString().lower().replace('\n','').replace('bcm','') + "\n" AboutText += _("CPU: %s") % about.getCPUString() + "\n" AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n" AboutText += _("Version: %s") % getImageVersion() + "\n" AboutText += _("Build: %s") % getImageBuild() + "\n" AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n" string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) AboutText += _("Drivers:\t%s") % driversdate + "\n" AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n" AboutText += _("[Enigma2 Settings]\n") AboutText += commands.getoutput("cat /etc/enigma2/settings") AboutText += _("\n\n[User - bouquets (TV)]\n") try: f = open("/etc/enigma2/bouquets.tv","r") lines = f.readlines() f.close() for line in lines: if line.startswith("#SERVICE:"): bouqet = line.split() if len(bouqet) > 3: bouqet[3] = bouqet[3].replace('"','') f = open("/etc/enigma2/" + bouqet[3],"r") userbouqet = f.readline() AboutText += userbouqet.replace('#NAME ','') f.close() except: AboutText += "Error reading bouquets.tv" AboutText += _("\n[User - bouquets (RADIO)]\n") try: f = open("/etc/enigma2/bouquets.radio","r") lines = f.readlines() f.close() for line in lines: if line.startswith("#SERVICE:"): bouqet = line.split() if len(bouqet) > 3: bouqet[3] = bouqet[3].replace('"','') f = open("/etc/enigma2/" + bouqet[3],"r") userbouqet = f.readline() AboutText += userbouqet.replace('#NAME ','') f.close() except: AboutText += "Error reading bouquets.radio" AboutText += _("\n[Installed Plugins]\n") AboutText += commands.getoutput("opkg list_installed | grep enigma2-plugin-") return AboutText
config.plugins.icetv = ConfigSubsection() config.plugins.icetv.member = ConfigSubsection() config.plugins.icetv.member.email_address = ConfigText(show_help=False, fixed_size=False) config.plugins.icetv.member.token = ConfigText() config.plugins.icetv.member.id = ConfigNumber() config.plugins.icetv.member.region_id = ConfigNumber() config.plugins.icetv.member.password = NoSave( ConfigPassword(censor="●", show_help=False, fixed_size=False)) config.plugins.icetv.device = ConfigSubsection() config.plugins.icetv.device.label = ConfigText( default="%s %s" % (getMachineBrand(), getMachineName()), show_help=False) config.plugins.icetv.device.id = ConfigNumber() config.plugins.icetv.device.type_id = ConfigNumber( default=getIceTVDeviceType()) config.plugins.icetv.last_update_time = ConfigNumber() if config.plugins.icetv.last_update_time.value != 0: config.plugins.icetv.last_update_time.value = 0 config.plugins.icetv.last_update_time.save() configfile.save() config.plugins.icetv.last_update_time.disableSave() config.plugins.icetv.enable_epg = ConfigYesNo(default=False) config.plugins.icetv.configured = ConfigYesNo(default=False) minute = 60