From: ghost Date: Sat, 14 Feb 2009 11:01:42 +0000 (+0100) Subject: dont crash when not official-feed.conf found X-Git-Tag: 2.6.0~431^2~7 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/eb23e866b8888b4d7b86e0b5ff45891e12fb04e1 dont crash when not official-feed.conf found --- 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)