From 7b0d371a7bbfb9e8d624eec9ed97e9a835f75ca7 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Mon, 29 Oct 2007 16:01:37 +0000 Subject: [PATCH] some ipkg changes.. (done by ritzmo) --- lib/python/Components/Ipkg.py | 10 ++++++++++ .../Plugins/SystemPlugins/SoftwareUpdate/plugin.py | 11 ++++++++++- lib/python/Screens/Ipkg.py | 12 +++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/lib/python/Components/Ipkg.py b/lib/python/Components/Ipkg.py index dbc99653..eac26428 100644 --- a/lib/python/Components/Ipkg.py +++ b/lib/python/Components/Ipkg.py @@ -10,6 +10,7 @@ class IpkgComponent: EVENT_LISTITEM = 9 EVENT_DONE = 10 EVENT_ERROR = 11 + EVENT_MODIFIED = 12 CMD_INSTALL = 0 CMD_LIST = 1 @@ -95,6 +96,9 @@ class IpkgComponent: self.callCallbacks(self.EVENT_ERROR, None) elif data.find('ipkg_download: ERROR:') == 0: self.callCallbacks(self.EVENT_ERROR, None) + elif data.find(' Configuration file') == 0: + self.callCallbacks(self.EVENT_MODIFIED, data.split(' \'', 1)[1][:-1]) + def callCallbacks(self, event, param = None): for callback in self.callbackList: callback(event, param) @@ -110,3 +114,9 @@ class IpkgComponent: def isRunning(self): return self.cmd.running() + + def write(self, what): + if what: + # We except unterminated commands + what += "\n" + self.cmd.write(what, len(what)) diff --git a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py index 505b0cdd..c283dd04 100644 --- a/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareUpdate/plugin.py @@ -290,6 +290,12 @@ class UpdatePlugin(Screen): 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) + ) elif event == IpkgComponent.EVENT_ERROR: self.error += 1 elif event == IpkgComponent.EVENT_DONE: @@ -315,7 +321,10 @@ class UpdatePlugin(Screen): self.status.setText(_("Error") + " - " + error) #print event, "-", param pass - + + def modificationCallback(self, res): + self.ipkg.write(res and "N" or "Y") + def exit(self): if not self.ipkg.isRunning(): if self.packages != 0 and self.error == 0: diff --git a/lib/python/Screens/Ipkg.py b/lib/python/Screens/Ipkg.py index 07a7eca4..216cf8c8 100644 --- a/lib/python/Screens/Ipkg.py +++ b/lib/python/Screens/Ipkg.py @@ -3,6 +3,7 @@ from Components.Ipkg import IpkgComponent from Components.Label import Label from Components.Slider import Slider from Screens.Screen import Screen +from Screens.MessageBox import MessageBox from enigma import eTimer class Ipkg(Screen): @@ -96,7 +97,16 @@ class Ipkg(Screen): self.error += 1 elif event == IpkgComponent.EVENT_DONE: self.runNextCmd() - + 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) + ) + + def modificationCallback(self, res): + self.ipkg.write(res and "N" or "Y") + def exit(self): if not self.ipkg.isRunning(): self.close() -- 2.30.2