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,
}, -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):
print "pressed", number
self["text"].number(number)
-
class PacketList(MenuList):
def __init__(self, list, enableWrapAround=True):
MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
self.onShown.append(self.setWindowTitle)
self.onLayoutFinish.append(self.rebuildList)
self.onClose.append(self.cleanup)
-
+
def cleanup(self):
self.ipkg.stop()
if self.Console is not None:
for x in result.splitlines():
split = x.split(' - ')
self.packetlist.append([split[0].strip(), split[1].strip(),split[2].strip()])
+ if not self.Console:
+ self.Console = Console()
cmd = "ipkg list_installed"
self.Console.ePopen(cmd, self.IpkgListInstalled_Finished)