AutoPoller.py: fix missing import
[vuplus_dvbapp-plugin] / autotimer / src / AutoTimerEditor.py
index 27294cc..0d623de 100644 (file)
@@ -350,16 +350,18 @@ class AutoTimerEditorBase:
 class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
        """Edit AutoTimer"""
 
-       skin = """<screen name="AutoTimerEditor" title="Edit AutoTimer" position="center,center" size="565,280">
-               <widget name="config" position="5,5" size="555,225" scrollbarMode="showOnDemand" />
-               <ePixmap position="0,235" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
-               <ePixmap position="140,235" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
-               <ePixmap position="280,235" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
-               <ePixmap position="420,235" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
-               <widget source="key_red" render="Label" position="0,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_green" render="Label" position="140,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_yellow" render="Label" position="280,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_blue" render="Label" position="420,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+       skin = """<screen name="AutoTimerEditor" title="Edit AutoTimer" position="center,center" size="565,350">
+               <ePixmap position="0,5" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+               <ePixmap position="140,5" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+               <ePixmap position="280,5" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
+               <ePixmap position="420,5" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
+               <widget source="key_red" render="Label" position="0,5" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_green" render="Label" position="140,5" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_yellow" render="Label" position="280,5" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_blue" render="Label" position="420,5" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget name="config" position="5,50" size="555,225" scrollbarMode="showOnDemand" />
+               <ePixmap pixmap="skin_default/div-h.png" position="0,275" zPosition="1" size="565,2" />
+               <widget source="help" render="Label" position="5,280" size="555,63" font="Regular;21" />
        </screen>"""
 
        def __init__(self, session, timer, editingDefaults = False):
@@ -381,8 +383,11 @@ class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
                self.useDestination.addNotifier(self.reloadList, initial_call = False)
 
                self.refresh()
+               self.initHelpTexts()
 
-               ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changed)
+               # XXX: no help for numericaltextinput since it is shown on top of our help
+               ConfigListScreen.__init__(self, self.list, on_change = self.changed)
+               self["config"].onSelectionChanged.append(self.updateHelp)
 
                # Initialize Buttons
                self["key_red"] = StaticText(_("Cancel"))
@@ -390,6 +395,8 @@ class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
                self["key_yellow"] = StaticText()
                self["key_blue"] = StaticText()
 
+               self["help"] = StaticText()
+
                # Set Button texts
                self.renameServiceButton()
                self.renameFilterButton()
@@ -415,15 +422,20 @@ class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
 
        def renameFilterButton(self):
                if self.filterSet:
-                       self["key_yellow"].setText(_("Edit Filters"))
+                       self["key_yellow"].text = _("edit filters")
                else:
-                       self["key_yellow"].setText(_("Add Filters"))
+                       self["key_yellow"].text = _("add filters")
 
        def renameServiceButton(self):
                if self.serviceRestriction:
-                       self["key_blue"].setText(_("Edit Services"))
+                       self["key_blue"].text = _("edit services")
                else:
-                       self["key_blue"].setText(_("Add Services"))
+                       self["key_blue"].text = _("add services")
+
+       def updateHelp(self):
+               cur = self["config"].getCurrent()
+               if cur:
+                       self["help"].text = self.helpDict[cur[1]]
 
        def changed(self):
                for x in self.onChangedEntry:
@@ -441,6 +453,37 @@ class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
        def createSummary(self):
                return SetupSummary
 
+       def initHelpTexts(self):
+               self.helpDict = {
+                       self.enabled: _("Set this NO to disable this AutoTimer."),
+                       self.name: _("This is a name you can give the AutoTimer. It will be shown in the Overview and the Preview."),
+                       self.match: _("This is what will be looked for in event titles. Note that looking for e.g. german umlauts can be tricky as you have to know the encoding the channel uses."),
+                       self.encoding: _("Encoding the channel uses for it's EPG data. You only need to change this if you're searching for special characters like the german umlauts."),
+                       self.searchType: _("Select \"exact match\" to enforce \"Match title\" to match exactly or \"partial match\" if you only want to search for a part of the event title."),
+                       self.searchCase: _("Select whether or not you want to enforce case correctness."),
+                       self.justplay: _("Add zap timer instead of record timer?"),
+                       self.overrideAlternatives: _("With this option enabled the channel to record on can be changed to a alternative service it is restricted to."),
+                       self.timespan: _("Should this AutoTimer be restricted to a timespan?"),
+                       self.timespanbegin: _("Lower bound of timespan. Nothing before this time will be matched. Offsets are not taken into account!"),
+                       self.timespanend: _("Upper bound of timespan. Nothing after this time will be matched. Offsets are not taken into account!"),
+                       self.offset: _("Change default recording offset?"),
+                       self.offsetbegin: _("Time in minutes to prepend to recording."),
+                       self.offsetend: _("Time in minutes to append to recording."),
+                       self.duration: _("Should this AutoTimer only match up to a certain event duration?"),
+                       self.durationlength: _("Maximum event duration to match. If an event is longer than this ammount of time (without offset) it won't be matched."),
+                       self.afterevent: _("Power state to change to after recordings. Select \"standard\" to not change the default behavior of enigma2 or values changed by yourself."),
+                       self.afterevent_timespan: _("Restrict \"after event\" to a certain timespan?"),
+                       self.afterevent_timespanbegin: _("Lower bound of timespan."),
+                       self.afterevent_timespanend: _("Upper bound of timespan."),
+                       self.counter: _("With this option you can restrict the AutoTimer to a certain ammount of scheduled recordings. Set this to 0 to disable this functionality."),
+                       self.counterLeft: _("Number of scheduled recordings left."),
+                       self.counterFormatString: _("The counter can automatically be reset to the limit at certain intervals."),
+                       self.avoidDuplicateDescription: _("When this option is enabled the AutoTimer won't match events where another timer with the same description already exists in the timer list."),
+                       self.useDestination: _("Should timers created by this AutoTimer be recorded to a custom location?"),
+                       self.destination: _("Select the location to save the recording to."),
+                       self.tags: _("Tags the Timer/Recording will have."),
+               }
+
        def refresh(self):
                # First three entries are only showed when not editing defaults
                list = []
@@ -448,23 +491,23 @@ class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
                        list.extend((
                                getConfigListEntry(_("Enabled"), self.enabled),
                                getConfigListEntry(_("Description"), self.name),
-                               getConfigListEntry(_("Match Title"), self.match),
+                               getConfigListEntry(_("Match title"), self.match),
                        ))
 
                list.extend((
-                       getConfigListEntry(_("EPG Encoding"), self.encoding),
-                       getConfigListEntry(_("Search Type"), self.searchType),
+                       getConfigListEntry(_("EPG encoding"), self.encoding),
+                       getConfigListEntry(_("Search type"), self.searchType),
                        getConfigListEntry(_("Search strictness"), self.searchCase),
-                       getConfigListEntry(_("Timer Type"), self.justplay),
-                       getConfigListEntry(_("Override found with alternative Service"), self.overrideAlternatives),
-                       getConfigListEntry(_("Only match during Timespan"), self.timespan)
+                       getConfigListEntry(_("Timer type"), self.justplay),
+                       getConfigListEntry(_("Override found with alternative service"), self.overrideAlternatives),
+                       getConfigListEntry(_("Only match during timespan"), self.timespan)
                ))
 
                # Only allow editing timespan when it's enabled
                if self.timespan.value:
                        list.extend((
-                               getConfigListEntry(_("Begin of Timespan"), self.timespanbegin),
-                               getConfigListEntry(_("End of Timespan"), self.timespanend)
+                               getConfigListEntry(_("Begin of timespan"), self.timespanbegin),
+                               getConfigListEntry(_("End of timespan"), self.timespanend)
                        ))
 
                list.append(getConfigListEntry(_("Custom offset"), self.offset))
@@ -476,23 +519,23 @@ class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
                                getConfigListEntry(_("Offset after recording (in m)"), self.offsetend)
                        ))
 
-               list.append(getConfigListEntry(_("Set maximum Duration"), self.duration))
+               list.append(getConfigListEntry(_("Set maximum duration"), self.duration))
 
                # Only allow editing maxduration when it's enabled
                if self.duration.value:
-                       list.append(getConfigListEntry(_("Maximum Duration (in m)"), self.durationlength))
+                       list.append(getConfigListEntry(_("Maximum duration (in m)"), self.durationlength))
 
                list.append(getConfigListEntry(_("After event"), self.afterevent))
 
                # Only allow setting afterevent timespan when afterevent is active
                if self.afterevent.value != "default":
-                       list.append(getConfigListEntry(_("Execute after Event during Timespan"), self.afterevent_timespan))
+                       list.append(getConfigListEntry(_("Execute \"after event\" during timespan"), self.afterevent_timespan))
 
                        # Only allow editing timespan when it's enabled
                        if self.afterevent_timespan.value:
                                list.extend((
-                                       getConfigListEntry(_("Begin of after Event Timespan"), self.afterevent_timespanbegin),
-                                       getConfigListEntry(_("End of after Event Timespan"), self.afterevent_timespanend)
+                                       getConfigListEntry(_("Begin of \"after event\" timespan"), self.afterevent_timespanbegin),
+                                       getConfigListEntry(_("End of \"after event\" timespan"), self.afterevent_timespanend)
                                ))
 
                list.append(getConfigListEntry(_("Record a maximum of x times"), self.counter))
@@ -501,14 +544,14 @@ class AutoTimerEditor(Screen, ConfigListScreen, AutoTimerEditorBase):
                if self.counter.value:
                        if not self.editingDefaults:
                                list.append(getConfigListEntry(_("Ammount of recordings left"), self.counterLeft))
-                       list.append(getConfigListEntry(_("Reset Count"), self.counterFormatString))
+                       list.append(getConfigListEntry(_("Reset count"), self.counterFormatString))
 
-               list.append(getConfigListEntry(_("Require Description to be unique"), self.avoidDuplicateDescription))
+               list.append(getConfigListEntry(_("Require description to be unique"), self.avoidDuplicateDescription))
 
                # We always add this option though its expert only in enigma2
                list.append(getConfigListEntry(_("Use a custom location"), self.useDestination))
                if self.useDestination.value:
-                       list.append(getConfigListEntry(_("Custom Location"), self.destination))
+                       list.append(getConfigListEntry(_("Custom location"), self.destination))
 
                list.append(getConfigListEntry(_("Tags"), self.tags))
 
@@ -729,15 +772,15 @@ class AutoTimerFilterEditor(Screen, ConfigListScreen):
        """Edit AutoTimer Filter"""
 
        skin = """<screen name="AutoTimerFilterEditor" title="Edit AutoTimer Filters" position="center,center" size="565,280">
-               <widget name="config" position="5,5" size="555,225" scrollbarMode="showOnDemand" />
-               <ePixmap position="0,235" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
-               <ePixmap position="140,235" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
-               <ePixmap position="280,235" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
-               <ePixmap position="420,235" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
-               <widget source="key_red" render="Label" position="0,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_green" render="Label" position="140,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_yellow" render="Label" position="280,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_blue" render="Label" position="420,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <ePixmap position="0,0" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+               <ePixmap position="140,0" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+               <ePixmap position="280,0" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
+               <ePixmap position="420,0" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
+               <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget name="config" position="5,45" size="555,225" scrollbarMode="showOnDemand" />
        </screen>"""
 
        def __init__(self, session, filterset, excludes, includes):
@@ -786,7 +829,7 @@ class AutoTimerFilterEditor(Screen, ConfigListScreen):
                self.onLayoutFinish.append(self.setCustomTitle)
 
        def setCustomTitle(self):
-               self.setTitle(_("Edit AutoTimer Filters"))
+               self.setTitle(_("Edit AutoTimer filters"))
 
 
        def changed(self):
@@ -933,15 +976,15 @@ class AutoTimerServiceEditor(Screen, ConfigListScreen):
        """Edit allowed Services of a AutoTimer"""
 
        skin = """<screen name="AutoTimerServiceEditor" title="Edit AutoTimer Services" position="center,center" size="565,280">
-               <widget name="config" position="5,5" size="555,225" scrollbarMode="showOnDemand" />
-               <ePixmap position="0,235" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
-               <ePixmap position="140,235" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
-               <ePixmap position="280,235" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
-               <ePixmap position="420,235" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
-               <widget source="key_red" render="Label" position="0,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_green" render="Label" position="140,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_yellow" render="Label" position="280,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
-               <widget source="key_blue" render="Label" position="420,235" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <ePixmap position="0,0" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
+               <ePixmap position="140,0" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
+               <ePixmap position="280,0" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
+               <ePixmap position="420,0" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
+               <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
+               <widget name="config" position="5,45" size="555,225" scrollbarMode="showOnDemand" />
        </screen>"""
 
        def __init__(self, session, servicerestriction, servicelist, bouquetlist):
@@ -989,7 +1032,7 @@ class AutoTimerServiceEditor(Screen, ConfigListScreen):
                self.onLayoutFinish.append(self.setCustomTitle)
 
        def setCustomTitle(self):
-               self.setTitle(_("Edit AutoTimer Services"))
+               self.setTitle(_("Edit AutoTimer services"))
 
        def saveCurrent(self):
                del self.services[self.idx][:]
@@ -1069,7 +1112,7 @@ class AutoTimerServiceEditor(Screen, ConfigListScreen):
                                # strip all after last : when adding a (non alternative) channel
                                pos = sname.rfind(':')
                                if pos != -1:
-                                       if sname[pos-1] == ':'
+                                       if sname[pos-1] == ':':
                                                pos -= 1
                                        sname = sname[:pos+1]
 
@@ -1099,7 +1142,7 @@ class AutoTimerServiceEditor(Screen, ConfigListScreen):
                ))
 
 def addAutotimerFromSearchString(session, match):
-       from AutoTimerComponent import AutoTimerComponent
+       from AutoTimerComponent import preferredAutoTimerComponent
        from AutoTimerImporter import AutoTimerImporter
        from plugin import autotimer
 
@@ -1112,7 +1155,7 @@ def addAutotimerFromSearchString(session, match):
        session.openWithCallback(
                importerCallback,
                AutoTimerImporter,
-               AutoTimerComponent(
+               preferredAutoTimerComponent(
                        autotimer.getUniqueId(),
                        match,
                        '',             # Match
@@ -1130,7 +1173,7 @@ def addAutotimerFromSearchString(session, match):
        )
 
 def addAutotimerFromEvent(session, evt = None, service = None):
-       from AutoTimerComponent import AutoTimerComponent
+       from AutoTimerComponent import preferredAutoTimerComponent
        from AutoTimerImporter import AutoTimerImporter
        from plugin import autotimer
 
@@ -1150,7 +1193,7 @@ def addAutotimerFromEvent(session, evt = None, service = None):
                        # strip all after last :
                        pos = service.rfind(':')
                        if pos != -1:
-                               if service[pos-1] == ':'
+                               if service[pos-1] == ':':
                                        pos -= 1
                                service = service[:pos+1]
 
@@ -1167,7 +1210,7 @@ def addAutotimerFromEvent(session, evt = None, service = None):
        session.openWithCallback(
                importerCallback,
                AutoTimerImporter,
-               AutoTimerComponent(
+               preferredAutoTimerComponent(
                        autotimer.getUniqueId(),
                        name,
                        '',             # Match
@@ -1185,7 +1228,7 @@ def addAutotimerFromEvent(session, evt = None, service = None):
        )
 
 def addAutotimerFromService(session, service = None):
-       from AutoTimerComponent import AutoTimerComponent
+       from AutoTimerComponent import preferredAutoTimerComponent
        from AutoTimerImporter import AutoTimerImporter
        from plugin import autotimer
 
@@ -1205,7 +1248,7 @@ def addAutotimerFromService(session, service = None):
                # strip all after last :
                pos = sref.rfind(':')
                if pos != -1:
-                       if sref[pos-1] == ':'
+                       if sref[pos-1] == ':':
                                pos -= 1
                        sref = sref[:pos+1]
 
@@ -1229,7 +1272,7 @@ def addAutotimerFromService(session, service = None):
        session.openWithCallback(
                importerCallback,
                AutoTimerImporter,
-               AutoTimerComponent(
+               preferredAutoTimerComponent(
                        autotimer.getUniqueId(),
                        name,
                        '',             # Match