a2b3ed4f8500160cee6d1efe0fcee8c68b8906a0
[enigma2.git] / lib / python / Screens / HarddiskSetup.py
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
7 class HarddiskSetup(Screen):
8         def __init__(self, session, hdd):
9                 Screen.__init__(self, session)
10                 self.hdd = hdd
11                 
12                 cap = hdd.capacity() / 1000 * 512 / 1000
13                 capstr = "Capacity: %d.%03d GB" % (cap / 1000, cap % 1000)
14
15                 self["model"] = Label("Model: " + hdd.model())
16                 self["capacity"] = Label(capstr)
17                 
18                 if hdd.index & 1:
19                         busstr = "Slave"
20                 else:   
21                         busstr = "Master"
22                 
23                 self["bus"] = Label("Bus: " + busstr)
24                 self["initialize"] = Label("Initialize")
25
26                 self["actions"] = ActionMap(["OkCancelActions"],
27                 {
28                         "ok": self.close,
29                         "cancel": self.close
30                 })
31                 
32                 self["shortcuts"] = ActionMap(["ShortcutActions"],
33                 {
34                         "red": self.hddInitialize
35                 })
36
37         def hddInitialize(self):
38                 self.hdd.initialize()
39
40 class HarddiskSelection(Screen):
41         def __init__(self, session):
42                 Screen.__init__(self, session)
43
44                 self["hddlist"] = MenuList(harddiskmanager.HDDList())
45                 
46                 self["actions"] = ActionMap(["OkCancelActions"],
47                 {
48                         "ok": self.okbuttonClick ,
49                         "cancel": self.close
50                 })
51
52         def okbuttonClick(self):
53                 selection = self["hddlist"].getCurrent()
54                 self.session.open(HarddiskSetup, selection[1])
55                 print "ok"
56                 pass