Merge branch 'master' of /home/tmbinc/enigma2-git
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 2 Mar 2009 16:17:08 +0000 (17:17 +0100)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 2 Mar 2009 16:17:08 +0000 (17:17 +0100)
1  2 
lib/python/Screens/InfoBarGenerics.py

index 71e08327734cdcd8e12634761869ac618978a17e,1594b3a5261b9f673d10fb5f298f279d7cfc8f72..20a239a2654639c07a7f9979f895cef72fff44d0
@@@ -391,6 -391,32 +391,32 @@@ class InfoBarSimpleEventView
                        epglist[1] = tmp
                        setEvent(epglist[0])
  
+ class SimpleServicelist:
+       def __init__(self, services):
+               self.services = services
+               self.length = len(services)
+               self.current = 0
+       def selectService(self, service):
+               self.current = 0
+               while self.services[self.current].ref != service:
+                       self.current += 1
+       def nextService(self):
+               if self.current+1 < self.length:
+                       self.current += 1
+               else:
+                       self.current = 0
+       def prevService(self):
+               if self.current-1 > -1:
+                       self.current -= 1
+               else:
+                       self.current = self.length - 1
+       def currentService(self):
+               return self.services[self.current]
  class InfoBarEPG:
        """ EPG - Opens an EPG list when the showEPGList action fires """
        def __init__(self):
                elif cnt == 1:
                        self.openBouquetEPG(bouquets[0][1], withCallback)
  
+       def changeServiceCB(self, direction, epg):
+               if self.serviceSel:
+                       if direction > 0:
+                               self.serviceSel.nextService()
+                       else:
+                               self.serviceSel.prevService()
+                       epg.setService(self.serviceSel.currentService())
+       def SingleServiceEPGClosed(self, ret=False):
+               self.serviceSel = None
        def openSingleServiceEPG(self):
                ref=self.session.nav.getCurrentlyPlayingServiceReference()
-               self.session.open(EPGSelection, ref)
+               if ref:
+                       if self.servicelist.getMutableList() is not None: # bouquet in channellist
+                               current_path = self.servicelist.getRoot()
+                               services = self.getBouquetServices(current_path)
+                               self.serviceSel = SimpleServicelist(services)
+                               self.serviceSel.selectService(ref)
+                               self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref, serviceChangeCB = self.changeServiceCB)
+                       else:
+                               self.session.open(EPGSelection, ref)
  
        def showEventInfoPlugins(self):
                list = [(p.name, boundFunction(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO)]
@@@ -623,6 -668,11 +668,6 @@@ class InfoBarSeek
                                iPlayableService.evEOF: self.__evEOF,
                                iPlayableService.evSOF: self.__evSOF,
                        })
 -              self.eofState = 0
 -              self.eofTimer = eTimer()
 -              self.eofTimer.timeout.get().append(self.doEof)
 -              self.eofInhibitTimer = eTimer()
 -              self.eofInhibitTimer.timeout.get().append(self.inhibitEof)
  
                self.minSpeedBackward = useSeekBackHack and 16 or 0
  
        def __serviceStarted(self):
                self.seekstate = self.SEEK_STATE_PLAY
                self.__seekableStatusChanged()
 -              if self.eofState != 0:
 -                      self.eofTimer.stop()
 -              self.eofState = 0
  
        def setSeekState(self, state):
                service = self.session.nav.getCurrentService()
                seekable = self.getSeek()
                if seekable is None:
                        return
 -              prevstate = self.seekstate
 -              if self.eofState == 1:
 -                      self.eofState = 2
 -                      self.inhibitEof()
 -              if self.seekstate == self.SEEK_STATE_EOF:
 -                      if prevstate == self.SEEK_STATE_PAUSE:
 -                              self.setSeekState(self.SEEK_STATE_PAUSE)
 -                      else:
 -                              self.setSeekState(self.SEEK_STATE_PLAY)
 -              self.eofInhibitTimer.start(200, True)
                seekable.seekTo(pts)
  
        def doSeekRelative(self, pts):
                if seekable is None:
                        return
                prevstate = self.seekstate
 -              if self.eofState == 1:
 -                      self.eofState = 2
 -                      self.inhibitEof()
 +
                if self.seekstate == self.SEEK_STATE_EOF:
                        if prevstate == self.SEEK_STATE_PAUSE:
                                self.setSeekState(self.SEEK_STATE_PAUSE)
                        else:
                                self.setSeekState(self.SEEK_STATE_PLAY)
 -              self.eofInhibitTimer.start(200, True)
                seekable.seekRelative(pts<0 and -1 or 1, abs(pts))
                if abs(pts) > 100 and config.usage.show_infobar_on_skip.value:
                        self.showAfterSeek()
                return False
                
        def __evEOF(self):
 -              if self.eofState == 0 and self.seekstate != self.SEEK_STATE_EOF:
 -                      self.eofState = 1
 -                      time = self.calcRemainingTime()
 -                      if not time:
 -                              time = 3000   # Failed to calc, use default
 -                      elif time == 0:
 -                              time = 300    # Passed end, shortest wait
 -                      elif time > 15000:
 -                              self.eofState = -2  # Too long, block eof
 -                              time = 15000
 -                      else:
 -                              time += 1000  # Add margin
 -                      self.eofTimer.start(time, True)
 -
 -      def inhibitEof(self):
 -              if self.eofState >= 1:
 -                      self.eofState = -self.eofState
 -                      self.eofTimer.stop()
 -                      self.doEof()
 -
 -      def doEof(self):
                if self.seekstate == self.SEEK_STATE_EOF:
                        return
 -              if self.eofState == -2 or self.isStateBackward(self.seekstate):
 -                      self.eofState = 0
 -                      return
  
 -              # if we are seeking, we try to end up ~1s before the end, and pause there.
 -              eofstate = self.eofState
 +              # if we are seeking forward, we try to end up ~1s before the end, and pause there.
                seekstate = self.seekstate
 -              self.eofState = 0
 -              if not self.seekstate == self.SEEK_STATE_PAUSE:
 +              if self.seekstate != self.SEEK_STATE_PAUSE:
                        self.setSeekState(self.SEEK_STATE_EOF)
 -              if eofstate == -1 or not seekstate in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE):
 +
 +              if seekstate not in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE): # if we are seeking
                        seekable = self.getSeek()
                        if seekable is not None:
                                seekable.seekTo(-1)
 -              if eofstate == 1 and seekstate == self.SEEK_STATE_PLAY:
 +              if seekstate == self.SEEK_STATE_PLAY: # regular EOF
                        self.doEofInternal(True)
                else:
                        self.doEofInternal(False)