From 89e103f1ff262950613b761fcb370f8ab7267ee8 Mon Sep 17 00:00:00 2001 From: acid-burn Date: Mon, 7 Feb 2011 14:34:11 +0100 Subject: [PATCH] SoftwareManager: ask for restart after installation inside pluginmanager only if a restart is required. refs #670 --- .../SoftwareManager/SoftwareTools.py | 4 +- .../SystemPlugins/SoftwareManager/plugin.py | 47 ++++++++++--------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index 8b8fc97c..87f0a4d6 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -264,13 +264,12 @@ class SoftwareTools(DreamInfoHandler): 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() - cmd = "opkg list_installed" + cmd = "opkg list-installed" 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): + self.list_updating = False if self.NotifierCallback is not None: self.NotifierCallback = None self.ipkg.stop() diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 480707d0..4ee9b498 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -809,6 +809,8 @@ class PluginManager(Screen, DreamInfoHandler): 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): @@ -921,17 +923,20 @@ 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) - - 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) + + def ExecuteReboot(self, result): if result: quitMainloop(3) + else: + self.selectedFiles = [] + self.detailsClosed(True) 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.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) + def UpgradeReboot(self, result): 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): - 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)) @@ -1884,7 +1883,7 @@ class PacketManager(Screen, NumericalTextInput): 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): @@ -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")) + 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)) -- 2.30.2