SoftwareManager: ask for restart after installation inside pluginmanager only if...
authoracid-burn <acid-burn@opendreambox.org>
Mon, 7 Feb 2011 13:34:11 +0000 (14:34 +0100)
committeracid-burn <acid-burn@opendreambox.org>
Mon, 7 Feb 2011 13:40:36 +0000 (14:40 +0100)
refs #670

lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py
lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py

index 8b8fc97c4fcfaa698d05d5528b6f50d304c53a3d..87f0a4d6e11b5d7ac7f6a6d7ea7ae105dedc0303 100755 (executable)
@@ -264,13 +264,12 @@ class SoftwareTools(DreamInfoHandler):
                                                callback(False)
 
        def startIpkgListInstalled(self, callback = None):
                                                callback(False)
 
        def startIpkgListInstalled(self, callback = None):
-               print "STARTIPKGLISTINSTALLED"
                if callback is not None:
                        self.list_updating = True
                if self.list_updating:
                        if not self.UpdateConsole:
                                self.UpdateConsole = Console()
                if callback is not None:
                        self.list_updating = True
                if self.list_updating:
                        if not self.UpdateConsole:
                                self.UpdateConsole = Console()
-                       cmd = "opkg list_installed"
+                       cmd = "opkg list-installed"
                        self.UpdateConsole.ePopen(cmd, self.IpkgListInstalledCB, callback)
 
        def IpkgListInstalledCB(self, result, retval, extra_args = None):
                        self.UpdateConsole.ePopen(cmd, self.IpkgListInstalledCB, callback)
 
        def IpkgListInstalledCB(self, result, retval, extra_args = None):
@@ -344,6 +343,7 @@ class SoftwareTools(DreamInfoHandler):
                                                callback = None
 
        def cleanupSoftwareTools(self):
                                                callback = None
 
        def cleanupSoftwareTools(self):
+               self.list_updating = False
                if self.NotifierCallback is not None:
                        self.NotifierCallback = None
                self.ipkg.stop()
                if self.NotifierCallback is not None:
                        self.NotifierCallback = None
                self.ipkg.stop()
index 480707d07d36bd37cece35ee2d745d667df4a874..4ee9b49832de9267fc327dd0705108c73a10d8f7 100755 (executable)
@@ -809,6 +809,8 @@ class PluginManager(Screen, DreamInfoHandler):
                                name = x[0].strip()
                                details = x[1].strip()
                                description = x[2].strip()
                                name = x[0].strip()
                                details = x[1].strip()
                                description = x[2].strip()
+                               if description == "":
+                                       description = "No description available."
                                packagename = x[3].strip()
                                selectState = self.getSelectionState(details)
                                if iSoftwareTools.installed_packetlist.has_key(packagename):
                                packagename = x[3].strip()
                                selectState = self.getSelectionState(details)
                                if iSoftwareTools.installed_packetlist.has_key(packagename):
@@ -921,17 +923,20 @@ class PluginManager(Screen, DreamInfoHandler):
                        self.close()
 
        def runExecuteFinished(self):
                        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)
-
-       def ExecuteReboot(self, result):
-               if result is None:
-                       return
-               if result is False:
-                       self.reloadPluginlist()
+               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)
+               else:
                        self.selectedFiles = []
                        self.detailsClosed(True)
                        self.selectedFiles = []
                        self.detailsClosed(True)
+
+       def ExecuteReboot(self, result):
                if result:
                        quitMainloop(3)
                if result:
                        quitMainloop(3)
+               else:
+                       self.selectedFiles = []
+                       self.detailsClosed(True)
 
        def reloadPluginlist(self):
                plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
 
        def reloadPluginlist(self):
                plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
@@ -1287,30 +1292,24 @@ class PluginDetails(Screen, DreamInfoHandler):
                        self.session.openWithCallback(self.runUpgradeFinished, Ipkg, cmdList = self.cmdList)
 
        def runUpgradeFinished(self):
                        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)
-
-       def UpgradeReboot(self, result):
-               if result is None:
-                       return
-               if result is False:
+               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)
+               else:
                        self.close(True)
                        self.close(True)
+       def UpgradeReboot(self, result):
                if result:
                        quitMainloop(3)
                if result:
                        quitMainloop(3)
+               else:
+                       self.close(True)
 
        def runRemove(self, result):
                if result:
                        self.session.openWithCallback(self.runRemoveFinished, Ipkg, cmdList = self.cmdList)
 
        def runRemoveFinished(self):
 
        def runRemove(self, result):
                if result:
                        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)
-
-       def RemoveReboot(self, result):
-               if result is None:
-                       return
-               if result is False:
-                       self.close(True)
-               if result:
-                       quitMainloop(3)
+               self.close(True)
 
        def reloadPluginlist(self):
                plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
 
        def reloadPluginlist(self):
                plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
@@ -1884,7 +1883,7 @@ class PacketManager(Screen, NumericalTextInput):
 
                if not self.Console:
                        self.Console = Console()
 
                if not self.Console:
                        self.Console = Console()
-               cmd = "opkg list_installed"
+               cmd = "opkg list-installed"
                self.Console.ePopen(cmd, self.IpkgListInstalled_Finished)
 
        def IpkgListInstalled_Finished(self, result, retval, extra_args = None):
                self.Console.ePopen(cmd, self.IpkgListInstalled_Finished)
 
        def IpkgListInstalled_Finished(self, result, retval, extra_args = None):
@@ -1916,6 +1915,8 @@ class PacketManager(Screen, NumericalTextInput):
        
        def buildEntryComponent(self, name, version, description, state):
                divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
        
        def buildEntryComponent(self, name, version, description, state):
                divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
+               if description == "":
+                       description = "No description available."
                if state == 'installed':
                        installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png"))
                        return((name, version, _(description), state, installedpng, divpng))    
                if state == 'installed':
                        installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png"))
                        return((name, version, _(description), state, installedpng, divpng))