AutoTimer: add "Fast Scan" support
[vuplus_dvbapp-plugin] / autotimer / src / AutoTimerWizard.py
index 1631ed0..033f059 100755 (executable)
@@ -9,6 +9,7 @@ from AutoTimerEditor import AutoTimerEditorBase, AutoTimerServiceEditor, \
 
 # GUI (Components)
 from Components.ActionMap import ActionMap
+from Components.Pixmap import Pixmap
 
 # Configuration
 from Components.config import getConfigListEntry, KEY_0, KEY_DELETE, \
@@ -23,30 +24,16 @@ class AutoTimerWizard(WizardLanguage, AutoTimerEditorBase, Rc):
        STEP_ID_SERVICES = 7
        STEP_ID_FILTER = 8
 
-       skin = """
-               <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
-                       <widget name="text" position="153,50" size="340,300" font="Regular;22" />
-                       <widget source="list" render="Listbox" position="53,310" size="440,220" scrollbarMode="showOnDemand" >
-                               <convert type="StringList" />
-                       </widget>
-                       <widget name="config" position="53,310" zPosition="1" size="440,220" transparent="1" scrollbarMode="showOnDemand" />
-                       <ePixmap pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
-                       <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
-                       <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
-                       <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="500,50" zPosition="10" size="154,500" alphatest="on" />
-                       <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
-                       <widget name="arrowdown2" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
-                       <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
-                       <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
-               </screen>"""
-
        def __init__(self, session, newTimer):
                self.xmlfile = Directories.resolveFilename(Directories.SCOPE_PLUGINS, "Extensions/AutoTimer/autotimerwizard.xml")
 
-               WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
+               WizardLanguage.__init__(self, session, showSteps = True, showStepSlider = True)
                AutoTimerEditorBase.__init__(self, newTimer)
                Rc.__init__(self)
 
+               self.skinName = "StartWizard"
+               self["wizard"] = Pixmap()
+
                self.doCancel = False
                self.emptyMatch = False
                self.tailingWhitespacesMatch = False
@@ -82,14 +69,14 @@ class AutoTimerWizard(WizardLanguage, AutoTimerEditorBase, Rc):
 
        def generateTimespanList(self):
                self.timespanList = [
-                       getConfigListEntry(_("Only match during Timespan"), self.timespan)
+                       getConfigListEntry(_("Only match during timespan"), self.timespan)
                ]
 
                # Only allow editing timespan when it's enabled
                if self.timespan.value:
                        self.timespanList.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)
                        ])
 
        def getConfigList(self):
@@ -97,8 +84,8 @@ class AutoTimerWizard(WizardLanguage, AutoTimerEditorBase, Rc):
                        return [
                                getConfigListEntry(_("Enabled"), self.enabled),
                                getConfigListEntry(_("Description"), self.name),
-                               getConfigListEntry(_("Match Title"), self.match),
-                               getConfigListEntry(_("Timer Type"), self.justplay),
+                               getConfigListEntry(_("Match title"), self.match),
+                               getConfigListEntry(_("Timer type"), self.justplay),
                        ]
                elif self.currStep == AutoTimerWizard.STEP_ID_TIMESPAN: # Timespan
                        return self.timespanList
@@ -109,38 +96,39 @@ class AutoTimerWizard(WizardLanguage, AutoTimerEditorBase, Rc):
                return []
 
        def selectionMade(self):
+               timer = self.timer
                if self.currStep == AutoTimerWizard.STEP_ID_BASIC: # Basic
-                       self.timer.enabled = self.enabled.value
-                       self.timer.name = self.name.value.strip() or self.match.value
-                       self.timer.match = self.match.value
-                       self.timer.justplay = self.justplay.value == "zap"
-                       self.emptyMatch = not self.timer.match.strip()
-                       self.trailingWhitespacesMatch = (self.timer.match[-1:] == " ")
+                       timer.enabled = self.enabled.value
+                       timer.name = self.name.value.strip() or self.match.value
+                       timer.match = self.match.value
+                       timer.justplay = self.justplay.value == "zap"
+                       self.emptyMatch = not timer.match.strip()
+                       self.trailingWhitespacesMatch = (timer.match[-1:] == " ")
                elif self.currStep == AutoTimerWizard.STEP_ID_TIMESPAN: # Timespan
                        if self.timespan.value:
                                start = self.timespanbegin.value
                                end = self.timespanend.value
-                               self.timer.timespan = (start, end)
+                               timer.timespan = (start, end)
                        else:
-                               self.timer.timespan = None
+                               timer.timespan = None
                elif self.currStep == AutoTimerWizard.STEP_ID_SERVICES: # Services
                        self.servicesDlg.refresh()
 
                        if self.servicesDlg.enabled.value:
-                               self.timer.services = self.servicesDlg.services[0]
-                               self.timer.bouquets = self.servicesDlg.services[1]
+                               timer.services = self.servicesDlg.services[0]
+                               timer.bouquets = self.servicesDlg.services[1]
                        else:
-                               self.timer.services = []
-                               self.timer.bouquets = []
+                               timer.services = []
+                               timer.bouquets = []
                elif self.currStep == AutoTimerWizard.STEP_ID_FILTER: # Filters
                        self.filterDlg.refresh()
 
                        if self.filterDlg.enabled.value:
-                               self.timer.includes = self.filterDlg.includes
-                               self.timer.excludes = self.filterDlg.excludes
+                               timer.includes = self.filterDlg.includes
+                               timer.excludes = self.filterDlg.excludes
                        else:
-                               self.timer.includes = []
-                               self.timer.excludes = []
+                               timer.includes = []
+                               timer.excludes = []
 
        def keyNumberGlobal(self, number):
                if self.currStep == AutoTimerWizard.STEP_ID_BASIC or self.currStep == AutoTimerWizard.STEP_ID_TIMESPAN:
@@ -175,6 +163,11 @@ class AutoTimerWizard(WizardLanguage, AutoTimerEditorBase, Rc):
        def deleteBackward(self):
                self["config"].handleKey(KEY_BACKSPACE)
 
+       def exitWizardQuestion(self, ret = False):
+               if ret:
+                       self.doCancel = True
+                       self.close()
+
        def cancel(self):
                self.doCancel = True
                self.currStep = len(self.wizard)