Merge commit 'dm/experimental' into test branch
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / SoftwareManager / plugin.py
index f78b758..2090aee 100644 (file)
@@ -125,11 +125,11 @@ class UpdatePluginMenu(Screen):
                self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
                if self.menu == 0:
                        print "building menu entries"
-                       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 + "\n\n" + self.infotext, None))
-                       self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None))
+                       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"):
@@ -230,7 +230,7 @@ class UpdatePluginMenu(Screen):
                        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"):
@@ -489,7 +489,6 @@ class SoftwareManagerInfo(Screen):
                        self.list = []
                        backupfiles = config.plugins.configurationbackup.backupdirs.value
                        for entry in backupfiles:
-                               print entry
                                self.list.append((entry,))
                        self['list'].setList(self.list)
                        
@@ -569,6 +568,7 @@ class PluginManager(Screen, DreamInfoHandler):
                self.currentSelectedIndex = None
                self.currentSelectedPackage = None
                self.saved_currentSelectedPackage = None
+               self.restartRequired = False
                
                self.onShown.append(self.setWindowTitle)
                self.onLayoutFinish.append(self.getUpdateInfos)
@@ -892,6 +892,8 @@ class PluginManager(Screen, DreamInfoHandler):
                                        self.package = iSoftwareTools.packageDetails[0]
                                        if self.package[0].has_key("attributes"):
                                                self.attributes = self.package[0]["attributes"]
+                                               if self.attributes.has_key("needsRestart"):
+                                                       self.restartRequired = True
                                        if self.attributes.has_key("package"):
                                                self.packagefiles = self.attributes["package"]
                                        if plugin[1] == 'installed':
@@ -924,11 +926,11 @@ class PluginManager(Screen, DreamInfoHandler):
 
        def runExecuteFinished(self):
                self.reloadPluginlist()
-               restartRequired = plugins.restartRequired
-               if restartRequired:
-                       self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO)
+               if plugins.restartRequired or self.restartRequired:
+                       self.session.openWithCallback(self.ExecuteReboot, MessageBox, _("Install or remove finished.") +" "+_("Do you want to reboot your STB?"), MessageBox.TYPE_YESNO)
                else:
                        self.selectedFiles = []
+                       self.restartRequired = False
                        self.detailsClosed(True)
 
        def ExecuteReboot(self, result):
@@ -936,6 +938,7 @@ class PluginManager(Screen, DreamInfoHandler):
                        quitMainloop(3)
                else:
                        self.selectedFiles = []
+                       self.restartRequired = False
                        self.detailsClosed(True)
 
        def reloadPluginlist(self):
@@ -1011,7 +1014,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)
@@ -1174,7 +1177,7 @@ class PluginDetails(Screen, DreamInfoHandler):
                self.package = self.packageDetails[0]
                if self.package[0].has_key("attributes"):
                        self.attributes = self.package[0]["attributes"]
-
+               self.restartRequired = False
                self.cmdList = []
                self.oktext = _("\nAfter pressing OK, please wait!")
                self.picload = ePicLoad()
@@ -1272,20 +1275,22 @@ class PluginDetails(Screen, DreamInfoHandler):
        def go(self):
                if self.attributes.has_key("package"):
                        self.packagefiles = self.attributes["package"]
+               if self.attributes.has_key("needsRestart"):
+                       self.restartRequired = True
                self.cmdList = []
                if self.pluginstate in ('installed', 'remove'):
                        if self.packagefiles:
                                for package in self.packagefiles[:]:
                                        self.cmdList.append((IpkgComponent.CMD_REMOVE, { "package": package["name"] }))
-                                       if len(self.cmdList):
-                                               self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + self.pluginname + "\n" + self.oktext)
+                               if len(self.cmdList):
+                                       self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + self.pluginname + "\n" + self.oktext)
                else:
                        if iSoftwareTools.NetworkConnectionAvailable:
                                if self.packagefiles:
                                        for package in self.packagefiles[:]:
                                                self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] }))
-                                               if len(self.cmdList):
-                                                       self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext)
+                                       if len(self.cmdList):
+                                               self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext)
 
        def runUpgrade(self, result):
                if result:
@@ -1293,9 +1298,8 @@ class PluginDetails(Screen, DreamInfoHandler):
 
        def runUpgradeFinished(self):
                self.reloadPluginlist()
-               restartRequired = plugins.restartRequired
-               if restartRequired:
-                       self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your Dreambox?"), MessageBox.TYPE_YESNO)
+               if plugins.restartRequired or self.restartRequired:
+                       self.session.openWithCallback(self.UpgradeReboot, MessageBox, _("Installation finished.") +" "+_("Do you want to reboot your STB?"), MessageBox.TYPE_YESNO)
                else:
                        self.close(True)
        def UpgradeReboot(self, result):
@@ -1374,7 +1378,7 @@ class UpdatePlugin(Screen):
                                self.updating = True
                                self.activityTimer.start(100, False)
                                self.package.setText(_("Package list update"))
-                               self.status.setText(_("Upgrading Dreambox... Please wait"))
+                               self.status.setText(_("Upgrading STB... Please wait"))
                                self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
                        else:
                                self.package.setText(_("Your network is not working. Please try again."))
@@ -1439,11 +1443,11 @@ class UpdatePlugin(Screen):
                        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
@@ -1454,7 +1458,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()
                else:
@@ -1812,7 +1816,7 @@ class PacketManager(Screen, NumericalTextInput):
                        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:
@@ -1834,7 +1838,7 @@ class PacketManager(Screen, NumericalTextInput):
                        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: