Example #1
0
 def _updatePositionCb(self, pipeline, position):
     if self.progress:
         text = None
         timediff = time.time() - self.timestarted
         length = self.app.current.timeline.props.duration
         fraction = float(min(position, length)) / float(length)
         if timediff > 5.0 and position:
             # only display ETA after 5s in order to have enough averaging and
             # if the position is non-null
             totaltime = (timediff * float(length) / float(position)) - timediff
             text = beautify_ETA(int(totaltime * Gst.SECOND))
         self.progress.updatePosition(fraction, text)
Example #2
0
 def _updateTimeEstimateCb(self):
     if self._rendering_is_paused:
         return True  # Do nothing until we resume rendering
     elif self._is_rendering:
         timediff = time.time() - self._time_started - self._time_spent_paused
         length = self.app.current_project.timeline.props.duration
         totaltime = (timediff * float(length) / float(self.current_position)) - timediff
         time_estimate = beautify_ETA(int(totaltime * Gst.SECOND))
         if time_estimate:
             self.progress.updateProgressbarETA(time_estimate)
         return True
     else:
         self._timeEstimateTimer = None
         self.debug("Stopping the ETA timer")
         return False  # Stop the timer
Example #3
0
 def _callForward(self):
     # This function always returns False so that it may be safely
     # invoked via GLib.idle_add(). Use of idle_add() is necessary
     # to ensure that watchers are always called from the main thread,
     # even if progress updates are received from other threads.
     total_target = sum(self._targets)
     total_completed = sum(self._portions)
     if total_target == 0:
         return False
     frac = min(1.0, float(total_completed) / total_target)
     now = time.time()
     remaining = (now - self._start) * (1 - frac) / frac
     for function in self._watchers:
         function(frac, beautify_ETA(int(remaining * Gst.SECOND)))
     return False
Example #4
0
 def _callForward(self):
     # This function always returns False so that it may be safely
     # invoked via GLib.idle_add(). Use of idle_add() is necessary
     # to ensure that watchers are always called from the main thread,
     # even if progress updates are received from other threads.
     total_target = sum(self._targets)
     total_completed = sum(self._portions)
     if total_target == 0:
         return False
     frac = min(1.0, float(total_completed) / total_target)
     now = time.time()
     remaining = (now - self._start) * (1 - frac) / frac
     for function in self._watchers:
         function(frac, beautify_ETA(int(remaining * Gst.SECOND)))
     return False
Example #5
0
 def _updateTimeEstimateCb(self):
     if self._rendering_is_paused:
         return True  # Do nothing until we resume rendering
     elif self._is_rendering:
         timediff = time.time(
         ) - self._time_started - self._time_spent_paused
         length = self.app.project_manager.current_project.timeline.props.duration
         totaltime = (timediff * float(length) /
                      float(self.current_position)) - timediff
         time_estimate = beautify_ETA(int(totaltime * Gst.SECOND))
         if time_estimate:
             self.progress.updateProgressbarETA(time_estimate)
         return True
     else:
         self._timeEstimateTimer = None
         self.debug("Stopping the ETA timer")
         return False  # Stop the timer
Example #6
0
 def _updateTimeEstimateCb(self):
     if self._rendering_is_paused:
         # Do nothing until we resume rendering
         return True
     if self._is_rendering:
         if self.current_position:
             timediff = time.time() - self._time_started - self._time_spent_paused
             length = self.project.ges_timeline.props.duration
             estimated_time = timediff * length / self.current_position
             remaining_time = estimated_time - timediff
             estimate = beautify_ETA(int(remaining_time * Gst.SECOND))
             if estimate:
                 self.progress.updateProgressbarETA(estimate)
         return True
     else:
         self._timeEstimateTimer = None
         self.debug("Stopping the ETA timer")
         return False