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 Components.Pixmap import Pixmap
7 from Screens.MessageBox import MessageBox
8 from enigma import eTimer
10 class HarddiskWait(Screen):
13 result = self.hdd.initialize()
16 def __init__(self, session, hdd):
17 Screen.__init__(self, session)
19 self["wait"] = Label(_("Initializing Harddisk..."));
21 self.timer.timeout.get().append(self.doInit)
24 class HarddiskSetup(Screen):
25 def __init__(self, session, hdd):
26 Screen.__init__(self, session)
29 self["model"] = Label(_("Model: ") + hdd.model())
30 self["capacity"] = Label(_("Capacity: ") + hdd.capacity())
31 self["bus"] = Label(_("Bus: ") + hdd.bus())
32 self["initialize"] = Pixmap()
33 self["initializetext"] = Label(_("Initialize"))
35 self["actions"] = ActionMap(["OkCancelActions"],
41 self["shortcuts"] = ActionMap(["ShortcutActions"],
43 "red": self.hddInitialize
46 def hddReady(self, result):
47 print "Result: " + str(result)
49 self.session.open(MessageBox, _("Unable to initialize harddisk.\nPlease refer to the user manual.\nError: ") + str(self.hdd.errorList[0 - result]), MessageBox.TYPE_ERROR)
53 def hddInitialize(self):
54 print "this will start the initialize now!"
55 self.session.openWithCallback(self.hddReady, HarddiskWait, self.hdd)
57 class HarddiskSelection(Screen):
58 def __init__(self, session):
59 Screen.__init__(self, session)
61 if harddiskmanager.HDDCount() == 0:
63 tlist.append((_("no HDD found"), 0))
64 self["hddlist"] = MenuList(tlist)
66 self["hddlist"] = MenuList(harddiskmanager.HDDList())
68 self["actions"] = ActionMap(["OkCancelActions"],
70 "ok": self.okbuttonClick ,
74 def okbuttonClick(self):
75 selection = self["hddlist"].getCurrent()
77 self.session.open(HarddiskSetup, selection[1])