use setup skin in autotimersettings
[vuplus_dvbapp-plugin] / autotimer / src / AutoTimerSettings.py
1 # for localized messages
2 from . import _
3
4 # GUI (Screens)
5 from Screens.Screen import Screen
6 from Components.ConfigList import ConfigListScreen
7
8 # GUI (Summary)
9 from Screens.Setup import SetupSummary
10
11 # GUI (Components)
12 from Components.ActionMap import ActionMap
13 from Components.Label import Label
14 from Components.Pixmap import Pixmap
15
16 # Configuration
17 from Components.config import config, getConfigListEntry
18
19 class AutoTimerSettings(Screen, ConfigListScreen):
20         def __init__(self, session):
21                 Screen.__init__(self, session)
22                 self.skinName = "Setup"
23
24                 # Summary
25                 self.setup_title = _("AutoTimer Settings")
26                 self.onChangedEntry = []
27
28                 ConfigListScreen.__init__(
29                         self,
30                         [
31                                 getConfigListEntry(_("Poll automatically"), config.plugins.autotimer.autopoll),
32                                 getConfigListEntry(_("Poll Interval (in h)"), config.plugins.autotimer.interval),
33                                 getConfigListEntry(_("Show in Extensionmenu"), config.plugins.autotimer.show_in_extensionsmenu),
34                                 getConfigListEntry(_("Modify existing Timers"), config.plugins.autotimer.refresh),
35                                 getConfigListEntry(_("Guess existing Timer based on Begin/End"), config.plugins.autotimer.try_guessing),
36                                 getConfigListEntry(_("Add timer as disabled on conflict"), config.plugins.autotimer.disabled_on_conflict),
37                                 getConfigListEntry(_("Editor for new AutoTimers"), config.plugins.autotimer.editor),
38                         ],
39                         session = session,
40                         on_change = self.changed
41                 )
42
43                 # Initialize widgets
44                 self["oktext"] = Label(_("OK"))
45                 self["canceltext"] = Label(_("Cancel"))
46                 self["ok"] = Pixmap()
47                 self["cancel"] = Pixmap()
48                 self["title"] = Label(_("AutoTimer Settings"))
49
50                 # Define Actions
51                 self["actions"] = ActionMap(["SetupActions"],
52                         {
53                                 "cancel": self.keyCancel,
54                                 "save": self.keySave,
55                         }
56                 )
57
58                 # Trigger change
59                 self.changed()
60
61                 self.onLayoutFinish.append(self.setCustomTitle)
62
63         def setCustomTitle(self):
64                 self.setTitle(_("Configure AutoTimer behavior"))
65
66         def changed(self):
67                 for x in self.onChangedEntry:
68                         try:
69                                 x()
70                         except:
71                                 pass
72
73         def getCurrentEntry(self):
74                 return self["config"].getCurrent()[0]
75
76         def getCurrentValue(self):
77                 return str(self["config"].getCurrent()[1].getText())
78
79         def createSummary(self):
80                 return SetupSummary
81