diff options
| author | Fraxinas <andreas.frisch@multimedia-labs.de> | 2010-04-09 08:25:08 +0200 |
|---|---|---|
| committer | Fraxinas <andreas.frisch@multimedia-labs.de> | 2010-04-09 08:25:08 +0200 |
| commit | 98c7a787df63a93f868548c2b1e357c0d873ebbe (patch) | |
| tree | e8258f3e175e540e6106e0b7202abcf550b825d1 /lib/python/Plugins/SystemPlugins | |
| parent | ae60e9e3642949a91b7ea4f77374495fec9a51ed (diff) | |
| parent | 76250cdc36d0f0e84505d5654066229b846f035f (diff) | |
| download | enigma2-98c7a787df63a93f868548c2b1e357c0d873ebbe.tar.gz enigma2-98c7a787df63a93f868548c2b1e357c0d873ebbe.zip | |
Merge branch 'experimental' of git.opendreambox.org:/git/enigma2 into experimental
Diffstat (limited to 'lib/python/Plugins/SystemPlugins')
6 files changed, 133 insertions, 51 deletions
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index 860efc02..8986560b 100644 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -63,10 +63,10 @@ class NFIFlash(Screen): <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" /> - <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" /> - <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1" /> - <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1" /> - <widget source="listlabel" render="Label" position="16,44" size="200,21" valign="center" font="Regular;18" /> + <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#a08500" transparent="1" /> + <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#18188b" transparent="1" /> + <widget source="listlabel" render="Label" position="10,44" size="250,20" font="Regular;16" /> <widget name="filelist" position="0,68" size="260,260" scrollbarMode="showOnDemand" /> <widget source="infolabel" render="Label" position="270,44" size="280,284" font="Regular;16" /> <widget source="job_progressbar" render="Progress" position="10,374" size="540,26" borderWidth="1" backgroundColor="#254f7497" /> @@ -95,6 +95,7 @@ class NFIFlash(Screen): { "green": self.ok, "yellow": self.reboot, + "blue": self.runWizard, "ok": self.ok, "left": self.left, "right": self.right, @@ -109,6 +110,43 @@ class NFIFlash(Screen): self.md5sum = "" self.job = None self.box = HardwareInfo().get_device_name() + self.configuration_restorable = None + self.wizard_mode = False + from enigma import eTimer + self.delayTimer = eTimer() + self.delayTimer.callback.append(self.runWizard) + self.delayTimer.start(50,1) + + def check_for_wizard(self): + if self["filelist"].getCurrentDirectory() is not None and fileExists(self["filelist"].getCurrentDirectory()+"wizard.nfo"): + self["key_blue"].text = _("USB stick wizard") + return True + else: + self["key_blue"].text = "" + return False + + def runWizard(self): + if not self.check_for_wizard(): + self.wizard_mode = False + return + wizardcontent = open(self["filelist"].getCurrentDirectory()+"/wizard.nfo", "r").readlines() + nfifile = None + for line in wizardcontent: + line = line.strip() + if line.startswith("image: "): + nfifile = self["filelist"].getCurrentDirectory()+line[7:] + if line.startswith("configuration: "): + backupfile = self["filelist"].getCurrentDirectory()+line[15:] + if fileExists(backupfile): + print "wizard configuration:", backupfile + self.configuration_restorable = backupfile + else: + self.configuration_restorable = None + if nfifile and fileExists(nfifile): + self.wizard_mode = True + print "wizard image:", nfifile + self.check_for_NFO(nfifile) + self.queryFlash() def closeCB(self): if ( self.job is None or self.job.status is not self.job.IN_PROGRESS ) and not self.no_autostart: @@ -133,12 +171,16 @@ class NFIFlash(Screen): self["filelist"].pageUp() self.check_for_NFO() - def check_for_NFO(self): + def check_for_NFO(self, nfifile=None): self.session.summary.setText(self["filelist"].getFilename()) - if self["filelist"].getFilename() is None: - return - if self["filelist"].getCurrentDirectory() is not None: - self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename() + if nfifile is None: + self.session.summary.setText(self["filelist"].getFilename()) + if self["filelist"].getFilename() is None: + return + if self["filelist"].getCurrentDirectory() is not None: + self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename() + else: + self.nfifile = nfifile if self.nfifile.upper().endswith(".NFI"): self["key_green"].text = _("Flash") @@ -152,7 +194,7 @@ class NFIFlash(Screen): else: self.md5sum = "" else: - self["infolabel"].text = _("No details for this image file") + ":\n" + self["filelist"].getFilename() + self["infolabel"].text = _("No details for this image file") + (self["filelist"].getFilename() or "") self.md5sum = "" else: self["infolabel"].text = "" @@ -164,6 +206,7 @@ class NFIFlash(Screen): self["filelist"].descent() self.session.summary.setText(self["filelist"].getFilename()) self.check_for_NFO() + self.check_for_wizard() else: self.queryFlash() @@ -192,7 +235,10 @@ class NFIFlash(Screen): def md5finished(self, retval): if retval==0: - self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO) + if self.wizard_mode: + self.session.openWithCallback(self.queryCB, MessageBox, _("Shall the USB stick wizard proceed and program the image file %s into flash memory?" % self.nfifile.rsplit('/',1)[-1]), MessageBox.TYPE_YESNO) + else: + self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO) else: self.session.openWithCallback(self.queryCB, MessageBox, _("The md5sum validation failed, the file may be corrupted! Are you sure that you want to burn this image to flash memory? You are doing this at your own risk!"), MessageBox.TYPE_YESNO) @@ -201,6 +247,7 @@ class NFIFlash(Screen): self.createJob() else: self["statusbar"].text = _("Please select .NFI flash image file from medium") + self.wizard_mode = False def createJob(self): self.job = Job("Image flashing job") @@ -240,6 +287,8 @@ class NFIFlash(Screen): elif j.status == j.FINISHED: self["statusbar"].text = _("Writing NFI image file to flash completed") self.session.summary.setText(_("NFI image flashing completed. Press Yellow to Reboot!")) + if self.wizard_mode: + self.restoreConfiguration() self["key_yellow"].text = _("Reboot") elif j.status == j.FAILED: @@ -250,10 +299,19 @@ class NFIFlash(Screen): print "[jobcb] %s %s %s" % (jobref, fasel, blubber) self["key_green"].text = _("Flash") - def reboot(self): + def reboot(self, ret=None): if self.job.status == self.job.FINISHED: self["statusbar"].text = ("rebooting...") TryQuitMainloop(self.session,2) - + + def restoreConfiguration(self): + if self.configuration_restorable: + from Screens.Console import Console + cmdlist = [ "mount /dev/mtdblock/3 /mnt/realroot -t jffs2", "tar -xzvf " + self.configuration_restorable + " -C /mnt/realroot/" ] + self.session.open(Console, title = "Restore running", cmdlist = cmdlist, finishedCallback = self.restore_finished, closeOnSuccess = True) + + def restore_finished(self): + self.session.openWithCallback(self.reboot, MessageBox, _("USB stick wizard finished. Your dreambox will now restart with your new image!"), MessageBox.TYPE_INFO) + def createSummary(self): return NFISummary diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py index 6096ca8b..a8b34acd 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py @@ -421,3 +421,4 @@ class NetworkWizard(WizardLanguage, Rc): def ChoicesSelectionMoved(self): pass + diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index e8cf6dc2..d4653cca 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -7,6 +7,7 @@ from Components.Sources.List import List from Components.Ipkg import IpkgComponent from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR +from Tools.HardwareInfo import HardwareInfo from time import time @@ -29,6 +30,7 @@ class SoftwareTools(DreamInfoHandler): self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language) self.directory = resolveFilename(SCOPE_METADIR) + self.hardware_info = HardwareInfo() self.list = List([]) self.NotifierCallback = None self.Console = Console() @@ -78,9 +80,12 @@ class SoftwareTools(DreamInfoHandler): def ipkgCallback(self, event, param): if event == IpkgComponent.EVENT_ERROR: SoftwareTools.list_updating = False + if self.NotifierCallback is not None: + self.NotifierCallback(False) elif event == IpkgComponent.EVENT_DONE: if SoftwareTools.list_updating: self.startIpkgListAvailable() + #print event, "-", param pass def startIpkgListAvailable(self, callback = None): @@ -164,6 +169,14 @@ class SoftwareTools(DreamInfoHandler): l = len(tokens) version = l > 1 and tokens[1].strip() or "" SoftwareTools.installed_packetlist[name] = version + for package in self.packagesIndexlist[:]: + if not self.verifyPrerequisites(package[0]["prerequisites"]): + self.packagesIndexlist.remove(package) + for package in self.packagesIndexlist[:]: + attributes = package[0]["attributes"] + if attributes.has_key("packagetype"): + if attributes["packagetype"] == "internal": + self.packagesIndexlist.remove(package) if callback is None: self.countUpdates() else: @@ -228,4 +241,14 @@ class SoftwareTools(DreamInfoHandler): for name in self.UpdateConsole.appContainers.keys(): self.UpdateConsole.kill(name) + def verifyPrerequisites(self, prerequisites): + if prerequisites.has_key("hardware"): + hardware_found = False + for hardware in prerequisites["hardware"]: + if hardware == self.hardware_info.device_name: + hardware_found = True + if not hardware_found: + return False + return True + iSoftwareTools = SoftwareTools()
\ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 4dbe7f70..1e0ed4d5 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -307,8 +307,8 @@ class PluginManager(Screen, DreamInfoHandler): <convert type="TemplatedMultiContent"> {"templates": {"default": (51,[ - MultiContentEntryText(pos = (30, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name - MultiContentEntryText(pos = (30, 25), size = (470, 24), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description + MultiContentEntryText(pos = (0, 1), size = (470, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name + MultiContentEntryText(pos = (0, 25), size = (470, 24), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 2 is the description MultiContentEntryPixmapAlphaTest(pos = (475, 0), size = (48, 48), png = 5), # index 5 is the status pixmap MultiContentEntryPixmapAlphaTest(pos = (0, 49), size = (550, 2), png = 6), # index 6 is the div pixmap ]), @@ -405,22 +405,19 @@ class PluginManager(Screen, DreamInfoHandler): if status == 'update': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Updating software catalog"), '', _("Searching for available updates. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) elif status == 'sync': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) elif status == 'error': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) - self["list"].style = "default" - self['list'].setList(self.statuslist) + self["list"].style = "default" + self['list'].setList(self.statuslist) + def getUpdateInfos(self): self.setState('update') - iSoftwareTools.getUpdates(self.getUpdateInfosCB) + iSoftwareTools.startSoftwareTools(self.getUpdateInfosCB) def getUpdateInfosCB(self, retval = None): if retval is not None: @@ -429,9 +426,13 @@ class PluginManager(Screen, DreamInfoHandler): self["status"].setText(_("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")) else: self["status"].setText(_("There are no updates available.")) + self.rebuildList() elif retval is False: - self["status"].setText(_("No network connection available.")) - self.rebuildList() + self.setState('error') + if iSoftwareTools.NetworkConnectionAvailable: + self["status"].setText(_("Updatefeed not available.")) + else: + self["status"].setText(_("No network connection available.")) def rebuildList(self, retval = None): if self.currentSelectedTag is None: @@ -1701,15 +1702,11 @@ def startSetup(menuid): return [ ] return [(_("Software management"), UpgradeMain, "software_manager", 50)] -def autostart(reason, **kwargs): - if reason is True: - iSoftwareTools.startSoftwareTools() def Plugins(path, **kwargs): global plugin_path plugin_path = path list = [ - PluginDescriptor(where = [PluginDescriptor.WHERE_NETWORKCONFIG_READ], fnc = autostart), PluginDescriptor(name=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) ] diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 38e343f9..c8af9cdd 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -12,7 +12,7 @@ from Components.FanControl import fancontrol class TempFanControl(Screen, ConfigListScreen): skin = """ - <screen position="90,100" size="570,420" title="Fan Control" > + <screen position="center,center" size="570,420" title="Fan Control" > <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> @@ -22,7 +22,7 @@ class TempFanControl(Screen, ConfigListScreen): <widget source="yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> <widget source="blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" /> - <widget name="config" position="10,50" size="550,90" scrollbarMode="showOnDemand" /> + <widget name="config" position="10,50" size="550,120" scrollbarMode="showOnDemand" /> <widget source="SensorTempText0" render="Label" position="10,150" zPosition="1" size="90,40" font="Regular;20" halign="left" valign="top" backgroundColor="#9f1313" transparent="1" /> <widget source="SensorTemp0" render="Label" position="100,150" zPosition="1" size="100,20" font="Regular;19" halign="right"> @@ -90,7 +90,7 @@ class TempFanControl(Screen, ConfigListScreen): <convert type="SensorToText"></convert> </widget> </screen>""" - + def __init__(self, session, args = None): Screen.__init__(self, session) @@ -125,6 +125,9 @@ class TempFanControl(Screen, ConfigListScreen): for count in range(fancontrol.getFanCount()): self.list.append(getConfigListEntry(_("Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt)) self.list.append(getConfigListEntry(_("Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm)) + self.list.append(getConfigListEntry(_("Standby Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt_standby)) + self.list.append(getConfigListEntry(_("Standby Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm_standby)) + ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) @@ -136,28 +139,31 @@ class TempFanControl(Screen, ConfigListScreen): "red": self.revert, "green": self.save }, -1) - + def save(self): for count in range(fancontrol.getFanCount()): fancontrol.getConfig(count).vlt.save() fancontrol.getConfig(count).pwm.save() + fancontrol.getConfig(count).vlt_standby.save() + fancontrol.getConfig(count).pwm_standby.save() self.close() - + def revert(self): for count in range(fancontrol.getFanCount()): fancontrol.getConfig(count).vlt.load() fancontrol.getConfig(count).pwm.load() + fancontrol.getConfig(count).vlt_standby.load() + fancontrol.getConfig(count).pwm_standby.load() self.close() - + def main(session, **kwargs): session.open(TempFanControl) def startMenu(menuid): if menuid != "system": return [] - return [(_("Temperature and Fan control"), main, "tempfancontrol", 80)] def Plugins(**kwargs): return PluginDescriptor(name = "Temperature and Fan control", description = _("Temperature and Fan control"), where = PluginDescriptor.WHERE_MENU, fnc = startMenu) -
\ No newline at end of file + diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index a9f7bf43..2df5814c 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -190,7 +190,7 @@ class WlanScan(Screen): self.newAPList = None self.WlanList = None self.cleanList = None - self.oldlist = None + self.oldlist = {} self.listLength = None self.rescanTimer = eTimer() self.rescanTimer.callback.append(self.rescanTimerFired) @@ -274,24 +274,18 @@ class WlanScan(Screen): return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng)) def updateAPList(self): - self.oldlist = [] - self.oldlist = self.cleanList - self.newAPList = [] newList = [] + newList = self.getAccessPoints(refresh = True) + self.newAPList = [] tmpList = [] newListIndex = None currentListEntry = None currentListIndex = None - newList = self.getAccessPoints(refresh = True) - - for oldentry in self.oldlist: - if oldentry not in newList: - newList.append(oldentry) - for newentry in newList: - if newentry[1] == "hidden...": - continue - tmpList.append(newentry) + for ap in self.oldlist.keys(): + data = self.oldlist[ap]['data'] + if data is not None: + tmpList.append(data) if len(tmpList): if "hidden..." not in tmpList: @@ -303,7 +297,7 @@ class WlanScan(Screen): currentListEntry = self["list"].getCurrent() idx = 0 for entry in self.newAPList: - if entry == currentListEntry: + if entry[0] == currentListEntry[0]: newListIndex = idx idx +=1 self['list'].setList(self.newAPList) @@ -335,6 +329,10 @@ class WlanScan(Screen): compList.remove(compentry) for entry in compList: self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) ) + if not self.oldlist.has_key(entry[0]): + self.oldlist[entry[0]] = { 'data': entry } + else: + self.oldlist[entry[0]]['data'] = entry if "hidden..." not in self.cleanList: self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) ) @@ -401,4 +399,3 @@ def configStrings(iface): def Plugins(**kwargs): return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."}) -
\ No newline at end of file |
