328d98d92ee0cec885e56338170fe2de16e2ea6a
[vuplus_dvbapp] / lib / python / Screens / About.py
1 from Screen import Screen
2 from Components.ActionMap import ActionMap
3 from Components.Sources.StaticText import StaticText
4 from Components.Harddisk import harddiskmanager
5 from Components.NimManager import nimmanager
6 from Components.About import about
7
8 from Tools.DreamboxHardware import getFPVersion
9
10 class About(Screen):
11         def __init__(self, session):
12                 Screen.__init__(self, session)
13
14                 self["EnigmaVersion"] = StaticText("Version: " + about.getEnigmaVersionString())
15                 self["ImageVersion"] = StaticText("Image: " + about.getImageVersionString())
16
17                 self["TunerHeader"] = StaticText(_("Detected NIMs:"))
18
19                 fp_version = getFPVersion()
20                 if fp_version is None:
21                         fp_version = ""
22                 else:
23                         fp_version = _("Frontprocessor version: %d") % fp_version
24
25                 self["FPVersion"] = StaticText(fp_version)
26
27                 nims = nimmanager.nimList()
28                 if len(nims) <= 4 :
29                         for count in (0, 1, 2, 3):
30                                 if count < len(nims):
31                                         self["Tuner" + str(count)] = StaticText(nims[count])
32                                 else:
33                                         self["Tuner" + str(count)] = StaticText("")
34                 else:
35                         desc_list = []
36                         count = 0
37                         cur_idx = -1
38                         while count < len(nims):
39                                 data = nims[count].split(":")
40                                 idx = data[0].strip('Tuner').strip()
41                                 desc = data[1].strip()
42                                 if desc_list and desc_list[cur_idx]['desc'] == desc:
43                                         desc_list[cur_idx]['end'] = idx
44                                 else:
45                                         desc_list.append({'desc' : desc, 'start' : idx, 'end' : idx})
46                                         cur_idx += 1
47                                 count += 1
48
49                         for count in (0, 1, 2, 3):
50                                 if count < len(desc_list):
51                                         if desc_list[count]['start'] == desc_list[count]['end']:
52                                                 text = "Tuner %s: %s" % (desc_list[count]['start'], desc_list[count]['desc'])
53                                         else:
54                                                 text = "Tuner %s-%s: %s" % (desc_list[count]['start'], desc_list[count]['end'], desc_list[count]['desc'])
55                                 else:
56                                         text = ""
57
58                                 self["Tuner" + str(count)] = StaticText(text)
59
60                 self["HDDHeader"] = StaticText(_("Detected HDD:"))
61                 hddlist = harddiskmanager.HDDList()
62                 hdd = hddlist and hddlist[0][1] or None
63                 if hdd is not None and hdd.model() != "":
64                         self["hddA"] = StaticText(_("%s\n(%s, %d MB free)") % (hdd.model(), hdd.capacity(),hdd.free()))
65                 else:
66                         self["hddA"] = StaticText(_("none"))
67
68                 self["actions"] = ActionMap(["SetupActions", "ColorActions"], 
69                         {
70                                 "cancel": self.close,
71                                 "ok": self.close,
72                         })