c1104da7b2165924ff91b8f50602479a09d4191e
[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                 self["NetworkHeader"] = StaticText(_("Network:"))
14                 self["Network"] = StaticText(about.getNetworkInfo())
15
16                 self["EnigmaVersion"] = StaticText("Version: " + about.getEnigmaVersionString())
17                 self["ImageVersion"] = StaticText("Image: " + about.getImageVersionString())
18
19                 self["TunerHeader"] = StaticText(_("Detected NIMs:"))
20
21                 fp_version = getFPVersion()
22                 if fp_version is None:
23                         fp_version = ""
24                 else:
25                         fp_version = _("Frontprocessor version: %d") % fp_version
26
27                 self["FPVersion"] = StaticText(fp_version)
28
29                 nims = nimmanager.nimList()
30                 if len(nims) <= 4 :
31                         for count in (0, 1, 2, 3):
32                                 if count < len(nims):
33                                         self["Tuner" + str(count)] = StaticText(nims[count])
34                                 else:
35                                         self["Tuner" + str(count)] = StaticText("")
36                 else:
37                         desc_list = []
38                         count = 0
39                         cur_idx = -1
40                         while count < len(nims):
41                                 data = nims[count].split(":")
42                                 idx = data[0].strip('Tuner').strip()
43                                 desc = data[1].strip()
44                                 if desc_list and desc_list[cur_idx]['desc'] == desc:
45                                         desc_list[cur_idx]['end'] = idx
46                                 else:
47                                         desc_list.append({'desc' : desc, 'start' : idx, 'end' : idx})
48                                         cur_idx += 1
49                                 count += 1
50
51                         for count in (0, 1, 2, 3):
52                                 if count < len(desc_list):
53                                         if desc_list[count]['start'] == desc_list[count]['end']:
54                                                 text = "Tuner %s: %s" % (desc_list[count]['start'], desc_list[count]['desc'])
55                                         else:
56                                                 text = "Tuner %s-%s: %s" % (desc_list[count]['start'], desc_list[count]['end'], desc_list[count]['desc'])
57                                 else:
58                                         text = ""
59
60                                 self["Tuner" + str(count)] = StaticText(text)
61
62                 self["HDDHeader"] = StaticText(_("Detected HDD:"))
63                 hddlist = harddiskmanager.HDDList()
64                 hdd = hddlist and hddlist[0][1] or None
65                 if hdd is not None and hdd.model() != "":
66                         self["hddA"] = StaticText(_("%s\n(%s, %d MB free)") % (hdd.model(), hdd.capacity(),hdd.free()))
67                 else:
68                         self["hddA"] = StaticText(_("none"))
69
70                 self["actions"] = ActionMap(["SetupActions", "ColorActions"], 
71                         {
72                                 "cancel": self.close,
73                                 "ok": self.close,
74                         })