the record.png blinks now whenever a timerentry in the recordingtimer is running
[enigma2.git] / lib / python / Screens / InfoBarGenerics.py
index 62307675cadb68a549f91c61231ff10830c12f3b..604f164a42c43cafa4c20da5887019c2a3ba142e 100644 (file)
@@ -6,6 +6,8 @@ from Components.config import configfile, configsequencearg
 from Components.config import config, configElement, ConfigSubsection, configSequence
 from ChannelSelection import ChannelSelection
 
 from Components.config import config, configElement, ConfigSubsection, configSequence
 from ChannelSelection import ChannelSelection
 
+from Components.Pixmap import PixmapConditional
+from Components.BlinkingPixmap import BlinkingPixmapConditional
 from Components.ServiceName import ServiceName
 from Components.EventInfo import EventInfo
 
 from Components.ServiceName import ServiceName
 from Components.EventInfo import EventInfo
 
@@ -98,19 +100,26 @@ class InfoBarShowHide:
 
                self.state = self.STATE_SHOWN
                
 
                self.state = self.STATE_SHOWN
                
+               self.onExecBegin.append(self.show)
                self.onClose.append(self.delHideTimer)
                
                self.hideTimer = eTimer()
                self.hideTimer.timeout.get().append(self.doTimerHide)
                self.onClose.append(self.delHideTimer)
                
                self.hideTimer = eTimer()
                self.hideTimer.timeout.get().append(self.doTimerHide)
-               self.hideTimer.start(1000)
+               self.hideTimer.start(5000)
 
        def delHideTimer(self):
                del self.hideTimer
 
        def hide(self): 
                self.instance.hide()
 
        def delHideTimer(self):
                del self.hideTimer
 
        def hide(self): 
                self.instance.hide()
+               
+       def show(self):
+               self.state = self.STATE_SHOWN
+               self.hideTimer.stop()
+               self.hideTimer.start(5000)
 
        def doTimerHide(self):
 
        def doTimerHide(self):
+               self.hideTimer.stop()
                if self.state == self.STATE_SHOWN:
                        self.instance.hide()
                        self.state = self.STATE_HIDDEN
                if self.state == self.STATE_SHOWN:
                        self.instance.hide()
                        self.state = self.STATE_HIDDEN
@@ -120,14 +129,12 @@ class InfoBarShowHide:
                        self.instance.hide()
                        #pls check animation support, sorry
 #                      self.startHide()
                        self.instance.hide()
                        #pls check animation support, sorry
 #                      self.startHide()
+                       self.hideTimer.stop()
                        self.state = self.STATE_HIDDEN
                        self.state = self.STATE_HIDDEN
-               else:
+               elif self.state == self.STATE_HIDDEN:
                        self.instance.show()
                        self.instance.show()
-#                      self.startShow()
-                       self.state = self.STATE_SHOWN
-                       #TODO: make it customizable
-                       self.hideTimer.start(5000)
-
+                       self.show()
+                       
        def startShow(self):
                self.instance.m_animation.startMoveAnimation(ePoint(0, 600), ePoint(0, 380), 100)
                self.state = self.STATE_SHOWN
        def startShow(self):
                self.instance.m_animation.startMoveAnimation(ePoint(0, 600), ePoint(0, 380), 100)
                self.state = self.STATE_SHOWN
@@ -267,11 +274,15 @@ class InfoBarChannelSelection:
        def     zapUp(self):
                self.servicelist.moveUp()
                self.servicelist.zap()
        def     zapUp(self):
                self.servicelist.moveUp()
                self.servicelist.zap()
+               self.instance.show()
+               self.show()
 
        def     zapDown(self):
                self.servicelist.moveDown()
                self.servicelist.zap()
 
        def     zapDown(self):
                self.servicelist.moveDown()
                self.servicelist.zap()
-
+               self.instance.show()
+               self.show()
+               
 class InfoBarMenu:
        """ Handles a menu action, to open the (main) menu """
        def __init__(self):
 class InfoBarMenu:
        """ Handles a menu action, to open the (main) menu """
        def __init__(self):
@@ -377,16 +388,20 @@ class InfoBarInstantRecord:
        """Instant Record - handles the instantRecord action in order to 
        start/stop instant records"""
        def __init__(self):
        """Instant Record - handles the instantRecord action in order to 
        start/stop instant records"""
        def __init__(self):
-               self["InstnantRecordActions"] = HelpableActionMap(self, "InfobarInstantRecord",
+               self["InstantRecordActions"] = HelpableActionMap(self, "InfobarInstantRecord",
                        {
                                "instantRecord": (self.instantRecord, "Instant Record..."),
                        })
                self.recording = None
                        {
                                "instantRecord": (self.instantRecord, "Instant Record..."),
                        })
                self.recording = None
-
+               
+               self["BlinkingPoint"] = BlinkingPixmapConditional()
+               self.onShown.append(self["BlinkingPoint"].hidePixmap)
+               self["BlinkingPoint"].setConnect(self.session.nav.RecordTimer.isRecording)
+               
        def stopCurrentRecording(self): 
                self.session.nav.RecordTimer.removeEntry(self.recording)
                self.recording = None
        def stopCurrentRecording(self): 
                self.session.nav.RecordTimer.removeEntry(self.recording)
                self.recording = None
-       
+                       
        def startInstantRecording(self):
                serviceref = self.session.nav.getCurrentlyPlayingServiceReference()
                        
        def startInstantRecording(self):
                serviceref = self.session.nav.getCurrentlyPlayingServiceReference()
                        
@@ -403,12 +418,20 @@ class InfoBarInstantRecord:
                # fix me, description. 
                self.recording = self.session.nav.recordWithTimer(time.time(), time.time() + 3600, serviceref, epg, "instant record")
                self.recording.dontSave = True
                # fix me, description. 
                self.recording = self.session.nav.recordWithTimer(time.time(), time.time() + 3600, serviceref, epg, "instant record")
                self.recording.dontSave = True
+               
+               #self["BlinkingPoint"].setConnect(lambda: self.recording.isRunning())
+               
+       def isInstantRecordRunning(self):
+               if self.recording != None:
+                       if self.recording.isRunning():
+                               return True
+               return False
 
        def recordQuestionCallback(self, answer):
                if answer == False:
                        return
                
 
        def recordQuestionCallback(self, answer):
                if answer == False:
                        return
                
-               if self.recording != None:
+               if self.isInstantRecordRunning():
                        self.stopCurrentRecording()
                else:
                        self.startInstantRecording()
                        self.stopCurrentRecording()
                else:
                        self.startInstantRecording()
@@ -420,10 +443,10 @@ class InfoBarInstantRecord:
                        self.session.open(MessageBox, "No HDD found!")
                        return
        
                        self.session.open(MessageBox, "No HDD found!")
                        return
        
-               if self.recording != None:
-                       self.session.openWithCallback(self.recordQuestionCallback, MessageBox, "Do you want to stop the current\n(instant) recording?")
+               if self.isInstantRecordRunning():
+                       self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Do you want to stop the current\n(instant) recording?"))
                else:
                else:
-                       self.session.openWithCallback(self.recordQuestionCallback, MessageBox, "Start recording?")
+                       self.session.openWithCallback(self.recordQuestionCallback, MessageBox, _("Start recording?"))
 
 from Screens.AudioSelection import AudioSelection
 
 
 from Screens.AudioSelection import AudioSelection
 
@@ -440,3 +463,17 @@ class InfoBarAudioSelection:
                n = audio.getNumberOfTracks()
                if n > 0:
                        self.session.open(AudioSelection, audio)
                n = audio.getNumberOfTracks()
                if n > 0:
                        self.session.open(AudioSelection, audio)
+
+class InfoBarAdditionalInfo:
+       def __init__(self):
+               self["DolbyActive"] = PixmapConditional()
+               # TODO: get the info from c++ somehow
+               self["DolbyActive"].setConnect(lambda: False)
+               
+               self["CryptActive"] = PixmapConditional()
+               # TODO: get the info from c++ somehow
+               self["CryptActive"].setConnect(lambda: False)
+               
+               self["FormatActive"] = PixmapConditional()
+               # TODO: get the info from c++ somehow
+               self["FormatActive"].setConnect(lambda: False)
\ No newline at end of file