preliminary translator about screen - can be displayed by pressing 'green' in about...
[enigma2.git] / 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.Sources.Source import ObsoleteSource
5 from Components.Harddisk import Harddisk
6 from Components.NimManager import nimmanager
7 from Components.About import about
8
9 from Tools.DreamboxHardware import getFPVersion
10
11 class About(Screen):
12         def __init__(self, session):
13                 Screen.__init__(self, session)
14
15                 self["EnigmaVersion"] = StaticText("Enigma: " + about.getEnigmaVersionString())
16                 self["ImageVersion"] = StaticText("Image: " + about.getImageVersionString())
17
18                 self["TunerHeader"] = StaticText(_("Detected NIMs:"))
19
20                 fp_version = getFPVersion()
21                 if fp_version is None:
22                         fp_version = ""
23                 else:
24                         fp_version = _("Frontprocessor version: %d") % fp_version
25
26                 self["FPVersion"] = StaticText(fp_version)
27
28                 nims = nimmanager.nimList()
29                 for count in range(4):
30                         if count < len(nims):
31                                 self["Tuner" + str(count)] = StaticText(nims[count])
32                         else:
33                                 self["Tuner" + str(count)] = StaticText("")
34
35                 self["HDDHeader"] = StaticText(_("Detected HDD:"))
36                 hdd = Harddisk(0)
37                 if hdd.model() != "":
38                         self["hddA"] = StaticText(_("%s\n(%s, %d MB free)") % (hdd.model(), hdd.capacity(),hdd.free()))
39                 else:                   
40                         self["hddA"] = StaticText(_("none"))
41
42                 self["actions"] = ActionMap(["SetupActions", "ColorActions"], 
43                         {
44                                 "cancel": self.close,
45                                 "ok": self.close,
46                                 "green": self.showTranslationInfo
47                         })
48
49         def showTranslationInfo(self):
50                 self.session.open(TranslationInfo)
51
52 class TranslationInfo(Screen):
53         def __init__(self, session):
54                 Screen.__init__(self, session)
55                 # don't remove the string out of the _(), or it can't be "translated" anymore.
56
57                 # TRANSLATORS: Add here whatever should be shown in the "translator" about screen, up to 6 lines (use \n for newline)
58                 info = _("TRANSLATOR_INFO")
59
60                 if info == "TRANSLATOR_INFO":
61                         info = "(N/A)"
62
63                 infolines = _("").split("\n")
64                 infomap = {}
65                 for x in infolines:
66                         l = x.split(': ')
67                         if len(l) != 2:
68                                 continue
69                         (type, value) = l
70                         infomap[type] = value
71                 print infomap
72
73                 self["TranslationInfo"] = StaticText(info)
74
75                 translator_name = infomap.get("Language-Team", "none")
76                 if translator_name == "none":
77                         translator_name = infomap.get("Last-Translator", "")
78
79                 self["TranslatorName"] = StaticText(translator_name)
80
81                 self["actions"] = ActionMap(["SetupActions"], 
82                         {
83                                 "cancel": self.close,
84                                 "ok": self.close,
85                         })