X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FPlugins%2FSystemPlugins%2FSoftwareManager%2Fplugin.py;h=55b2e4437472c27344e87e2006a0ac66de09d1e6;hp=b20ba51e025fa56a2ad4f2f3fc3c04c15bd10dc5;hb=7da3c6b5bc7f55569e214a02645ea69fd6662dad;hpb=59dece7572bea6bb8aa0391c32774363c62fd71e diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index b20ba51..55b2e44 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -14,7 +14,8 @@ from Components.MenuList import MenuList from Components.Sources.List import List from Components.Slider import Slider from Components.Harddisk import harddiskmanager -from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations +from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigYesNo, ConfigSelection +from Components.ConfigList import ConfigListScreen from Components.Console import Console from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest from Components.SelectionList import SelectionList @@ -26,7 +27,8 @@ from Components.AVSwitch import AVSwitch from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad +from Tools.NumericalTextInput import NumericalTextInput +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode from cPickle import dump, load from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK from time import time, gmtime, strftime, localtime @@ -43,6 +45,14 @@ config.plugins.configurationbackup = ConfigSubsection() config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) +config.plugins.SoftwareManager = ConfigSubsection() +config.plugins.SoftwareManager.overwriteConfigFiles = ConfigSelection( + [ + ("Y", _("Yes, always")), + ("N", _("No, never")), + ("ask", _("Always ask")) + ], "Y") + def write_cache(cache_file, cache_data): #Does a cPickle dump if not os_path.isdir( os_path.dirname(cache_file) ): @@ -109,14 +119,17 @@ class UpdatePluginMenu(Screen): self.menu = args self.list = [] self.oktext = _("\nPress OK on your remote control to continue.") + self.menutext = _("Press MENU on your remote control for additional options.") + self.infotext = _("Press INFO on your remote control for additional information.") self.text = "" self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) if self.menu == 0: - self.list.append(("install-extensions", _("Manage extensions"), _("\nManage extensions or plugins for your Dreambox" ) + self.oktext, None)) - self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None)) - self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None)) - self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None)) - self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None)) + print "building menu entries" + self.list.append(("install-extensions", _("Manage extensions"), _("\nManage extensions or plugins for your STB" ) + self.oktext, None)) + self.list.append(("software-update", _("Software update"), _("\nOnline update of your STB software." ) + self.oktext, None)) + self.list.append(("software-restore", _("Software restore"), _("\nRestore your STB with a new firmware." ) + self.oktext, None)) + self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your STB settings." ) + self.oktext + "\n\n" + self.infotext, None)) + self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your STB settings." ) + self.oktext, None)) self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local extensions and install them." ) + self.oktext, None)) for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): if p.__call__.has_key("SoftwareSupported"): @@ -136,7 +149,7 @@ class UpdatePluginMenu(Screen): elif self.menu == 1: self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) - self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None)) + self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup.") + self.oktext + "\n\n" + self.infotext, None)) if config.usage.setup_level.index >= 2: # expert+ self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) @@ -156,25 +169,25 @@ class UpdatePluginMenu(Screen): self["menu"] = List(self.list) self["key_red"] = StaticText(_("Close")) - self["status"] = StaticText("") + self["status"] = StaticText(self.menutext) - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions"], + self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "MenuActions"], { "ok": self.go, "back": self.close, "red": self.close, + "menu": self.handleMenu, + "showEventInfo": self.handleInfo, }, -1) self.onLayoutFinish.append(self.layoutFinished) self.backuppath = getBackupPath() self.backupfile = getBackupFilename() self.fullbackupfilename = self.backuppath + "/" + self.backupfile self.onShown.append(self.setWindowTitle) - #self.onClose.append(self.cleanup) def layoutFinished(self): idx = 0 self["menu"].index = idx - #self.getUpdateInfos() def setWindowTitle(self): self.setTitle(_("Software management")) @@ -201,15 +214,23 @@ class UpdatePluginMenu(Screen): self.text = _("No network connection available.") self["status"].setText(self.text) + def handleMenu(self): + self.session.open(SoftwareManagerSetup) + + def handleInfo(self): + current = self["menu"].getCurrent() + if current: + currentEntry = current[0] + if currentEntry in ("system-backup","backupfiles"): + self.session.open(SoftwareManagerInfo, mode = "backupinfo") def go(self): - #iNetwork.stopPingConsole() current = self["menu"].getCurrent() if current: currentEntry = current[0] if self.menu == 0: if (currentEntry == "software-update"): - self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!")) + self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your STB?")+"\n"+_("\nAfter pressing OK, please wait!")) elif (currentEntry == "software-restore"): self.session.open(ImageWizard) elif (currentEntry == "install-extensions"): @@ -290,6 +311,185 @@ class UpdatePluginMenu(Screen): self.exe = True self.session.open(RestoreScreen, runRestore = True) +class SoftwareManagerSetup(Screen, ConfigListScreen): + + skin = """ + + + + + + + + + + + + + """ + + def __init__(self, session, skin_path = None): + Screen.__init__(self, session) + self.session = session + self.skin_path = skin_path + if self.skin_path == None: + self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") + + self.onChangedEntry = [ ] + self.setup_title = _("Software manager setup") + self.overwriteConfigfilesEntry = None + + self.list = [ ] + ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry) + + self["actions"] = ActionMap(["SetupActions"], + { + "cancel": self.keyCancel, + "save": self.apply, + }, -2) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("OK")) + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.createSetup() + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(self.setup_title) + + def createSetup(self): + self.list = [ ] + self.overwriteConfigfilesEntry = getConfigListEntry(_("Overwrite configuration files ?"), config.plugins.SoftwareManager.overwriteConfigFiles) + self.list.append(self.overwriteConfigfilesEntry) + self["config"].list = self.list + self["config"].l.setSeperation(400) + self["config"].l.setList(self.list) + if not self.selectionChanged in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.selectionChanged) + self.selectionChanged() + + def selectionChanged(self): + if self["config"].getCurrent() == self.overwriteConfigfilesEntry: + self["introduction"].setText(_("Overwrite configuration files during software upgrade?")) + else: + self["introduction"].setText("") + + def newConfig(self): + pass + + def keyLeft(self): + ConfigListScreen.keyLeft(self) + + def keyRight(self): + ConfigListScreen.keyRight(self) + + def confirm(self, confirmed): + if not confirmed: + print "not confirmed" + return + else: + self.keySave() + + def apply(self): + self.session.openWithCallback(self.confirm, MessageBox, _("Use this settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + + def cancelConfirm(self, result): + if not result: + return + for x in self["config"].list: + x[1].cancel() + self.close() + + def keyCancel(self): + if self["config"].isChanged(): + self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) + else: + self.close() + + # for summary: + def changedEntry(self): + for x in self.onChangedEntry: + x() + self.selectionChanged() + + def getCurrentEntry(self): + return self["config"].getCurrent()[0] + + def getCurrentValue(self): + return str(self["config"].getCurrent()[1].value) + + def createSummary(self): + from Screens.Setup import SetupSummary + return SetupSummary + + +class SoftwareManagerInfo(Screen): + skin = """ + + + + + + + + + + + + {"template": [ + MultiContentEntryText(pos = (5, 0), size = (540, 26), font=0, flags = RT_HALIGN_LEFT | RT_HALIGN_CENTER, text = 0), # index 0 is the name + ], + "fonts": [gFont("Regular", 24),gFont("Regular", 22)], + "itemHeight": 26 + } + + + + + """ + + def __init__(self, session, skin_path = None, mode = None): + Screen.__init__(self, session) + self.session = session + self.mode = mode + self.skin_path = skin_path + if self.skin_path == None: + self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") + + self["actions"] = ActionMap(["ShortcutActions", "WizardActions"], + { + "back": self.close, + "red": self.close, + }, -2) + + self.list = [] + self["list"] = List(self.list) + + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText() + self["key_yellow"] = StaticText() + self["key_blue"] = StaticText() + self["introduction"] = StaticText() + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(_("Softwaremanager information")) + if self.mode is not None: + self.showInfos() + + def showInfos(self): + if self.mode == "backupinfo": + self.list = [] + backupfiles = config.plugins.configurationbackup.backupdirs.value + for entry in backupfiles: + print entry + self.list.append((entry,)) + self['list'].setList(self.list) + class PluginManager(Screen, DreamInfoHandler): @@ -307,8 +507,8 @@ class PluginManager(Screen, DreamInfoHandler): {"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 +605,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 +626,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: @@ -588,13 +789,13 @@ class PluginManager(Screen, DreamInfoHandler): status = "remove" else: status = "installed" - self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState)) + self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) else: if selectState == True: status = "install" else: status = "installable" - self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState)) + self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) if len(self.list): self.list.sort(key=lambda x: x[0]) self["list"].style = "default" @@ -693,7 +894,7 @@ class PluginManager(Screen, DreamInfoHandler): self.close() def runExecuteFinished(self): - self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your STB?"), MessageBox.TYPE_YESNO) def ExecuteReboot(self, result): if result is None: @@ -778,7 +979,7 @@ class PluginManagerInfo(Screen): elif cmd == 2: info = args['package'] else: - info = _("Dreambox software because updates are available.") + info = _("STB software because updates are available.") self.list.append(self.buildEntryComponent(action,info)) self['list'].setList(self.list) @@ -903,8 +1104,7 @@ class PluginDetails(Screen, DreamInfoHandler): self.skin_path = plugin_path self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" self.attributes = None - self.translatedAttributes = None - DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language) + DreamInfoHandler.__init__(self, self.statusCallback, blocking = False) self.directory = resolveFilename(SCOPE_METADIR) if packagedata: self.pluginname = packagedata[0] @@ -942,8 +1142,6 @@ class PluginDetails(Screen, DreamInfoHandler): self.package = self.packageDetails[0] if self.package[0].has_key("attributes"): self.attributes = self.package[0]["attributes"] - if self.package[0].has_key("translation"): - self.translatedAttributes = self.package[0]["translation"] self.cmdList = [] self.oktext = _("\nAfter pressing OK, please wait!") @@ -953,7 +1151,7 @@ class PluginDetails(Screen, DreamInfoHandler): self.onLayoutFinish.append(self.setInfos) def setWindowTitle(self): - self.setTitle(_("Details for extension: " + self.pluginname)) + self.setTitle(_("Details for plugin: ") + self.pluginname ) def exit(self): self.close(False) @@ -968,34 +1166,26 @@ class PluginDetails(Screen, DreamInfoHandler): pass def setInfos(self): - if self.translatedAttributes.has_key("name"): - self.pluginname = self.translatedAttributes["name"] - elif self.attributes.has_key("name"): + if self.attributes.has_key("screenshot"): + self.loadThumbnail(self.attributes) + + if self.attributes.has_key("name"): self.pluginname = self.attributes["name"] else: self.pluginname = _("unknown") - if self.translatedAttributes.has_key("author"): - self.author = self.translatedAttributes["author"] - elif self.attributes.has_key("author"): + if self.attributes.has_key("author"): self.author = self.attributes["author"] else: self.author = _("unknown") - if self.translatedAttributes.has_key("description"): - self.description = self.translatedAttributes["description"] - elif self.attributes.has_key("description"): - self.description = self.attributes["description"] + if self.attributes.has_key("description"): + self.description = _(self.attributes["description"].replace("\\n", "\n")) else: self.description = _("No description available.") - if self.translatedAttributes.has_key("screenshot"): - self.loadThumbnail(self.translatedAttributes) - else: - self.loadThumbnail(self.attributes) - self["author"].setText(_("Author: ") + self.author) - self["detailtext"].setText(self.description.strip()) + self["detailtext"].setText(_(self.description)) if self.pluginstate in ('installable', 'install'): self["key_green"].setText(_("Install")) else: @@ -1005,6 +1195,10 @@ class PluginDetails(Screen, DreamInfoHandler): thumbnailUrl = None if entry.has_key("screenshot"): thumbnailUrl = entry["screenshot"] + if self.language == "de": + if thumbnailUrl[-7:] == "_en.jpg": + thumbnailUrl = thumbnailUrl[:-7] + "_de.jpg" + if thumbnailUrl is not None: self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1] print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail @@ -1059,7 +1253,7 @@ class PluginDetails(Screen, DreamInfoHandler): self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) def runUpgradeFinished(self): - self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your STB?"), MessageBox.TYPE_YESNO) def UpgradeReboot(self, result): if result is None: @@ -1074,7 +1268,7 @@ class PluginDetails(Screen, DreamInfoHandler): self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) def runRemoveFinished(self): - self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your STB?"), MessageBox.TYPE_YESNO) def RemoveReboot(self, result): if result is None: @@ -1094,7 +1288,7 @@ class PluginDetails(Screen, DreamInfoHandler): class UpdatePlugin(Screen): skin = """ - + @@ -1110,13 +1304,15 @@ class UpdatePlugin(Screen): self["slider"] = self.slider self.activityslider = Slider(0, 100) self["activityslider"] = self.activityslider - self.status = StaticText(_("Upgrading Dreambox... Please wait")) + self.status = StaticText(_("Upgrading STB... Please wait")) self["status"] = self.status self.package = StaticText() self["package"] = self.package + self.oktext = _("Press OK on your remote control to continue.") self.packages = 0 self.error = 0 + self.processed_packages = [] self.activity = 0 self.activityTimer = eTimer() @@ -1150,20 +1346,34 @@ class UpdatePlugin(Screen): self.slider.setValue(self.sliderPackages[param]) self.package.setText(param) self.status.setText(_("Upgrading")) - self.packages += 1 + 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")) - self.packages += 1 + 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: - self.session.openWithCallback( - self.modificationCallback, - MessageBox, - _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) - ) + if config.plugins.SoftwareManager.overwriteConfigFiles.value in ("N", "Y"): + self.ipkg.write(True and config.plugins.SoftwareManager.overwriteConfigFiles.value) + else: + self.session.openWithCallback( + self.modificationCallback, + MessageBox, + _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param) + ) elif event == IpkgComponent.EVENT_ERROR: self.error += 1 elif event == IpkgComponent.EVENT_DONE: @@ -1177,15 +1387,15 @@ class UpdatePlugin(Screen): self.activityslider.setValue(0) self.package.setText("") - self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages) + self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages + "\n\n" + self.oktext) else: self.activityTimer.stop() self.activityslider.setValue(0) - error = _("your dreambox might be unusable now. Please consult the manual for further assistance before rebooting your dreambox.") + error = _("your STB might be unusable now. Please consult the manual for further assistance before rebooting your STB.") if self.packages == 0: error = _("No packages were upgraded yet. So you can check your network and try again.") if self.updating: - error = _("Your dreambox isn't connected to the internet properly. Please check it and try again.") + error = _("Your STB isn't connected to the internet properly. Please check it and try again.") self.status.setText(_("Error") + " - " + error) #print event, "-", param pass @@ -1196,7 +1406,7 @@ class UpdatePlugin(Screen): def exit(self): if not self.ipkg.isRunning(): if self.packages != 0 and self.error == 0: - self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?")) + self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your STB?")) else: self.close() @@ -1380,7 +1590,7 @@ class IPKGSource(Screen): self["text"].number(number) -class PacketManager(Screen): +class PacketManager(Screen, NumericalTextInput): skin = """ @@ -1404,15 +1614,29 @@ class PacketManager(Screen): def __init__(self, session, plugin_path, args = None): Screen.__init__(self, session) + NumericalTextInput.__init__(self) self.session = session self.skin_path = plugin_path - self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], + self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz') + + self["shortcuts"] = NumberActionMap(["ShortcutActions", "WizardActions", "NumberActions", "InputActions", "InputAsciiActions", "KeyboardInputActions" ], { "ok": self.go, "back": self.exit, "red": self.exit, "green": self.reload, + "gotAsciiCode": self.keyGotAscii, + "1": self.keyNumberGlobal, + "2": self.keyNumberGlobal, + "3": self.keyNumberGlobal, + "4": self.keyNumberGlobal, + "5": self.keyNumberGlobal, + "6": self.keyNumberGlobal, + "7": self.keyNumberGlobal, + "8": self.keyNumberGlobal, + "9": self.keyNumberGlobal, + "0": self.keyNumberGlobal }, -1) self.list = [] @@ -1437,12 +1661,44 @@ class PacketManager(Screen): self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.rebuildList) + rcinput = eRCInput.getInstance() + rcinput.setKeyboardMode(rcinput.kmAscii) + + def keyNumberGlobal(self, val): + key = self.getKey(val) + if key is not None: + keyvalue = key.encode("utf-8") + if len(keyvalue) == 1: + self.setNextIdx(keyvalue[0]) + + def keyGotAscii(self): + keyvalue = unichr(getPrevAsciiCode()).encode("utf-8") + if len(keyvalue) == 1: + self.setNextIdx(keyvalue[0]) + + def setNextIdx(self,char): + if char in ("0", "1", "a"): + self["list"].setIndex(0) + else: + idx = self.getNextIdx(char) + if idx and idx <= self["list"].count: + self["list"].setIndex(idx) + + def getNextIdx(self,char): + idx = 0 + for i in self["list"].list: + if i[0][0] == char: + return idx + idx += 1 + def exit(self): self.ipkg.stop() if self.Console is not None: if len(self.Console.appContainers): for name in self.Console.appContainers.keys(): self.Console.kill(name) + rcinput = eRCInput.getInstance() + rcinput.setKeyboardMode(rcinput.kmNone) self.close() def reload(self): @@ -1504,7 +1760,7 @@ class PacketManager(Screen): self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList) def runRemoveFinished(self): - self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + self.session.openWithCallback(self.RemoveReboot, MessageBox, _("Remove finished.") +" "+_("Do you want to reboot your STB?"), MessageBox.TYPE_YESNO) def RemoveReboot(self, result): if result is None: @@ -1526,7 +1782,7 @@ class PacketManager(Screen): self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList) def runUpgradeFinished(self): - self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO) + self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your STB?"), MessageBox.TYPE_YESNO) def UpgradeReboot(self, result): if result is None: @@ -1558,24 +1814,31 @@ class PacketManager(Screen): pass def IpkgList_Finished(self, result, retval, extra_args = None): - if len(result): + if result: self.packetlist = [] for x in result.splitlines(): - split = x.split(' - ') #self.blacklisted_packages - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()]) + tokens = x.split(' - ') #self.blacklisted_packages + name = tokens[0].strip() + if not any(name.endswith(x) for x in self.unwanted_extensions): + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + descr = l > 2 and tokens[2].strip() or "" + self.packetlist.append([name, version, descr]) if not self.Console: self.Console = Console() cmd = "ipkg list_installed" self.Console.ePopen(cmd, self.IpkgListInstalled_Finished) def IpkgListInstalled_Finished(self, result, retval, extra_args = None): - if len(result): + if result: self.installed_packetlist = {} for x in result.splitlines(): - split = x.split(' - ') - if not any(split[0].strip().endswith(x) for x in self.unwanted_extensions): - self.installed_packetlist[split[0].strip()] = split[1].strip() + tokens = x.split(' - ') #self.blacklisted_packages + name = tokens[0].strip() + if not any(name.endswith(x) for x in self.unwanted_extensions): + l = len(tokens) + version = l > 1 and tokens[1].strip() or "" + self.installed_packetlist[name] = version self.buildPacketList() def buildEntryComponent(self, name, version, description, state): @@ -1694,16 +1957,12 @@ 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=_("Software management"), description=_("Manage your receiver's software"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup), PluginDescriptor(name=_("Ipkg"), where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan) ] if config.usage.setup_level.index >= 2: # expert+