update languages: es, nl
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 58321ac60e4c2b931d823c53a276532b0050b485..f8b185f0519df9ed8d75ed9e9ab6eb3b7fce3dcc 100644 (file)
@@ -15,6 +15,7 @@ from Components.ServiceEventTracker import ServiceEventTracker
 from Components.ServiceName import ServiceName
 from Components.config import config, configElement, ConfigSubsection, configSequence, configElementBoolean
 from Components.config import configfile, configsequencearg
 from Components.ServiceName import ServiceName
 from Components.config import config, configElement, ConfigSubsection, configSequence, configElementBoolean
 from Components.config import configfile, configsequencearg
+from Components.TimerList import TimerEntryComponent
 
 from EpgSelection import EPGSelection
 from Plugins.Plugin import PluginDescriptor
 
 from EpgSelection import EPGSelection
 from Plugins.Plugin import PluginDescriptor
@@ -26,7 +27,7 @@ from Screens.EventView import EventViewEPGSelect, EventViewSimple
 from Screens.InputBox import InputBox
 from Screens.MessageBox import MessageBox
 from Screens.MinuteInput import MinuteInput
 from Screens.InputBox import InputBox
 from Screens.MessageBox import MessageBox
 from Screens.MinuteInput import MinuteInput
-from Screens.Standby import Standby
+from Screens.TimerSelection import TimerSelection
 from ServiceReference import ServiceReference
 
 from Tools import Notifications
 from ServiceReference import ServiceReference
 
 from Tools import Notifications
@@ -166,41 +167,6 @@ class NumberZap(Screen):
                self.Timer.timeout.get().append(self.keyOK)
                self.Timer.start(3000, True)
 
                self.Timer.timeout.get().append(self.keyOK)
                self.Timer.start(3000, True)
 
-class InfoBarPowerKey:
-       """ PowerKey stuff - handles the powerkey press and powerkey release actions"""
-       
-       def __init__(self):
-               self.powerKeyTimer = eTimer()
-               self.powerKeyTimer.timeout.get().append(self.powertimer)
-               self["PowerKeyActions"] = HelpableActionMap(self, "PowerKeyActions",
-                       {
-                               "powerdown": self.powerdown,
-                               "powerup": self.powerup,
-                               "discreteStandby": (self.standby, "Go standby"),
-                               "discretePowerOff": (self.quit, "Go to deep standby"),
-                       })
-
-       def powertimer(self):   
-               print "PowerOff - Now!"
-               self.quit()
-       
-       def powerdown(self):
-               self.standbyblocked = 0
-               self.powerKeyTimer.start(3000, True)
-
-       def powerup(self):
-               self.powerKeyTimer.stop()
-               if self.standbyblocked == 0:
-                       self.standbyblocked = 1
-                       self.standby()
-
-       def standby(self):
-               self.session.open(Standby, self)
-
-       def quit(self):
-               # halt
-               quitMainloop(1)
-
 class InfoBarNumberZap:
        """ Handles an initial number for NumberZapping """
        def __init__(self):
 class InfoBarNumberZap:
        """ Handles an initial number for NumberZapping """
        def __init__(self):
@@ -1019,15 +985,16 @@ class InfoBarInstantRecord:
                        {
                                "instantRecord": (self.instantRecord, "Instant Record..."),
                        })
                        {
                                "instantRecord": (self.instantRecord, "Instant Record..."),
                        })
-               self.recording = None
+               self.recording = []
                self["BlinkingPoint"] = BlinkingPixmapConditional()
                self["BlinkingPoint"].hide()
                self["BlinkingPoint"].setConnect(self.session.nav.RecordTimer.isRecording)
 
                self["BlinkingPoint"] = BlinkingPixmapConditional()
                self["BlinkingPoint"].hide()
                self["BlinkingPoint"].setConnect(self.session.nav.RecordTimer.isRecording)
 
-       def stopCurrentRecording(self): 
-               self.session.nav.RecordTimer.removeEntry(self.recording)
-               self.recording = None
-
+       def stopCurrentRecording(self, entry = -1):     
+               if entry is not None and entry != -1:
+                       self.session.nav.RecordTimer.removeEntry(self.recording[entry])
+                       self.recording.remove(self.recording[entry])
+                       
        def startInstantRecording(self, limitEvent = False):
                serviceref = self.session.nav.getCurrentlyPlayingServiceReference()
                
        def startInstantRecording(self, limitEvent = False):
                serviceref = self.session.nav.getCurrentlyPlayingServiceReference()
                
@@ -1063,27 +1030,39 @@ class InfoBarInstantRecord:
                                
                data = (begin, end, name, description, eventid)
                
                                
                data = (begin, end, name, description, eventid)
                
-               self.recording = self.session.nav.recordWithTimer(serviceref, *data)
-               self.recording.dontSave = True
+               recording = self.session.nav.recordWithTimer(serviceref, *data)
+               recording.dontSave = True
+               self.recording.append(recording)
                
                #self["BlinkingPoint"].setConnect(lambda: self.recording.isRunning())
                
        def isInstantRecordRunning(self):
                
                #self["BlinkingPoint"].setConnect(lambda: self.recording.isRunning())
                
        def isInstantRecordRunning(self):
-               if self.recording != None:
-                       if self.recording.isRunning():
-                               return True
+               print "self.recording:", self.recording
+               if len(self.recording) > 0:
+                       for x in self.recording:
+                               if x.isRunning():
+                                       return True
                return False
 
        def recordQuestionCallback(self, answer):
                if answer is None or answer[1] == "no":
                        return
                return False
 
        def recordQuestionCallback(self, answer):
                if answer is None or answer[1] == "no":
                        return
-               
-               if self.isInstantRecordRunning():
-                       if answer[1] == "manualduration":
-                               self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER)                             
+               list = []
+               for x in self.recording:
+                       if x.dontSave:
+                               list.append(TimerEntryComponent(x, False))              
+
+               if answer[1] == "changeduration":
+                       if len(self.recording) == 1:
+                               self.changeDuration(0)
                        else:
                        else:
-                               self.stopCurrentRecording()
-               else:
+                               self.session.openWithCallback(self.changeDuration, TimerSelection, list)
+               elif answer[1] == "stop":
+                       if len(self.recording) == 1:
+                               self.stopCurrentRecording(0)
+                       else:
+                               self.session.openWithCallback(self.stopCurrentRecording, TimerSelection, list)
+               if answer[1] == "indefinitely" or answer[1] == "manualduration" or answer[1] == "event":
                        limitEvent = False
                        if answer[1] == "event":
                                limitEvent = True
                        limitEvent = False
                        if answer[1] == "event":
                                limitEvent = True
@@ -1091,12 +1070,16 @@ class InfoBarInstantRecord:
                                self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER)
                        self.startInstantRecording(limitEvent = limitEvent)
 
                                self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER)
                        self.startInstantRecording(limitEvent = limitEvent)
 
+       def changeDuration(self, entry):
+               if entry is not None:
+                       self.selectedEntry = entry
+                       self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER)
+
        def inputCallback(self, value):
                if value is not None:
                        print "stopping recording after", int(value), "minutes."
        def inputCallback(self, value):
                if value is not None:
                        print "stopping recording after", int(value), "minutes."
-                       if self.recording is not None:
-                               self.recording.end = time.time() + 60 * int(value)
-                               self.session.nav.RecordTimer.timeChanged(self.recording)
+                       self.recording[self.selectedEntry].end = time.time() + 60 * int(value)
+                       self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry])
 
        def instantRecord(self):
                try:
 
        def instantRecord(self):
                try:
@@ -1106,11 +1089,9 @@ class InfoBarInstantRecord:
                        return
        
                if self.isInstantRecordRunning():
                        return
        
                if self.isInstantRecordRunning():
-                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("A recording is currently running.\nWhat do you want to do?"), list=[(_("stop recording"), "yes"), (_("enter recording duration"), "manualduration"), (_("do nothing"), "no")])
-#                      self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Do you want to stop the current\n(instant) recording?"))
+                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("A recording is currently running.\nWhat do you want to do?"), list=[(_("stop recording"), "stop"), (_("change recording (duration)"), "changeduration"), (_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"), (_("do nothing"), "no")])
                else:
                else:
-                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("record indefinitely"), "indefinitely"), (_("stop after current event"), "event"), (_("enter recording duration"), "manualduration"),(_("don't record"), "no")])
-                       #self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Start recording?"))
+                       self.session.openWithCallback(self.recordQuestionCallback, ChoiceBox, title=_("Start recording?"), list=[(_("add recording (indefinitely)"), "indefinitely"), (_("add recording (stop after current event)"), "event"), (_("add recording (enter recording duration)"), "manualduration"),(_("don't record"), "no")])
 
 from Screens.AudioSelection import AudioSelection
 
 
 from Screens.AudioSelection import AudioSelection