Exemple #1
0
    def _ticker_event(self):

        # Stop ticker if playback has stopped.
        if (self.consumer.is_stopped() or self.producer.get_speed() == 0):
            self.ticker.stop_ticker()

        current_frame = self.producer.frame()

        # Stop rendering if last frame reached.
        if self.is_rendering == True and current_frame >= self.render_stop_frame:
            self.stop_rendering()
            return

        # If we're currently rendering, set progress bar and exit event handler.
        if self.is_rendering:
            if (self.producer.get_length() - 1) < 1:
                render_fraction = 1.0
            else:
                render_fraction = (
                    (float(current_frame - self.render_start_frame)) /
                    (float(self.render_stop_frame - self.render_start_frame)))
            self.render_gui_update_count = self.render_gui_update_count + 1
            if self.render_gui_update_count % 8 == 0:  # we need quick updates for stop accuracy, but slower gui updating
                self.render_gui_update_count = 1
                Gdk.threads_enter()
                self.render_callbacks.set_render_progress_gui(render_fraction)
                Gdk.threads_leave()
            return

        # If we're out of active range seek end.
        if current_frame >= self.get_active_length():
            Gdk.threads_enter()
            self.seek_frame(current_frame)
            Gdk.threads_leave()
            return

        # If trim looping and past loop end, start from loop start
        if ((not (self.loop_start == -1))
                and ((current_frame >= self.loop_end) or
                     (current_frame >= self.get_active_length()))):
            self.seek_frame(self.loop_start,
                            False)  #NOTE: False==GUI not updated
            self.producer.set_speed(1)

        Gdk.threads_enter()
        # If prefs set and frame out tline view, move tline view
        range_moved = updater.maybe_move_playback_tline_range(
            current_frame)  # range_moved given just to avoid two updates
        if range_moved == False:
            # Just display tline
            updater.update_frame_displayers(current_frame)
        Gdk.threads_leave()
Exemple #2
0
    def _ticker_event(self):
            
        # Stop ticker if playback has stopped.
        if (self.consumer.is_stopped() or self.producer.get_speed() == 0):
            self.ticker.stop_ticker()

        current_frame = self.producer.frame()
        
        # Stop rendering if last frame reached.
        if self.is_rendering == True and current_frame >= self.render_stop_frame:
            self.stop_rendering()
            return

        # If we're currently rendering, set progress bar and exit event handler.
        if self.is_rendering:
            if (self.producer.get_length() - 1) < 1:
                render_fraction = 1.0
            else:
                render_fraction = ((float(current_frame - self.render_start_frame)) / 
                  (float(self.render_stop_frame - self.render_start_frame)))
            self.render_gui_update_count = self.render_gui_update_count + 1
            if self.render_gui_update_count % 8 == 0: # we need quick updates for stop accuracy, but slower gui updating
                self.render_gui_update_count = 1
                Gdk.threads_enter()
                self.render_callbacks.set_render_progress_gui(render_fraction)
                Gdk.threads_leave()
            return 

        # If we're out of active range seek end.
        if current_frame >= self.get_active_length():
            Gdk.threads_enter()
            self.seek_frame(current_frame)
            Gdk.threads_leave()
            return

        # If trim looping and past loop end, start from loop start
        if ((not(self.loop_start == -1)) and 
            ((current_frame >= self.loop_end)
            or (current_frame >= self.get_active_length()))):
            self.seek_frame(self.loop_start, False) #NOTE: False==GUI not updated
            self.producer.set_speed(1)
        
        Gdk.threads_enter()
        # If prefs set and frame out tline view, move tline view
        range_moved = updater.maybe_move_playback_tline_range(current_frame) # range_moved given just to avoid two updates
        if range_moved == False:
            # Just display tline
            updater.update_frame_displayers(current_frame)
        Gdk.threads_leave()