typo fix
[enigma2-plugins.git] / movieepg / src / MovieEpgSetup.py
1 # GUI (Screens)
2 from Screens.Screen import Screen
3 from Components.ConfigList import ConfigListScreen
4
5 # GUI (Summary)
6 from Screens.Setup import SetupSummary
7
8 # GUI (Components)
9 from Components.ActionMap import ActionMap
10 from Components.Sources.StaticText import StaticText
11
12 # Configuration
13 from Components.config import config, getConfigListEntry
14
15 class MovieEpgSetup(Screen, ConfigListScreen):
16         skin = """<screen name="MovieEpgSetup" position="center,center" size="565,370">
17                 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
18                 <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
19                 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
20                 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
21                 <widget name="config" position="5,50" size="555,250" scrollbarMode="showOnDemand" />
22                 <ePixmap pixmap="skin_default/div-h.png" position="0,301" zPosition="1" size="565,2" />
23                 <widget source="help" render="Label" position="5,305" size="555,63" font="Regular;21" />
24         </screen>"""
25
26         def __init__(self, session):
27                 Screen.__init__(self, session)
28
29                 # Summary
30                 self.setup_title = _("Movie-EPG Configuration")
31                 self.onChangedEntry = []
32
33                 ConfigListScreen.__init__(
34                         self,
35                         [
36                                 getConfigListEntry(_("Show \"EPG\" entry"), config.plugins.movieepg.show_epg_entry, _("Configures where to show the \"EPG\"-Entry in the Extensions-List. You can either show this just in the movie player, the movie player and TV-mode or never.")),
37                                 getConfigListEntry(_("Show all Plugins in MoviePlayer?"), config.plugins.movieepg.show_servicelist_plugins_in_movieplayer, _("Enables you to show all plugins in the (regular) movie player, including ones which may have previously been hidden there like the Graphical Multi-EPG.")),
38                         ],
39                         session = session,
40                         on_change = self.changed
41                 )
42                 def selectionChanged():
43                         if self["config"].current:
44                                 self["config"].current[1].onDeselect(self.session)
45                         self["config"].current = self["config"].getCurrent()
46                         if self["config"].current:
47                                 self["config"].current[1].onSelect(self.session)
48                         for x in self["config"].onSelectionChanged:
49                                 x()
50                 self["config"].selectionChanged = selectionChanged
51                 self["config"].onSelectionChanged.append(self.updateHelp)
52
53                 # Initialize widgets
54                 self["key_green"] = StaticText(_("OK"))
55                 self["key_red"] = StaticText(_("Cancel"))
56                 self["help"] = StaticText()
57
58                 # Define Actions
59                 self["actions"] = ActionMap(["SetupActions"],
60                         {
61                                 "cancel": self.keyCancel,
62                                 "save": self.keySave,
63                         }
64                 )
65
66                 # Trigger change
67                 self.changed()
68
69                 self.onLayoutFinish.append(self.setCustomTitle)
70
71         def setCustomTitle(self):
72                 self.setTitle(_("Movie-EPG Configuration"))
73
74         def updateHelp(self):
75                 cur = self["config"].getCurrent()
76                 if cur:
77                         self["help"].text = cur[2]
78
79         def changed(self):
80                 for x in self.onChangedEntry:
81                         x()
82
83         def getCurrentEntry(self):
84                 return self["config"].getCurrent()[0]
85
86         def getCurrentValue(self):
87                 return str(self["config"].getCurrent()[1].getText())
88
89         def createSummary(self):
90                 return SetupSummary
91