def scrollToPlayhead(self):
     width = self.get_allocation().width
     new_pos = Zoomable.nsToPixel(self._position)
     scroll_pos = self.hadj.get_value()
     if (new_pos < scroll_pos) or (new_pos > scroll_pos + width):
         self.scrollToPosition(new_pos - width / 2)
     return False
Beispiel #2
0
 def _updateScrollAdjustments(self):
     a = self.get_allocation()
     size = Zoomable.nsToPixel(self.timeline.duration)
     self.hadj.props.lower = 0
     self.hadj.props.upper = size + 200  # why is this necessary???
     self.hadj.props.page_size = a.width
     self.hadj.props.page_increment = size * 0.9
     self.hadj.props.step_increment = size * 0.1
Beispiel #3
0
 def _updateScrollAdjustments(self):
     a = self.get_allocation()
     size = Zoomable.nsToPixel(self.timeline.duration)
     self.hadj.props.lower = 0
     self.hadj.props.upper = size + 200  # why is this necessary???
     self.hadj.props.page_size = a.width
     self.hadj.props.page_increment = size * 0.9
     self.hadj.props.step_increment = size * 0.1
Beispiel #4
0
    def scrollToPlayhead(self):
        """
        Scroll the current position as close to the center of the view
        as possible (as close as the timeline canvas allows).
        """
        page_size = self.hadj.get_page_size()

        new_pos = Zoomable.nsToPixel(self._position)
        scroll_pos = self.hadj.get_value()
        if (new_pos > scroll_pos + page_size) or (new_pos < scroll_pos):
            self.scrollToPosition(min(new_pos - page_size / 2, self.hadj.upper - page_size - 1))
        return False
Beispiel #5
0
    def scrollToPlayhead(self):
        """
        Scroll the current position as close to the center of the view
        as possible (as close as the timeline canvas allows).
        """
        page_size = self.hadj.get_page_size()

        new_pos = Zoomable.nsToPixel(self._position)
        scroll_pos = self.hadj.get_value()
        if (new_pos > scroll_pos + page_size) or (new_pos < scroll_pos):
            self.scrollToPosition(min(new_pos - page_size / 2, self.hadj.upper - page_size - 1))
        return False
Beispiel #6
0
    def zoomChanged(self):
        if self._updateZoom:
            self._zoomAdjustment.set_value(self.getCurrentZoomLevel())

        # the new scroll position should preserve the current horizontal
        # position of the playhead in the window
        cur_playhead_offset = self._canvas._playhead.props.x - self.hadj.props.value
        new_pos = Zoomable.nsToPixel(self._position) - cur_playhead_offset

        self._updateScrollAdjustments()
        self._scrollToPosition(new_pos)
        self.ruler.queue_resize()
        self.ruler.queue_draw()
Beispiel #7
0
    def zoomChanged(self):
        if self._updateZoom:
            self._zoomAdjustment.set_value(self.getCurrentZoomLevel())

        # the new scroll position should preserve the current horizontal
        # position of the playhead in the window
        cur_playhead_offset = self._canvas._playhead.props.x -\
            self.hadj.props.value
        new_pos = Zoomable.nsToPixel(self._position) - cur_playhead_offset

        self._updateScrollAdjustments()
        self._scrollToPosition(new_pos)
        self.ruler.queue_resize()
        self.ruler.queue_draw()