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
8 class HarddiskSetup(Screen):
9 def __init__(self, session, hdd):
10 Screen.__init__(self, session)
13 cap = hdd.capacity() / 1000 * 512 / 1000
14 capstr = "Capacity: %d.%03d GB" % (cap / 1000, cap % 1000)
16 self["model"] = Label("Model: " + hdd.model())
17 self["capacity"] = Label(capstr)
26 self["bus"] = Label("Bus: " + busstr)
27 self["initialize"] = Label("Initialize")
29 self["actions"] = ActionMap(["OkCancelActions"],
35 self["shortcuts"] = ActionMap(["ShortcutActions"],
37 "red": self.hddInitialize
40 def hddInitialize(self):
41 if self.hdd.getIndex() == 2: #CF
42 print "not a good idea!"
43 self.session.open(MessageBox, "not a good idea - this will kill our rootfs!")
46 #self.hdd.initialize()
48 class HarddiskSelection(Screen):
49 def __init__(self, session):
50 Screen.__init__(self, session)
52 self["hddlist"] = MenuList(harddiskmanager.HDDList())
54 self["actions"] = ActionMap(["OkCancelActions"],
56 "ok": self.okbuttonClick ,
60 def okbuttonClick(self):
61 selection = self["hddlist"].getCurrent()
62 self.session.open(HarddiskSetup, selection[1])