autotimer: fix help string
[enigma2-plugins.git] / 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.Sources.StaticText import StaticText
14
15 # Configuration
16 from Components.config import config, getConfigListEntry
17
18 class AutoTimerSettings(Screen, ConfigListScreen):
19         skin = """<screen name="AutoTimerSettings" title="AutoTimer Settings" position="center,center" size="565,370">
20                 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
21                 <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
22                 <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" />
23                 <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" />
24                 <widget name="config" position="5,50" size="555,250" scrollbarMode="showOnDemand" />
25                 <ePixmap pixmap="skin_default/div-h.png" position="0,301" zPosition="1" size="565,2" />
26                 <widget source="help" render="Label" position="5,305" size="555,63" font="Regular;21" />
27         </screen>"""
28
29         def __init__(self, session):
30                 Screen.__init__(self, session)
31
32                 # Summary
33                 self.setup_title = _("AutoTimer Settings")
34                 self.onChangedEntry = []
35
36                 ConfigListScreen.__init__(
37                         self,
38                         [
39                                 getConfigListEntry(_("Poll automatically"), config.plugins.autotimer.autopoll, _("Unless this is enabled AutoTimer will NOT automatically look for events matching your AutoTimers but only when you leave the GUI with the green button.")),
40                                 getConfigListEntry(_("Startup delay (in min)"), config.plugins.autotimer.delay, _("This is the delay in minutes that the AutoTimer will wait on initial launch to not delay enigma2 startup time.")),
41                                 getConfigListEntry(_("Poll Interval (in h)"), config.plugins.autotimer.interval, _("This is the delay in hours that the AutoTimer will wait after a search to search the EPG again.")),
42                                 getConfigListEntry(_("Timeout (in min)"), config.plugins.autotimer.timeout, _("This is the duration in minutes that the AutoTimer is allowed to run.")),
43                                 getConfigListEntry(_("Only add timer for next x days"), config.plugins.autotimer.maxdaysinfuture, _("You can control for how many days in the future timers are added. Set this to 0 to disable this feature.")),
44                                 getConfigListEntry(_("Show in extension menu"), config.plugins.autotimer.show_in_extensionsmenu, _("Enable this to be able to access the AutoTimer Overview from within the extension menu.")),
45                                 getConfigListEntry(_("Modify existing timers"), config.plugins.autotimer.refresh, _("This setting controls the behavior when a timer matches a found event.")),
46                                 # TRANSLATORS: the double-percent is intentional and required, please don't make me hunt you down individually
47                                 getConfigListEntry(_("Guess existing timer based on begin/end"), config.plugins.autotimer.try_guessing, _("If this is enabled an existing timer will also be considered recording an event if it records at least 80%% of it.")),
48                                 getConfigListEntry(_("Add similar timer on conflict"), config.plugins.autotimer.addsimilar_on_conflict, _("If a timer conflict occurs, AutoTimer will search outside the timespan for a similar event and add it.")),
49                                 getConfigListEntry(_("Add timer as disabled on conflict"), config.plugins.autotimer.disabled_on_conflict, _("This toggles the behavior on timer conflicts. If an AutoTimer matches an event that conflicts with an existing timer it will not ignore this event but add it disabled.")),
50                                 getConfigListEntry(_("Include \"AutoTimer\" in tags"), config.plugins.autotimer.add_autotimer_to_tags, _("If this is selected, the tag \"AutoTimer\" will be given to timers created by this plugin.")),
51                                 getConfigListEntry(_("Include AutoTimer name in tags"), config.plugins.autotimer.add_name_to_tags, _("If this is selected, the name of the respective AutoTimer will be added as a tag to timers created by this plugin.")),
52                                 getConfigListEntry(_("Show notification on conflicts"), config.plugins.autotimer.notifconflict, _("By enabling this you will be notified about timer conflicts found during automated polling. There is no intelligence involved, so it might bother you about the same conflict over and over.")),
53                                 getConfigListEntry(_("Show notification on similars"), config.plugins.autotimer.notifsimilar, _("By enabling this you will be notified about similar timers added during automated polling. There is no intelligence involved, so it might bother you about the same conflict over and over.")),
54                                 getConfigListEntry(_("Editor for new AutoTimers"), config.plugins.autotimer.editor, _("The editor to be used for new AutoTimers. This can either be the Wizard or the classic editor.")),
55                                 getConfigListEntry(_("Support \"Fast Scan\"?"), config.plugins.autotimer.fastscan, _("When supporting \"Fast Scan\" the service type is ignored. You don't need to enable this unless your Image supports \"Fast Scan\" and you are using it.")),
56                                 getConfigListEntry(_("Skip poll during records"), config.plugins.autotimer.skip_during_records, _("If enabled, the polling will be skipped if the Dreambox is recording.")),
57                                 getConfigListEntry(_("Skip poll during epg refresh"), config.plugins.autotimer.skip_during_epgrefresh, _("If enabled, the polling will be skipped if EPGRefres is currently running.")),
58                         ],
59                         session = session,
60                         on_change = self.changed
61                 )
62                 def selectionChanged():
63                         if self["config"].current:
64                                 self["config"].current[1].onDeselect(self.session)
65                         self["config"].current = self["config"].getCurrent()
66                         if self["config"].current:
67                                 self["config"].current[1].onSelect(self.session)
68                         for x in self["config"].onSelectionChanged:
69                                 x()
70                 self["config"].selectionChanged = selectionChanged
71                 self["config"].onSelectionChanged.append(self.updateHelp)
72
73                 # Initialize widgets
74                 self["key_green"] = StaticText(_("OK"))
75                 self["key_red"] = StaticText(_("Cancel"))
76                 self["help"] = StaticText()
77
78                 # Define Actions
79                 self["actions"] = ActionMap(["SetupActions"],
80                         {
81                                 "cancel": self.keyCancel,
82                                 "save": self.keySave,
83                         }
84                 )
85
86                 # Trigger change
87                 self.changed()
88
89                 self.onLayoutFinish.append(self.setCustomTitle)
90
91         def setCustomTitle(self):
92                 self.setTitle(_("Configure AutoTimer behavior"))
93
94         def updateHelp(self):
95                 cur = self["config"].getCurrent()
96                 if cur:
97                         self["help"].text = cur[2]
98
99         def changed(self):
100                 for x in self.onChangedEntry:
101                         x()
102
103         def getCurrentEntry(self):
104                 return self["config"].getCurrent()[0]
105
106         def getCurrentValue(self):
107                 return str(self["config"].getCurrent()[1].getText())
108
109         def createSummary(self):
110                 return SetupSummary
111