Example #1
0
    def progressUpdate(self, pld=None, tot=None):
        """
        This method updates the progress bar and the status bar. It's periodically
        called by a timer.
        
        @param pld: Time played (in s)
        @param tot: Total length (in s)
        """
        if self._player.isStopped():
            # Player is stopped
            pld = 0
            tot = 0
            self.progressScale.set_range(0, tot)
            self.progressScale.set_value(0)
        else:    
            # Otherwise (playing or paused), get the track time data and set the
            # progress scale fraction.
            if pld == None or tot == None:
                pld, tot = self._player.getTimesSec()

            # Convert to int
            p, t = int(pld), int(tot)

            # Update the scale
            self.progressScale.set_value(p)
            
            # Update the status bar
            id = self.statusBar.push(self.contextIdTime, utils.buildStatusBarStr(t, p))
Example #2
0
 def setProgressRange(self):
     """
     This method sets the range of the scale widget in dependence to the media
     length.
     """
     if self._player.isStopped():
         pass
     else:
         pld, tot = self._player.getTimesSec()
         
         # Convert to int
         p, t = int(pld), int(tot)
         
         self._logger.debug("Set Progress, length: %d played: %d" %(t, p))
         
         # Set the range
         self.progressScale.set_range(0, t if t > 0 else 0)
         
         # Update the status bar
         id = self.statusBar.push(self.contextIdTime, utils.buildStatusBarStr(t, p))