1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.Harddisk import harddiskmanager #global harddiskmanager
4 from Components.MenuList import MenuList
5 from Components.Label import Label
6 from Screens.MessageBox import MessageBox
7 from enigma import eTimer
9 class HarddiskWait(Screen):
12 result = self.hdd.initialize()
15 def __init__(self, session, hdd):
16 Screen.__init__(self, session)
18 self["wait"] = Label(_("Initializing Harddisk..."));
20 self.timer.timeout.get().append(self.doInit)
23 class HarddiskSetup(Screen):
24 def __init__(self, session, hdd):
25 Screen.__init__(self, session)
28 self["model"] = Label(_("Model: ") + hdd.model())
29 self["capacity"] = Label(_("Capacity: ") + hdd.capacity())
30 self["bus"] = Label(_("Bus: ") + hdd.bus())
31 self["initialize"] = Label(_("Initialize"))
33 self["actions"] = ActionMap(["OkCancelActions"],
39 self["shortcuts"] = ActionMap(["ShortcutActions"],
41 "red": self.hddInitialize
44 def hddReady(self, result):
45 print "Result: " + str(result)
47 self.session.open(MessageBox, _("Unable to initialize harddisk.\nPlease refer to the user-manual.\nError: ") + str(self.hdd.errorList[0 - result]))
51 def hddInitialize(self):
52 print "this will start the initialize now!"
53 self.session.openWithCallback(self.hddReady, HarddiskWait, self.hdd)
55 class HarddiskSelection(Screen):
56 def __init__(self, session):
57 Screen.__init__(self, session)
59 if harddiskmanager.HDDCount() == 0:
61 tlist.append((_("no HDD found"), 0))
62 self["hddlist"] = MenuList(tlist)
64 self["hddlist"] = MenuList(harddiskmanager.HDDList())
66 self["actions"] = ActionMap(["OkCancelActions"],
68 "ok": self.okbuttonClick ,
72 def okbuttonClick(self):
73 selection = self["hddlist"].getCurrent()
75 self.session.open(HarddiskSetup, selection[1])