even say something if no hdd is present
[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 from Screens.MessageBox import MessageBox
7
8 class HarddiskSetup(Screen):
9         def __init__(self, session, hdd):
10                 Screen.__init__(self, session)
11                 self.hdd = hdd
12                 
13                 self["model"] = Label("Model: " + hdd.model())
14                 self["capacity"] = Label("Capacity: " + hdd.capacity())
15                 self["bus"] = Label("Bus: " + hdd.bus())
16                 self["initialize"] = Label("Initialize")
17
18                 self["actions"] = ActionMap(["OkCancelActions"],
19                 {
20                         "ok": self.close,
21                         "cancel": self.close
22                 })
23                 
24                 self["shortcuts"] = ActionMap(["ShortcutActions"],
25                 {
26                         "red": self.hddInitialize
27                 })
28
29         def hddInitialize(self):
30                 print "this will start the initialize now!"
31                 self.hdd.initialize()
32
33 class HarddiskSelection(Screen):
34         def __init__(self, session):
35                 Screen.__init__(self, session)
36                 
37                 if harddiskmanager.HDDCount() == 0:
38                         tlist = []
39                         tlist.append(("no HDD found", 0))
40                         self["hddlist"] = MenuList(tlist)
41                 else:                   
42                         self["hddlist"] = MenuList(harddiskmanager.HDDList())
43                 
44                 self["actions"] = ActionMap(["OkCancelActions"],
45                 {
46                         "ok": self.okbuttonClick ,
47                         "cancel": self.close
48                 })
49
50         def okbuttonClick(self):
51                 selection = self["hddlist"].getCurrent()
52                 if selection[1] != 0:
53                         self.session.open(HarddiskSetup, selection[1])