From eb23e866b8888b4d7b86e0b5ff45891e12fb04e1 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 14 Feb 2009 12:01:42 +0100 Subject: [PATCH] dont crash when not official-feed.conf found --- .../SystemPlugins/SoftwareManager/plugin.py | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 81e1e9f9..a8654895 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -231,13 +231,20 @@ class IPKGSource(Screen): def __init__(self, session, args = None): Screen.__init__(self, session) self.session = session - - fp = file('/etc/ipkg/official-feed.conf', 'r') - sources = fp.readlines() - fp.close() - - self["text"] = Input(sources[0], maxSize=False, type=Input.TEXT) - + + #FIXMEEEE add handling for more than one feed conf file! + text = "" + try: + fp = file('/etc/ipkg/official-feed.conf', 'r') + sources = fp.readlines() + if sources: + text = sources[0] + fp.close() + except IOError: + pass + + self["text"] = Input(text, maxSize=False, type=Input.TEXT) + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"], { "ok": self.go, @@ -261,9 +268,11 @@ class IPKGSource(Screen): }, -1) def go(self): - fp = file('/etc/ipkg/official-feed.conf', 'w') - fp.write(self["text"].getText()) - fp.close() + text = self["text"].getText() + if text: + fp = file('/etc/ipkg/official-feed.conf', 'w') + fp.write() + fp.close() self.close() def keyLeft(self): @@ -288,7 +297,6 @@ class IPKGSource(Screen): print "pressed", number self["text"].number(number) - class PacketList(MenuList): def __init__(self, list, enableWrapAround=True): MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) -- 2.30.2