- allow custom skin for setup as "StartupToStandbyConfiguration" but fall back to...
[vuplus_dvbapp-plugin] / startuptostandby / src / StartupToStandbyConfiguration.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 StartupToStandbyConfiguration(Screen, ConfigListScreen):
16         """Configuration of Startup To Standby"""
17
18         def __init__(self, session):
19                 Screen.__init__(self, session)
20                 self.skinName = [ "StartupToStandbyConfiguration", "Setup" ]
21
22                 # Summary
23                 self.setup_title = _("StartupToStandby Configuration")
24                 self.onChangedEntry = []
25
26                 # Buttons
27                 self["key_red"] = StaticText(_("Cancel"))
28                 self["key_green"] = StaticText(_("OK"))
29
30                 # Define Actions
31                 self["actions"] = ActionMap(["SetupActions"],
32                         {
33                                 "cancel": self.keyCancel,
34                                 "save": self.keySave,
35                         }
36                 )
37
38                 ConfigListScreen.__init__(
39                         self,
40                         [
41                                 getConfigListEntry(_("Enabled"), config.plugins.startuptostandby.enabled)
42                         ],
43                         session = session,
44                         on_change = self.changed
45                 )
46
47                 # Trigger change
48                 self.changed()
49
50                 self.onLayoutFinish.append(self.layoutFinished)
51
52         def layoutFinished(self):
53                 self.setTitle(self.setup_title)
54
55         def changed(self):
56                 for x in self.onChangedEntry:
57                         x()
58
59         def getCurrentEntry(self):
60                 return self["config"].getCurrent()[0]
61
62         def getCurrentValue(self):
63                 return str(self["config"].getCurrent()[1].getText())
64
65         def createSummary(self):
66                 return SetupSummary
67