Ejemplo n.º 1
0
 def __init__(self, instance, element, height=46, **kwargs):
     super(Preview, self).__init__(**kwargs)
     Zoomable.__init__(self)
     self.app = instance
     self.height = float(height)
     self.element = element
     self.props.pointer_events = False
Ejemplo n.º 2
0
    def __init__(self, instance, hadj):
        gtk.DrawingArea.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.log("Creating new ScaleRule")
        self.add_events(gtk.gdk.POINTER_MOTION_MASK |
            gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
        self.hadj = hadj
        hadj.connect("value-changed", self._hadjValueChangedCb)

        # double-buffering properties
        self.pixmap = None
        # all values are in pixels
        self.pixmap_offset = 0
        self.pixmap_visible_width = 0
        self.pixmap_allocated_width = 0
        self.pixmap_old_allocated_width = -1
        # This is the number of visible_width we allocate for the pixmap
        self.pixmap_multiples = 2

        # position is in nanoseconds
        self.position = 0
        self.pressed = False
        self.shaded_duration = gst.CLOCK_TIME_NONE
        self.max_duration = gst.CLOCK_TIME_NONE
        self.min_frame_spacing = 5.0
        self.frame_height = 5.0
        self.frame_rate = gst.Fraction(1/1)
        self.app = instance
        self.need_update = True
Ejemplo n.º 3
0
 def __init__(self, instance, element, height=46, **kwargs):
     super(Preview, self).__init__(**kwargs)
     Zoomable.__init__(self)
     self.app = instance
     self.height = float(height)
     self.element = element
     self.props.pointer_events = False
Ejemplo n.º 4
0
    def __init__(self, instance, hadj):
        gtk.Layout.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.log("Creating new ScaleRule")
        self.add_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.BUTTON_PRESS_MASK
                        | gtk.gdk.BUTTON_RELEASE_MASK)
        self.set_hadjustment(hadj)
        self.hadj = hadj
        self.pixel_position_offset = 0
        hadj.connect("value-changed", self._hadjValueChangedCb)

        # double-buffering properties
        self.pixmap = None
        # all values are in pixels
        self.pixmap_offset = 0
        self.pixmap_visible_width = 0
        self.pixmap_allocated_width = 0
        self.pixmap_old_allocated_width = -1
        # This is the number of visible_width we allocate for the pixmap
        self.pixmap_multiples = 2

        # position is in nanoseconds
        self.position = 0
        self.pressed = False
        self.shaded_duration = gst.CLOCK_TIME_NONE
        self.max_duration = gst.CLOCK_TIME_NONE
        self.min_frame_spacing = 5.0
        self.frame_height = 5.0
        self.frame_rate = gst.Fraction(1 / 1)
        self.app = instance
Ejemplo n.º 5
0
    def _setBestZoomRatio(self):
        ruler_width = self.timeline.ruler.get_allocation()[2]
        timeline_duration = self.project.timeline.duration

        ideal_zoom_ratio = ruler_width / float(timeline_duration / gst.SECOND)
        nearest_zoom_level = Zoomable.computeZoomLevel(ideal_zoom_ratio)
        Zoomable.setZoomLevel(nearest_zoom_level)
Ejemplo n.º 6
0
    def _setBestZoomRatio(self):
        ruler_width = self.timeline.ruler.get_allocation()[2]
        timeline_duration = self.project.timeline.duration

        ideal_zoom_ratio = ruler_width / float(timeline_duration / gst.SECOND)
        nearest_zoom_level = Zoomable.computeZoomLevel(ideal_zoom_ratio)
        Zoomable.setZoomLevel(nearest_zoom_level)
Ejemplo n.º 7
0
 def __init__(self, instance, track, timeline=None):
     goocanvas.Group.__init__(self)
     Zoomable.__init__(self)
     self.app = instance
     self.widgets = {}
     self.timeline = timeline
     self.track = track
     self.max_priority = 0
     self._expanded = True
Ejemplo n.º 8
0
 def __init__(self, instance, track, timeline=None):
     goocanvas.Group.__init__(self)
     Zoomable.__init__(self)
     self.app = instance
     self.widgets = {}
     self.timeline = timeline
     self.track = track
     self.max_priority = 0
     self._expanded = True
Ejemplo n.º 9
0
 def do_scroll_event(self, event):
     if event.direction == gtk.gdk.SCROLL_UP:
         Zoomable.zoomIn()
     elif event.direction == gtk.gdk.SCROLL_DOWN:
         Zoomable.zoomOut()
     # TODO: seek timeline back/forward
     elif event.direction == gtk.gdk.SCROLL_LEFT:
         pass
     elif event.direction == gtk.gdk.SCROLL_RIGHT:
         pass
Ejemplo n.º 10
0
 def run(self):
     self.watchdog.start()
     if self.no_ui:
         self.instance.run(["--no-ui"])
     else:
         from pitivi.ui.zoominterface import Zoomable
         # set a common zoom ratio so that things like edge snapping values
         # are consistent
         Zoomable.setZoomLevel((3 * Zoomable.zoom_steps) / 4)
         self.instance.run([])
Ejemplo n.º 11
0
 def do_scroll_event(self, event):
     if event.direction == gtk.gdk.SCROLL_UP:
         Zoomable.zoomIn()
     elif event.direction == gtk.gdk.SCROLL_DOWN:
         Zoomable.zoomOut()
     # TODO: seek timeline back/forward
     elif event.direction == gtk.gdk.SCROLL_LEFT:
         pass
     elif event.direction == gtk.gdk.SCROLL_RIGHT:
         pass
Ejemplo n.º 12
0
 def run(self):
     self.watchdog.start()
     if self.no_ui:
         self.instance.run(["--no-ui"])
     else:
         from pitivi.ui.zoominterface import Zoomable
         # set a common zoom ratio so that things like edge snapping values
         # are consistent
         Zoomable.setZoomLevel((3 * Zoomable.zoom_steps) / 4)
         self.instance.run([])
Ejemplo n.º 13
0
Archivo: track.py Proyecto: qlf/Pitivi
 def __init__(self, transition):
     goocanvas.Rect.__init__(self)
     Zoomable.__init__(self)
     self.props.fill_color_rgba = 0xFFFFFF99
     self.props.stroke_color_rgba = 0x00000099
     self.set_simple_transform(0, -LAYER_SPACING + 3, 1.0, 0)
     self.props.height = LAYER_SPACING - 6
     self.props.pointer_events = goocanvas.EVENTS_NONE
     self.props.radius_x = 2
     self.props.radius_y = 2
     self.transition = transition
Ejemplo n.º 14
0
    def setBestZoomRatio(self, p=0):
        """Set the zoom level so that the entire timeline is in view."""
        ruler_width = self.timeline.ruler.get_allocation()[2]
        # Add gst.SECOND - 1 to the timeline duration to make sure the
        # last second of the timeline will be in view.
        timeline_duration = self.project.timeline.duration + gst.SECOND - 1
        timeline_duration_s = int(timeline_duration / gst.SECOND)

        ideal_zoom_ratio = float(ruler_width) / timeline_duration_s
        nearest_zoom_level = Zoomable.computeZoomLevel(ideal_zoom_ratio)
        Zoomable.setZoomLevel(nearest_zoom_level)
Ejemplo n.º 15
0
 def __init__(self, transition):
     goocanvas.Rect.__init__(self)
     Zoomable.__init__(self)
     self.props.fill_color_rgba = 0xFFFFFF99
     self.props.stroke_color_rgba = 0x00000099
     self.set_simple_transform(0, -LAYER_SPACING + 3, 1.0, 0)
     self.props.height = LAYER_SPACING - 6
     self.props.pointer_events = goocanvas.EVENTS_NONE
     self.props.radius_x = 2
     self.props.radius_y = 2
     self.transition = transition
Ejemplo n.º 16
0
    def setBestZoomRatio(self, p=0):
        """Set the zoom level so that the entire timeline is in view."""
        ruler_width = self.timeline.ruler.get_allocation()[2]
        # Add gst.SECOND - 1 to the timeline duration to make sure the
        # last second of the timeline will be in view.
        timeline_duration = self.project.timeline.duration + gst.SECOND - 1
        timeline_duration_s = int(timeline_duration / gst.SECOND)

        ideal_zoom_ratio = float(ruler_width) / timeline_duration_s
        nearest_zoom_level = Zoomable.computeZoomLevel(ideal_zoom_ratio)
        Zoomable.setZoomLevel(nearest_zoom_level)
Ejemplo n.º 17
0
    def render_cairo(self, cr, bounds, element, hscroll_pos, y1):
        if not self._view:
            return
        # The idea is to conceptually divide the clip into a sequence of
        # rectangles beginning at the start of the file, and
        # pixelsToNs(twidth) nanoseconds long. The thumbnail within the
        # rectangle is the frame produced from the timestamp corresponding to
        # rectangle's left edge. We speed things up by only drawing the
        # rectangles which intersect the given bounds.  FIXME: how would we
        # handle timestretch?
        height = bounds.y2 - bounds.y1
        width = bounds.x2 - bounds.x1

        # we actually draw the rectangles just to the left of the clip's in
        # point and just to the right of the clip's out-point, so we need to
        # mask off the actual bounds.
        cr.rectangle(bounds.x1, bounds.y1, width, height)
        cr.clip()

        # tdur = duration in ns of thumbnail
        # sof  = start of file in pixel coordinates
        x1 = bounds.x1
        sof = Zoomable.nsToPixel(element.start - element.in_point) +\
            hscroll_pos

        # i = left edge of thumbnail to be drawn. We start with x1 and
        # subtract the distance to the nearest leftward rectangle.
        # Justification of the following:
        #                i = sof + k * twidth
        #                i = x1 - delta
        # sof + k * twidth = x1 - delta
        #           i * tw = (x1 - sof) - delta
        #    <=>     delta = x1 - sof (mod twidth).
        # Fortunately for us, % works on floats in python.

        i = x1 - ((x1 - sof) % (self.twidth + self._spacing()))

        # j = timestamp *within the element* of thumbnail to be drawn. we want
        # timestamps to be numerically stable, but in practice this seems to
        # give good enough results. It might be possible to improve this
        # further, which would result in fewer thumbnails needing to be
        # generated.
        j = Zoomable.pixelToNs(i - sof)
        istep = self.twidth + self._spacing()
        jstep = self.tdur + Zoomable.pixelToNs(self.spacing)

        while i < bounds.x2:
            self._thumbForTime(cr, j, i, y1)
            cr.rectangle(i - 1, y1, self.twidth + 2, self.theight)
            i += istep
            j += jstep
            cr.fill()
Ejemplo n.º 18
0
    def render_cairo(self, cr, bounds, element, hscroll_pos, y1):
        if not self._view:
            return
        # The idea is to conceptually divide the clip into a sequence of
        # rectangles beginning at the start of the file, and
        # pixelsToNs(twidth) nanoseconds long. The thumbnail within the
        # rectangle is the frame produced from the timestamp corresponding to
        # rectangle's left edge. We speed things up by only drawing the
        # rectangles which intersect the given bounds.  FIXME: how would we
        # handle timestretch?
        height = bounds.y2 - bounds.y1
        width = bounds.x2 - bounds.x1

        # we actually draw the rectangles just to the left of the clip's in
        # point and just to the right of the clip's out-point, so we need to
        # mask off the actual bounds.
        cr.rectangle(bounds.x1, bounds.y1, width, height)
        cr.clip()

        # tdur = duration in ns of thumbnail
        # sof  = start of file in pixel coordinates
        x1 = bounds.x1
        sof = Zoomable.nsToPixel(element.start - element.in_point) +\
            hscroll_pos

        # i = left edge of thumbnail to be drawn. We start with x1 and
        # subtract the distance to the nearest leftward rectangle.
        # Justification of the following:
        #                i = sof + k * twidth
        #                i = x1 - delta
        # sof + k * twidth = x1 - delta
        #           i * tw = (x1 - sof) - delta
        #    <=>     delta = x1 - sof (mod twidth).
        # Fortunately for us, % works on floats in python.

        i = x1 - ((x1 - sof) % (self.twidth + self._spacing()))

        # j = timestamp *within the element* of thumbnail to be drawn. we want
        # timestamps to be numerically stable, but in practice this seems to
        # give good enough results. It might be possible to improve this
        # further, which would result in fewer thumbnails needing to be
        # generated.
        j = Zoomable.pixelToNs(i - sof)
        istep = self.twidth + self._spacing()
        jstep = self.tdur + Zoomable.pixelToNs(self.spacing)

        while i < bounds.x2:
            self._thumbForTime(cr, j, i, y1)
            cr.rectangle(i - 1, y1, self.twidth + 2, self.theight)
            i += istep
            j += jstep
            cr.fill()
Ejemplo n.º 19
0
 def __init__(self, instance, element, interpolator, height=LAYER_HEIGHT_EXPANDED, **kwargs):
     super(Curve, self).__init__(**kwargs)
     View.__init__(self)
     Zoomable.__init__(self)
     self.app = instance
     self.keyframes = {}
     self.height = float(height)
     self.element = element
     self.props.pointer_events = goocanvas.EVENTS_STROKE
     self.interpolator = interpolator
     self._focused_kf = None
     self.normal()
     self.set_simple_transform(0, -KW_LABEL_Y_OVERFLOW, 1.0, 0)
Ejemplo n.º 20
0
 def __init__(self, instance, element, interpolator, height=LAYER_HEIGHT_EXPANDED,
     **kwargs):
     super(Curve, self).__init__(**kwargs)
     View.__init__(self)
     Zoomable.__init__(self)
     self.app = instance
     self.keyframes = {}
     self.height = float(height)
     self.element = element
     self.props.pointer_events = goocanvas.EVENTS_STROKE
     self.interpolator = interpolator
     self._focused_kf = None
     self.normal()
     self.set_simple_transform(0, -KW_LABEL_Y_OVERFLOW, 1.0, 0)
Ejemplo n.º 21
0
 def do_simple_update(self, cr):
     cr.identity_matrix()
     if self.element.factory:
         border_width = self.previewer._spacing()
         self.bounds = goocanvas.Bounds(border_width, 4,
         max(0, Zoomable.nsToPixel(self.element.duration) -
             border_width), self.height)
Ejemplo n.º 22
0
 def do_simple_update(self, cr):
     cr.identity_matrix()
     if self.element.factory:
         border_width = self.previewer._spacing()
         self.bounds = goocanvas.Bounds(border_width, 4,
         max(0, Zoomable.nsToPixel(self.element.duration) -
             border_width), self.height)
Ejemplo n.º 23
0
    def __init__(self, instance, timeline=None):
        goocanvas.Canvas.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.app = instance
        self._selected_sources = []
        self._tracks = []
        self._height = 0
        self._position = 0

        self._block_size_request = False
        self.props.integer_layout = True
        self.props.automatic_bounds = False

        self._createUI()
        self.timeline = timeline
        self.settings = instance.settings
Ejemplo n.º 24
0
 def xyToTimeValue(self, pos):
     view = self._view
     interpolator = view.interpolator
     bounds = view.bounds
     time = Zoomable.pixelToNs(pos[0] - bounds.x1) + view.element.in_point
     value = (
         (1 - (pos[1] - KW_LABEL_Y_OVERFLOW - bounds.y1 - view._min) / view._range) * interpolator.range
     ) + interpolator.lower
     return time, value
Ejemplo n.º 25
0
 def xyToTimeValue(self, pos):
     view = self._view
     interpolator = view.interpolator
     bounds = view.bounds
     time = (Zoomable.pixelToNs(pos[0] - bounds.x1) +
             view.element.in_point)
     value = ((1 - (pos[1] - bounds.y1 - view._min) / view._range) *
              interpolator.range) + interpolator.lower
     return time, value
Ejemplo n.º 26
0
 def __init__(self, instance, factory, stream_):
     if stream_.dar and stream_.par:
         self.aspect = float(stream_.dar)
     rate = stream_.framerate
     RandomAccessPreviewer.__init__(self, instance, factory, stream_)
     self.tstep = Zoomable.pixelToNsAt(self.twidth, Zoomable.max_zoom)
     if rate.num:
         frame_duration = (gst.SECOND * rate.denom) / rate.num
         self.tstep = max(frame_duration, self.tstep)
Ejemplo n.º 27
0
 def __init__(self, instance, factory, stream_):
     if stream_.dar and stream_.par:
         self.aspect = float(stream_.dar)
     rate = stream_.framerate
     RandomAccessPreviewer.__init__(self, instance, factory, stream_)
     self.tstep = Zoomable.pixelToNsAt(self.twidth, Zoomable.max_zoom)
     if rate.num:
         frame_duration = (gst.SECOND * rate.denom) / rate.num
         self.tstep = max(frame_duration, self.tstep)
Ejemplo n.º 28
0
    def drawBackground(self, allocation):
        self.pixmap.draw_rectangle(self.style.bg_gc[gtk.STATE_NORMAL], True, 0,
                                   0, allocation.width, allocation.height)

        offset = int(Zoomable.nsToPixel(
            self.getShadedDuration())) - self.pixmap_offset
        if offset > 0:
            self.pixmap.draw_rectangle(self.style.bg_gc[gtk.STATE_ACTIVE],
                                       True, 0, 0, offset, allocation.height)
Ejemplo n.º 29
0
    def __init__(self, instance, timeline=None):
        goocanvas.Canvas.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.app = instance
        self._selected_sources = []
        self._tracks = []
        self.height = 0
        self._position = 0

        self._block_size_request = False
        self.props.integer_layout = True
        self.props.automatic_bounds = False
        self.props.clear_background = False
        self.get_root_item().set_simple_transform(0, 2.0, 1.0, 0)

        self._createUI()
        self.timeline = timeline
        self.settings = instance.settings
Ejemplo n.º 30
0
    def __init__(self, instance, timeline=None):
        goocanvas.Canvas.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.app = instance
        self._selected_sources = []
        self._tracks = []
        self._height = 0
        self._position = 0

        self._block_size_request = False
        self.props.integer_layout = True
        self.props.automatic_bounds = False
        self.props.clear_background = False
        self.get_root_item().set_simple_transform(0, 2.0, 1.0, 0)

        self._createUI()
        self.timeline = timeline
        self.settings = instance.settings
Ejemplo n.º 31
0
 def do_size_allocate(self, allocation):
     self.debug("ScaleRuler got %s", list(allocation))
     gtk.Layout.do_size_allocate(self, allocation)
     width = max(self.getMaxDurationWidth(), allocation.width)
     self.debug("Setting layout size to %d x %d", width, allocation.height)
     self.set_size(width, allocation.height)
     new_pos = Zoomable.nsToPixel(self.position) -\
         self.pixel_position_offset
     self.hadj.set_value(new_pos)
     # the size has changed, therefore we want to redo our pixmap
     self.doPixmap()
Ejemplo n.º 32
0
 def do_size_allocate(self, allocation):
     self.debug("ScaleRuler got %s", list(allocation))
     gtk.Layout.do_size_allocate(self, allocation)
     width = max(self.getMaxDurationWidth(), allocation.width)
     self.debug("Setting layout size to %d x %d",
                width, allocation.height)
     self.set_size(width, allocation.height)
     new_pos = Zoomable.nsToPixel(self.position) -\
         self.pixel_position_offset
     self.hadj.set_value(new_pos)
     # the size has changed, therefore we want to redo our pixmap
     self.doPixmap()
Ejemplo n.º 33
0
 def do_scroll_event(self, event):
     if event.state & gtk.gdk.SHIFT_MASK:
         # shift + scroll => vertical (up/down) scroll
         if event.direction == gtk.gdk.SCROLL_LEFT:
             event.direction = gtk.gdk.SCROLL_UP
         elif event.direction == gtk.gdk.SCROLL_RIGHT:
             event.direction = gtk.gdk.SCROLL_DOWN
         event.state &= ~gtk.gdk.SHIFT_MASK
     elif event.state & gtk.gdk.CONTROL_MASK:
         # zoom + scroll => zooming (up: zoom in)
         if event.direction == gtk.gdk.SCROLL_UP:
             Zoomable.zoomIn()
             return True
         elif event.direction == gtk.gdk.SCROLL_DOWN:
             Zoomable.zoomOut()
             return True
         return False
     else:
         if event.direction == gtk.gdk.SCROLL_UP:
             event.direction = gtk.gdk.SCROLL_LEFT
         elif event.direction == gtk.gdk.SCROLL_DOWN:
             event.direction = gtk.gdk.SCROLL_RIGHT
     return goocanvas.Canvas.do_scroll_event(self, event)
Ejemplo n.º 34
0
 def do_scroll_event(self, event):
     if event.state & gtk.gdk.SHIFT_MASK:
         # shift + scroll => vertical (up/down) scroll
         if event.direction == gtk.gdk.SCROLL_LEFT:
             event.direction = gtk.gdk.SCROLL_UP
         elif event.direction == gtk.gdk.SCROLL_RIGHT:
             event.direction = gtk.gdk.SCROLL_DOWN
         event.state &= ~gtk.gdk.SHIFT_MASK
     elif event.state & gtk.gdk.CONTROL_MASK:
         # zoom + scroll => zooming (up: zoom in)
         if event.direction == gtk.gdk.SCROLL_UP:
             Zoomable.zoomIn()
             return True
         elif event.direction == gtk.gdk.SCROLL_DOWN:
             Zoomable.zoomOut()
             return True
         return False
     else:
         if event.direction == gtk.gdk.SCROLL_UP:
             event.direction = gtk.gdk.SCROLL_LEFT
         elif event.direction == gtk.gdk.SCROLL_DOWN:
             event.direction = gtk.gdk.SCROLL_RIGHT
     return goocanvas.Canvas.do_scroll_event(self, event)
Ejemplo n.º 35
0
    def drawBackground(self, allocation):
        self.pixmap.draw_rectangle(
            self.style.bg_gc[gtk.STATE_NORMAL],
            True,
            0, 0,
            allocation.width, allocation.height)

        offset = int(Zoomable.nsToPixel(self.getShadedDuration())) - self.pixmap_offset
        if offset > 0:
            self.pixmap.draw_rectangle(
                self.style.bg_gc[gtk.STATE_ACTIVE],
                True,
                0, 0,
                int(offset),
                int(allocation.height))
Ejemplo n.º 36
0
 def _selectionEnd(self, item, target, event):
     seeker = self.app.current.seeker
     self.pointer_ungrab(self.get_root_item(), event.time)
     self._selecting = False
     self._marquee.props.visibility = goocanvas.ITEM_INVISIBLE
     if not self._got_motion_notify:
         self.timeline.setSelectionTo(set(), 0)
         seeker.seek(Zoomable.pixelToNs(event.x))
     else:
         self._got_motion_notify = False
         mode = 0
         if event.get_state() & gtk.gdk.SHIFT_MASK:
             mode = 1
         if event.get_state() & gtk.gdk.CONTROL_MASK:
             mode = 2
         self.timeline.setSelectionTo(self._objectsUnderMarquee(), mode)
     return True
Ejemplo n.º 37
0
 def _selectionEnd(self, item, target, event):
     seeker = self.app.current.seeker
     self.pointer_ungrab(self.get_root_item(), event.time)
     self._selecting = False
     self._marquee.props.visibility = goocanvas.ITEM_INVISIBLE
     if not self._got_motion_notify:
         self.timeline.setSelectionTo(set(), 0)
         seeker.seek(Zoomable.pixelToNs(event.x))
     else:
         self._got_motion_notify = False
         mode = 0
         if event.get_state() & gtk.gdk.SHIFT_MASK:
             mode = 1
         if event.get_state() & gtk.gdk.CONTROL_MASK:
             mode = 2
         self.timeline.setSelectionTo(self._objectsUnderMarquee(), mode)
     return True
Ejemplo n.º 38
0
 def do_simple_update(self, cr):
     cr.identity_matrix()
     if self.element.factory:
         self.bounds = goocanvas.Bounds(
             0, 0, Zoomable.nsToPixel(self.element.duration), self.height)
Ejemplo n.º 39
0
 def twidth(self):
     return Zoomable.nsToPixel(self.tdur)
Ejemplo n.º 40
0
Archivo: track.py Proyecto: qlf/Pitivi
 def _transitionRemoved(self, unused_timeline, transition):
     w = self.widgets[transition]
     self.remove_child(w)
     del self.widgets[transition]
     Zoomable.removeInstance(w)
Ejemplo n.º 41
0
 def tdur(self):
     return Zoomable.pixelToNs(self.twidth)
Ejemplo n.º 42
0
 def _objectRemoved(self, unused_timeline, track_object):
     w = self.widgets[track_object]
     self.remove_child(w)
     del self.widgets[track_object]
     Zoomable.removeInstance(w)
Ejemplo n.º 43
0
 def _request_size(self):
     alloc = self.get_allocation()
     w = Zoomable.nsToPixel(self.max_duration)
     h = max(self._height, alloc.height)
     self.set_bounds(0, 0, w, h)
     self._playhead.props.height = h + 10
Ejemplo n.º 44
0
 def _segment_for_time(self, time):
     # for audio files, we need to know the duration the segment spans
     return time, Zoomable.pixelToNs(self.twidth)
Ejemplo n.º 45
0
 def _hadjValueChangedCb(self, hadj):
     self.pixel_position_offset = Zoomable.nsToPixel(self.position) - hadj.get_value()
Ejemplo n.º 46
0
 def _request_size(self):
     alloc = self.get_allocation()
     w = Zoomable.nsToPixel(self.max_duration)
     h = max(self._height, alloc.height)
     self.set_bounds(0, 0, w, h)
     self._playhead.props.height = h + 10
Ejemplo n.º 47
0
 def set_pos(self, item, pos):
     self._canvas.app.current.seeker.seek(
         Zoomable.pixelToNs(pos[0]))
Ejemplo n.º 48
0
 def tdur(self):
     return Zoomable.pixelToNs(self.twidth)
Ejemplo n.º 49
0
 def twidth(self):
     return Zoomable.nsToPixel(self.tdur)
Ejemplo n.º 50
0
 def _hadjValueChangedCb(self, hadj):
     self.pixel_position_offset = Zoomable.nsToPixel(
         self.position) - hadj.get_value()
Ejemplo n.º 51
0
 def _request_size(self):
     w = Zoomable.nsToPixel(self.max_duration)
     self.set_bounds(0, 0, w, self._height)
     self._razor.props.height = self._height
     self.get_root_item().changed(True)
Ejemplo n.º 52
0
 def _transitionRemoved(self, unused_timeline, transition):
     w = self.widgets[transition]
     self.remove_child(w)
     del self.widgets[transition]
     Zoomable.removeInstance(w)
Ejemplo n.º 53
0
 def _objectRemoved(self, unused_timeline, track_object):
     if not isinstance (track_object, TrackEffect):
         w = self.widgets[track_object]
         self.remove_child(w)
         del self.widgets[track_object]
         Zoomable.removeInstance(w)
Ejemplo n.º 54
0
 def set_pos(self, item, pos):
     self._canvas.app.current.seeker.seek(Zoomable.pixelToNs(pos[0]))
Ejemplo n.º 55
0
 def set_pos(self, item, pos):
     x, y = pos
     x += self._hadj.get_value()
     self._canvas.app.current.seeker.seek(Zoomable.pixelToNs(x))
Ejemplo n.º 56
0
 def set_pos(self, item, pos):
     x, y = pos
     x += self._hadj.get_value()
     self._canvas.app.current.seeker.seek(Zoomable.pixelToNs(x))