コード例 #1
0
 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
コード例 #2
0
ファイル: timeline.py プロジェクト: dparker18/Pitivi
 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
コード例 #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
コード例 #4
0
ファイル: timeline.py プロジェクト: superdump/pitivi
    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
コード例 #5
0
ファイル: timeline.py プロジェクト: qlf/Pitivi
    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
コード例 #6
0
ファイル: timeline.py プロジェクト: feroze/pitivi
    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()
コード例 #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()