def __init__(self, ges_elem): Previewer.__init__(self, GES.TrackType.AUDIO) Zoomable.__init__(self) Loggable.__init__(self) self.pipeline = None self._wavebin = None self.discovered = False self.ges_elem = ges_elem self.timeline = ges_elem.get_parent().get_timeline().ui asset = self.ges_elem.get_parent().get_asset() self.n_samples = asset.get_duration() / SAMPLE_DURATION self.samples = None self.peaks = None self._start = 0 self._end = 0 self._surface_x = 0 # Guard against malformed URIs self.wavefile = None self._uri = quote_uri(get_proxy_target(ges_elem).props.id) self._num_failures = 0 self.adapter = None self.surface = None self._force_redraw = True self.ges_elem.connect("notify::in-point", self._inpointChangedCb)
def __init__(self, ges_layer, timeline): Gtk.EventBox.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.ges_layer = ges_layer self.ges_layer.ui = self self.timeline = timeline self.app = timeline.app self.ges_layer.connect("clip-added", self._clipAddedCb) self.ges_layer.connect("clip-removed", self._clipRemovedCb) # FIXME Make the layer height user setable with 'Paned' self.props.height_request = ui.LAYER_HEIGHT / 2 self.props.valign = Gtk.Align.START self._layout = LayerLayout(self.timeline) self._layout.connect("remove", self.__childWidgetRemovedCb) self.add(self._layout) self.media_types = GES.TrackType(0) for clip in ges_layer.get_clips(): self._addClip(clip) self.before_sep = SpacedSeparator(Gtk.PositionType.TOP) self.after_sep = SpacedSeparator(Gtk.PositionType.BOTTOM)
def __init__(self, timeline, hadj): Gtk.DrawingArea.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.log("Creating new ScaleRuler") self.timeline = timeline self._pipeline = None self.hadj = hadj hadj.connect("value-changed", self._hadjValueChangedCb) self.add_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.SCROLL_MASK) self.pixbuf = None # all values are in pixels self.pixbuf_offset = 0 self.pixbuf_offset_painted = 0 self.position = 0 # In nanoseconds self.frame_rate = Gst.Fraction(1 / 1) self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND self.playhead_pixbuf = GdkPixbuf.Pixbuf.new_from_file( os.path.join(configure.get_pixmap_dir(), "pitivi-playhead.svg")) self.scales = SCALES
def __init__(self, bElement): super(AudioPreviewer, self).__init__() PreviewGenerator.__init__(self, GES.TrackType.AUDIO) Zoomable.__init__(self) Loggable.__init__(self) self.pipeline = None self.discovered = False self.bElement = bElement self.timeline = bElement.get_parent().get_timeline().ui self.nSamples = self.bElement.get_parent().get_asset().get_duration() / 10000000 self._start = 0 self._end = 0 self._surface_x = 0 # Guard against malformed URIs self._uri = quote_uri(bElement.props.uri) self._num_failures = 0 self.adapter = None self.surface = None self._force_redraw = True self.bElement.connect("notify::in-point", self._inpointChangedCb)
def __init__(self, bElement, timeline): Clutter.Actor.__init__(self) PreviewGenerator.__init__(self, GES.TrackType.AUDIO) Zoomable.__init__(self) Loggable.__init__(self) self.pipeline = None self.discovered = False self.bElement = bElement self._uri = quote_uri(bElement.props.uri) # Guard against malformed URIs self.timeline = timeline self.actors = [] self.set_content_scaling_filters(Clutter.ScalingFilter.NEAREST, Clutter.ScalingFilter.NEAREST) self.canvas = Clutter.Canvas() self.set_content(self.canvas) self.width = 0 self._num_failures = 0 self.lastUpdate = None self.current_geometry = (-1, -1) self.adapter = None self.surface = None self.timeline.connect("scrolled", self._scrolledCb) self.canvas.connect("draw", self._drawContentCb) self.canvas.invalidate() self._callback_id = 0
def __init__(self, ges_elem, max_cpu_usage): Previewer.__init__(self, GES.TrackType.AUDIO, max_cpu_usage) Zoomable.__init__(self) Loggable.__init__(self) self.pipeline = None self._wavebin = None self.ges_elem = ges_elem self.samples = None self.peaks = None self.surface = None # The zoom level when self.surface has been created. self._surface_zoom_level = 0 # The samples range used when self.surface has been created. self._surface_start_ns = 0 self._surface_end_ns = 0 # Guard against malformed URIs self.wavefile = None self._uri = quote_uri(get_proxy_target(ges_elem).props.id) self._num_failures = 0 self.become_controlled()
def __init__(self, ges_elem, max_cpu_usage): Previewer.__init__(self, GES.TrackType.AUDIO, max_cpu_usage) Zoomable.__init__(self) Loggable.__init__(self) self.pipeline = None self._wavebin = None self.discovered = False self.ges_elem = ges_elem asset = self.ges_elem.get_parent().get_asset() self.n_samples = asset.get_duration() / SAMPLE_DURATION self.samples = None self.peaks = None self._start = 0 self._end = 0 self._surface_x = 0 # Guard against malformed URIs self.wavefile = None self._uri = quote_uri(get_proxy_target(ges_elem).props.id) self._num_failures = 0 self.adapter = None self.surface = None self._force_redraw = True self.ges_elem.connect("notify::in-point", self._inpoint_changed_cb) self.connect("notify::height-request", self._height_changed_cb) self.become_controlled()
def __init__(self, bElement, track, timeline): """ @param bElement : the backend GES.TrackElement @param track : the track to which the bElement belongs @param timeline : the containing graphic timeline. """ Zoomable.__init__(self) Clutter.Actor.__init__(self) self.timeline = timeline self.bElement = bElement self.bElement.selected = Selected() self.track_type = self.bElement.get_track_type() # This won't change self.isDragged = False size = self.bElement.get_duration() self._createBackground(track) self._createPreview() self._createBorder() self._createMarquee() self._createHandles() self._createGhostclip() self.update(True) self.set_reactive(True) self._connectToEvents()
def __init__(self, bElement, timeline): Clutter.Actor.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) PreviewGenerator.__init__(self, GES.TrackType.AUDIO) self.pipeline = None self.discovered = False self.bElement = bElement self._uri = quote_uri(bElement.props.uri) # Guard against malformed URIs self.timeline = timeline self.actors = [] self.set_content_scaling_filters(Clutter.ScalingFilter.NEAREST, Clutter.ScalingFilter.NEAREST) self.canvas = Clutter.Canvas() self.set_content(self.canvas) self.width = 0 self._num_failures = 0 self.lastUpdate = datetime.now() self.interval = timedelta(microseconds=INTERVAL) self.current_geometry = (-1, -1) self.adapter = None self.surface = None self.timeline.connect("scrolled", self._scrolledCb) self.canvas.connect("draw", self._drawContentCb) self.canvas.invalidate() self._callback_id = 0
def __init__(self, app, hadj=None): Gtk.EventBox.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.layout = Gtk.Layout() self.add(self.layout) self.get_style_context().add_class("MarkersBox") self.app = app if hadj: hadj.connect("value-changed", self._hadj_value_changed_cb) self.props.hexpand = True self.props.valign = Gtk.Align.START self.offset = 0 self.props.height_request = MARKER_WIDTH self.__markers_container = None self.marker_moving = None self.marker_new = None self.add_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK) self._create_actions()
def __init__(self, instance, hadj): gtk.DrawingArea.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.log("Creating new ScaleRuler") self.app = instance self._seeker = Seeker() self.hadj = hadj hadj.connect("value-changed", self._hadjValueChangedCb) self.add_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK) self.pixbuf = None # all values are in pixels self.pixbuf_offset = 0 self.pixbuf_offset_painted = 0 # This is the number of width we allocate for the pixbuf self.pixbuf_multiples = 4 self.position = 0 # In nanoseconds self.pressed = False self.need_update = True self.min_frame_spacing = 5.0 self.frame_height = 5.0 self.frame_rate = gst.Fraction(1 / 1)
def __init__(self, gui, instance, ui_manager): Zoomable.__init__(self) Gtk.VBox.__init__(self) GObject.threads_init() self.gui = gui self.ui_manager = ui_manager self.app = instance self._settings = None if self.app: self._settings = self.app.settings self._projectmanager = None self._project = None self.pipeline = None self._createUi() self._createActions() self._setUpDragAndDrop() if self._settings: self._settings.connect("edgeSnapDeadbandChanged", self._snapDistanceChangedCb) # Standalone if not self._settings: gtksettings = Gtk.Settings.get_default() gtksettings.set_property("gtk-application-prefer-dark-theme", True) self.show_all()
def __init__(self, timeline): Gtk.DrawingArea.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.log("Creating new ScaleRuler") self.timeline = timeline self._pipeline = None hadj = timeline.timeline.hadj hadj.connect("value-changed", self._hadj_value_changed_cb) self.add_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.SCROLL_MASK) self.pixbuf = None # all values are in pixels self.pixbuf_offset = 0 self.pixbuf_offset_painted = 0 self.position = 0 # In nanoseconds self.frame_rate = Gst.Fraction(1 / 1) self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND self.scales = SCALES
def __init__(self, ges_elem, max_cpu_usage): Previewer.__init__(self, GES.TrackType.AUDIO, max_cpu_usage) Zoomable.__init__(self) Loggable.__init__(self) self.pipeline = None self._wavebin = None self.discovered = False self.ges_elem = ges_elem self.timeline = ges_elem.get_parent().get_timeline().ui asset = self.ges_elem.get_parent().get_asset() self.n_samples = asset.get_duration() / SAMPLE_DURATION self.samples = None self.peaks = None self._start = 0 self._end = 0 self._surface_x = 0 # Guard against malformed URIs self.wavefile = None self._uri = quote_uri(get_proxy_target(ges_elem).props.id) self._num_failures = 0 self.adapter = None self.surface = None self._force_redraw = True self.ges_elem.connect("notify::in-point", self._inpoint_changed_cb) self.connect("notify::height-request", self._height_changed_cb) self.becomeControlled()
def __init__(self, bElement, track, timeline): """ @param bElement : the backend GES.TrackElement @param track : the track to which the bElement belongs @param timeline : the containing graphic timeline. """ Zoomable.__init__(self) Clutter.Actor.__init__(self) self.timeline = timeline self.bElement = bElement self.bElement.selected = Selected() self.bElement.ui_element = self self.track_type = self.bElement.get_track_type() # This won't change self.isDragged = False self.lines = [] self.keyframes = [] self.source = None self.keyframedElement = None size = self.bElement.get_duration() self._createBackground(track) self._createPreview() self._createBorder() self._createMarquee() self._createHandles() self._createGhostclip() self.update(True) self.set_reactive(True) self.isSelected = False self._createMixingKeyframes() self._connectToEvents()
def __init__(self, instance, hadj): Gtk.DrawingArea.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.log("Creating new ScaleRuler") self.app = instance self._seeker = Seeker() self.hadj = hadj hadj.connect("value-changed", self._hadjValueChangedCb) self.add_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.SCROLL_MASK) self.pixbuf = None # all values are in pixels self.pixbuf_offset = 0 self.pixbuf_offset_painted = 0 # This is the number of width we allocate for the pixbuf self.pixbuf_multiples = 4 self.position = 0 # In nanoseconds self.pressed = False self.min_frame_spacing = 5.0 self.frame_height = 5.0 self.frame_rate = Gst.Fraction(1 / 1) self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND self.connect('draw', self.drawCb) self.connect('configure-event', self.configureEventCb) self.callback_id = None self.callback_id_scroll = None
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 # ghetto hack self.hadj = instance.gui.timeline_ui.hadj
def __init__(self, timeline_container): Zoomable.__init__(self) ScaleRuler.__init__(self, self, self.app.settings, self.app.gui.get_style_context()) self.log("Creating new TimelineScaleRuler") self.timeline_container = timeline_container timeline_container.timeline.hadj.connect("value-changed", self._hadj_value_changed_cb)
def __init__(self, instance, track, timeline=None): GooCanvas.CanvasGroup.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.app = instance self.widgets = {} self.transitions = [] self.timeline = timeline self._track = None self.track = track self._expanded = True
def __init__(self, container): Clutter.ScrollActor.__init__(self) Zoomable.__init__(self) self.bTimeline = None self._container = container self.elements = [] self.ghostClips = [] self.selection = Selection() self._scroll_point = Clutter.Point() self.lastPosition = 0 # Saved for redrawing when paused self._createPlayhead() self._createSnapIndicator()
def __init__(self, timeline, hadj): Gtk.DrawingArea.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.log("Creating new ScaleRuler") # Allows stealing focus from other GTK widgets, prevent accidents: self.props.can_focus = True self.connect("focus-in-event", self._focusInCb) self.connect("focus-out-event", self._focusOutCb) self.timeline = timeline self._background_color = timeline.get_style_context().lookup_color( 'theme_bg_color')[1] self._seeker = Seeker() self.hadj = hadj hadj.connect("value-changed", self._hadjValueChangedCb) self.add_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.SCROLL_MASK) self.pixbuf = None # all values are in pixels self.pixbuf_offset = 0 self.pixbuf_offset_painted = 0 # This is the number of width we allocate for the pixbuf self.pixbuf_multiples = 4 self.position = 0 # In nanoseconds self.pressed = False self.frame_rate = Gst.Fraction(1 / 1) self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND self.connect('draw', self.drawCb) self.connect('configure-event', self.configureEventCb) self.callback_id = None self.callback_id_scroll = None self.set_size_request(0, HEIGHT) style = self.get_style_context() color_normal = style.get_color(Gtk.StateFlags.NORMAL) color_insensitive = style.get_color(Gtk.StateFlags.INSENSITIVE) self._color_normal = color_normal self._color_dimmed = Gdk.RGBA( *[(x * 3 + y * 2) / 5 for x, y in ((color_normal.red, color_insensitive.red), (color_normal.green, color_insensitive.green), (color_normal.blue, color_insensitive.blue))]) self.scales = SCALES
def __init__(self, instance, element, timeline, **kwargs): self.app = instance self.element = element self.timeline = timeline self.movable = True self.current_pixbuf = TRIMBAR_PIXBUF goocanvas.Image.__init__(self, pixbuf=self.current_pixbuf, line_width=0, pointer_events=goocanvas.EVENTS_FILL, **kwargs) View.__init__(self, instance, ges.EDIT_MODE_TRIM) Zoomable.__init__(self) Loggable.__init__(self)
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)
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 # FIXME PyGI port #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)
def __init__(self, instance, element, timeline, **kwargs): self.app = instance self.element = element self.timeline = timeline self.movable = True self.current_pixbuf = TRIMBAR_PIXBUF GooCanvas.CanvasImage.__init__(self, pixbuf=self.current_pixbuf, line_width=0, pointer_events=GooCanvas.CanvasPointerEvents.FILL, **kwargs) View.__init__(self, instance, GES.EditMode.EDIT_TRIM) Zoomable.__init__(self) Loggable.__init__(self)
def __init__(self, bElement, timeline): Zoomable.__init__(self) Clutter.Actor.__init__(self) self.timeline = timeline self.bElement = bElement self.bElement.selected = Selected() self.bElement.ui_element = weakref.proxy(self) self.track_type = self.bElement.get_track_type() # This won't change self.isDragged = False self.lines = [] self.keyframes = [] self.keyframesVisible = False self.source = None self.keyframedElement = None self.rightHandle = None self.isSelected = False self.updating_keyframes = False size = self.bElement.get_duration() self.background = self._createBackground() self.background.set_position(1, 1) self.add_child(self.background) self.preview = self._createPreview() self.add_child(self.preview) self.border = self._createBorder() self.add_child(self.border) self.set_child_below_sibling(self.border, self.background) self.marquee = self._createMarquee() self.add_child(self.marquee) self._createHandles() self._linesMarker = self._createMarker() self._keyframesMarker = self._createMarker() self._createGhostclip() self.update(True) self.set_reactive(True) self._createMixingKeyframes() self._connectToEvents()
def __init__(self, timeline): Gtk.Grid.__init__(self) Zoomable.__init__(self) self._manual_set = False self.timeline = timeline zoom_fit_btn = Gtk.Button() zoom_fit_btn.set_relief(Gtk.ReliefStyle.NONE) zoom_fit_btn.set_tooltip_text(_("Zoom Fit")) zoom_fit_btn_grid = Gtk.Grid() zoom_fit_icon = Gtk.Image.new_from_icon_name( "zoom-best-fit", Gtk.IconSize.BUTTON) zoom_fit_btn_grid.add(zoom_fit_icon) zoom_fit_btn_label = Gtk.Label(label=_("Zoom")) zoom_fit_btn_grid.add(zoom_fit_btn_label) zoom_fit_btn_grid.set_column_spacing(SPACING / 2) zoom_fit_btn.add(zoom_fit_btn_grid) zoom_fit_btn.connect("clicked", self._zoomFitCb) self.attach(zoom_fit_btn, 0, 0, 1, 1) # zooming slider self._zoomAdjustment = Gtk.Adjustment() self._zoomAdjustment.props.lower = 0 self._zoomAdjustment.props.upper = Zoomable.zoom_steps zoomslider = Gtk.Scale.new( Gtk.Orientation.HORIZONTAL, adjustment=self._zoomAdjustment) # Setting _zoomAdjustment's value must be done after we create the # zoom slider, otherwise the slider remains at the leftmost position. self._zoomAdjustment.set_value(Zoomable.getCurrentZoomLevel()) zoomslider.props.draw_value = False zoomslider.connect("scroll-event", self._zoomSliderScrollCb) zoomslider.connect("value-changed", self._zoomAdjustmentChangedCb) zoomslider.connect("query-tooltip", self._sliderTooltipCb) zoomslider.set_has_tooltip(True) # At least 100px wide for precision zoomslider.set_size_request(100, 0) zoomslider.set_hexpand(True) self.attach(zoomslider, 1, 0, 1, 1) # Empty label so we have some spacing at the right of the zoomslider self.attach(Gtk.Label(label=""), 2, 0, 1, 1) self.set_hexpand(False) self.set_column_spacing(ZOOM_SLIDER_PADDING) self.set_size_request(CONTROL_WIDTH, -1) self.show_all()
def __init__(self, timeline): Gtk.Grid.__init__(self) Zoomable.__init__(self) self._manual_set = False self.timeline = timeline zoom_fit_btn = Gtk.Button() zoom_fit_btn.set_relief(Gtk.ReliefStyle.NONE) zoom_fit_btn.set_tooltip_text(_("Zoom Fit")) zoom_fit_btn_grid = Gtk.Grid() zoom_fit_icon = Gtk.Image.new_from_icon_name("zoom-fit-best", Gtk.IconSize.BUTTON) zoom_fit_btn_grid.add(zoom_fit_icon) zoom_fit_btn_label = Gtk.Label(label=_("Zoom")) zoom_fit_btn_grid.add(zoom_fit_btn_label) zoom_fit_btn_grid.set_column_spacing(SPACING / 2) zoom_fit_btn.add(zoom_fit_btn_grid) zoom_fit_btn.connect("clicked", self._zoomFitCb) self.attach(zoom_fit_btn, 0, 0, 1, 1) # zooming slider self._zoomAdjustment = Gtk.Adjustment() self._zoomAdjustment.props.lower = 0 self._zoomAdjustment.props.upper = Zoomable.zoom_steps zoomslider = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, adjustment=self._zoomAdjustment) # Setting _zoomAdjustment's value must be done after we create the # zoom slider, otherwise the slider remains at the leftmost position. self._zoomAdjustment.set_value(Zoomable.getCurrentZoomLevel()) zoomslider.props.draw_value = False zoomslider.connect("scroll-event", self._zoomSliderScrollCb) zoomslider.connect("value-changed", self._zoomAdjustmentChangedCb) zoomslider.connect("query-tooltip", self._sliderTooltipCb) zoomslider.set_has_tooltip(True) # At least 100px wide for precision zoomslider.set_size_request(100, 0) zoomslider.set_hexpand(True) self.attach(zoomslider, 1, 0, 1, 1) # Empty label so we have some spacing at the right of the zoomslider self.attach(Gtk.Label(label=""), 2, 0, 1, 1) self.set_hexpand(False) self.set_column_spacing(ZOOM_SLIDER_PADDING) self.show_all()
def __init__(self, ges_elem, max_cpu_usage): Previewer.__init__(self, GES.TrackType.VIDEO, max_cpu_usage) Zoomable.__init__(self) Loggable.__init__(self) # Variables related to the timeline objects self.timeline = ges_elem.get_parent().get_timeline().ui self.ges_elem = ges_elem # Guard against malformed URIs self.uri = quote_uri(get_proxy_target(ges_elem).props.id) self.__preroll_timeout_id = 0 # Variables related to thumbnailing self.wishlist = [] self.queue = [] self._thumb_cb_id = None self._running = False # We should have one thumbnail per thumb_period. # TODO: get this from the user settings self.thumb_period = int(0.5 * Gst.SECOND) self.thumb_height = THUMB_HEIGHT self.__image_pixbuf = None if isinstance(ges_elem, GES.ImageSource): self.__image_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale( Gst.uri_get_location(self.uri), -1, self.thumb_height, True) self.thumbs = {} self.thumb_cache = ThumbnailCache.get(self.uri) self._ensure_proxy_thumbnails_cache() self.thumb_width, unused_height = self.thumb_cache.getImagesSize() self.cpu_usage_tracker = CPUUsageTracker() self.interval = 500 # Every 0.5 second, reevaluate the situation # Connect signals and fire things up self.ges_elem.connect("notify::in-point", self._inpoint_changed_cb) self.pipeline = None self.gdkpixbufsink = None self.becomeControlled() self.connect("notify::height-request", self._height_changed_cb)
def __init__(self, ges_elem, max_cpu_usage): Previewer.__init__(self, GES.TrackType.VIDEO, max_cpu_usage) Zoomable.__init__(self) Loggable.__init__(self) self.ges_elem = ges_elem # Guard against malformed URIs self.uri = quote_uri(get_proxy_target(ges_elem).props.id) self.__start_id = 0 self.__preroll_timeout_id = 0 self._thumb_cb_id = 0 # The thumbs to be generated. self.queue = [] # The position for which a thumbnail is currently being generated. self.position = -1 # The positions for which we failed to get a pixbuf. self.failures = set() self._thumb_cb_id = None self.thumbs = {} self.thumb_height = THUMB_HEIGHT self.thumb_width = 0 self.__image_pixbuf = None if not isinstance(ges_elem, GES.ImageSource): self.thumb_cache = ThumbnailCache.get(self.uri) self._ensure_proxy_thumbnails_cache() self.thumb_width, unused_height = self.thumb_cache.image_size self.pipeline = None self.gdkpixbufsink = None self.cpu_usage_tracker = CPUUsageTracker() # Initial delay before generating the next thumbnail, in millis. self.interval = 500 # Connect signals and fire things up self.ges_elem.connect("notify::in-point", self._inpoint_changed_cb) self.ges_elem.connect("notify::duration", self._duration_changed_cb) self.become_controlled() self.connect("notify::height-request", self._height_changed_cb)
def __init__(self, instance, element, track, timeline, utrack): goocanvas.Group.__init__(self) View.__init__(self, instance) Zoomable.__init__(self) Loggable.__init__(self) self.ref = Zoomable.nsToPixel(10000000000) self.app = instance self.track = track self.utrack = utrack self.timeline = timeline self.namewidth = 0 self.nameheight = 0 self._element = None self._settings = None self.movable = True self.bg = goocanvas.Rect(height=self.height, line_width=1) self.name = goocanvas.Text( x=NAME_HOFFSET + NAME_PADDING, y=NAME_VOFFSET + NAME_PADDING, operator=cairo.OPERATOR_ADD, alignment=pango.ALIGN_LEFT) self.namebg = goocanvas.Rect( radius_x=2, radius_y=2, x=NAME_HOFFSET, y=NAME_VOFFSET, line_width=0) self.start_handle = StartHandle(self.app, element, timeline, height=self.height) self.end_handle = EndHandle(self.app, element, timeline, height=self.height) self._selec_indic = goocanvas.Rect( visibility=goocanvas.ITEM_INVISIBLE, line_width=0.0, height=self.height) self.element = element element.selected = Selected() element.selected.connect("selected-changed", self.selectedChangedCb) obj = self.element.get_timeline_object() self.settings = instance.settings self.unfocus()
def __init__(self, bElement, timeline): """ @param bElement : the backend GES.TrackElement @param track : the track to which the bElement belongs @param timeline : the containing graphic timeline. """ Zoomable.__init__(self) Clutter.ScrollActor.__init__(self) Loggable.__init__(self) PreviewGenerator.__init__(self, GES.TrackType.VIDEO) # Variables related to the timeline objects self.timeline = timeline self.bElement = bElement self.uri = quote_uri(bElement.props.uri) # Guard against malformed URIs self.duration = bElement.props.duration # Variables related to thumbnailing self.wishlist = [] self._callback_id = None self._thumb_cb_id = None self._allAnimated = False self._running = False # We should have one thumbnail per thumb_period. # TODO: get this from the user settings self.thumb_period = long(0.5 * Gst.SECOND) self.thumb_margin = BORDER_WIDTH self.thumb_height = EXPANDED_SIZE - 2 * self.thumb_margin self.thumb_width = None # will be set by self._setupPipeline() # Maps (quantized) times to Thumbnail objects self.thumbs = {} self.thumb_cache = get_cache_for_uri(self.uri) self.cpu_usage_tracker = CPUUsageTracker() self.interval = 500 # Every 0.5 second, reevaluate the situation # Connect signals and fire things up self.timeline.connect("scrolled", self._scrollCb) self.bElement.connect("notify::duration", self._durationChangedCb) self.bElement.connect("notify::in-point", self._inpointChangedCb) self.bElement.connect("notify::start", self._startChangedCb) self.pipeline = None self.becomeControlled()
def __init__(self, bElement, timeline): """ @param bElement : the backend GES.TrackElement @param track : the track to which the bElement belongs @param timeline : the containing graphic timeline. """ Clutter.ScrollActor.__init__(self) PreviewGenerator.__init__(self, GES.TrackType.VIDEO) Zoomable.__init__(self) Loggable.__init__(self) # Variables related to the timeline objects self.timeline = timeline self.bElement = bElement # Guard against malformed URIs self.uri = quote_uri(bElement.props.uri) self.duration = bElement.props.duration # Variables related to thumbnailing self.wishlist = [] self._thumb_cb_id = None self._allAnimated = False self._running = False # We should have one thumbnail per thumb_period. # TODO: get this from the user settings self.thumb_period = int(0.5 * Gst.SECOND) self.thumb_height = EXPANDED_SIZE - 2 * THUMB_MARGIN_PX self.thumb_width = None # will be set by self._setupPipeline() # Maps (quantized) times to Thumbnail objects self.thumbs = {} self.thumb_cache = get_cache_for_uri(self.uri) self.cpu_usage_tracker = CPUUsageTracker() self.interval = 500 # Every 0.5 second, reevaluate the situation # Connect signals and fire things up self.timeline.connect("scrolled", self._scrollCb) self.bElement.connect("notify::duration", self._durationChangedCb) self.bElement.connect("notify::in-point", self._inpointChangedCb) self.bElement.connect("notify::start", self._startChangedCb) self.pipeline = None self.becomeControlled()
def __init__(self, ges_elem): """ @param ges_elem : the backend GES.TrackElement @param track : the track to which the ges_elem belongs """ Previewer.__init__(self, GES.TrackType.VIDEO) Zoomable.__init__(self) Loggable.__init__(self) # Variables related to the timeline objects self.timeline = ges_elem.get_parent().get_timeline().ui self.ges_elem = ges_elem # Guard against malformed URIs self.uri = quote_uri(get_proxy_target(ges_elem).props.id) # Variables related to thumbnailing self.wishlist = [] self.queue = [] self._thumb_cb_id = None self._running = False # We should have one thumbnail per thumb_period. # TODO: get this from the user settings self.thumb_period = int(0.5 * Gst.SECOND) self.thumb_height = THUMB_HEIGHT # Maps (quantized) times to Thumbnail objects self.thumbs = {} self.thumb_cache = getThumbnailCache(self.uri) self.thumb_width, unused_height = self.thumb_cache.getImagesSize() self.cpu_usage_tracker = CPUUsageTracker() self.interval = 500 # Every 0.5 second, reevaluate the situation # Connect signals and fire things up self.ges_elem.connect("notify::in-point", self._inpointChangedCb) self.pipeline = None self.gdkpixbufsink = None self.__last_rectangle = Gdk.Rectangle() self.becomeControlled() self.connect("notify::height-request", self._heightChangedCb)
def __init__(self, layer, ges_clip): Gtk.EventBox.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) name = ges_clip.get_name() self.set_name(name) self.get_accessible().set_name(name) self.handles = [] self.z_order = -1 self.timeline = layer.timeline self.app = layer.app self.ges_clip = ges_clip self.ges_clip.ui = self self.ges_clip.selected = Selected() self._audioSource = None self._videoSource = None self._setupWidget() self.__force_position_update = True for child in self.ges_clip.get_children(False): self._childAdded(self.ges_clip, child) self.__connectToChild(child) # Connect to Widget signals. self.connect("button-release-event", self.__buttonReleaseEventCb) self.connect("event", self._eventCb) # Connect to GES signals. self.ges_clip.connect("notify::start", self._startChangedCb) self.ges_clip.connect("notify::inpoint", self._startChangedCb) self.ges_clip.connect("notify::duration", self._durationChangedCb) self.ges_clip.connect("notify::layer", self._layerChangedCb) self.ges_clip.connect_after("child-added", self._childAddedCb) self.ges_clip.connect_after("child-removed", self._childRemovedCb) # To be able to receive effects dragged on clips. self.drag_dest_set(0, [ui.EFFECT_TARGET_ENTRY], Gdk.DragAction.COPY) self.connect("drag-drop", self.__dragDropCb)
def __init__(self, layer, ges_clip): Gtk.EventBox.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) name = ges_clip.get_name() self.set_name(name) self.get_accessible().set_name(name) self.handles = [] self.z_order = -1 self.timeline = layer.timeline self.app = layer.app self.ges_clip = ges_clip self.ges_clip.ui = self self.ges_clip.selected = Selected() self._audioSource = None self._videoSource = None self._setupWidget() self.__force_position_update = True for ges_timeline_element in self.ges_clip.get_children(False): self._add_child(ges_timeline_element) self.__connect_to_child(ges_timeline_element) # Connect to Widget signals. self.connect("button-release-event", self._button_release_event_cb) self.connect("event", self._eventCb) # Connect to GES signals. self.ges_clip.connect("notify::start", self._startChangedCb) self.ges_clip.connect("notify::inpoint", self._startChangedCb) self.ges_clip.connect("notify::duration", self._durationChangedCb) self.ges_clip.connect("notify::layer", self._layerChangedCb) self.ges_clip.connect_after("child-added", self._child_added_cb) self.ges_clip.connect_after("child-removed", self._child_removed_cb) # To be able to receive effects dragged on clips. self.drag_dest_set(0, [EFFECT_TARGET_ENTRY], Gdk.DragAction.COPY) self.connect("drag-drop", self.__dragDropCb)
def __init__(self, bElement): """ @param bElement : the backend GES.TrackElement @param track : the track to which the bElement belongs """ super(VideoPreviewer, self).__init__() PreviewGenerator.__init__(self, GES.TrackType.VIDEO) Zoomable.__init__(self) Loggable.__init__(self) # Variables related to the timeline objects self.timeline = bElement.get_parent().get_timeline().ui self.bElement = bElement # Guard against malformed URIs self.uri = quote_uri(bElement.props.uri) # Variables related to thumbnailing self.wishlist = [] self._thumb_cb_id = None self._running = False # We should have one thumbnail per thumb_period. # TODO: get this from the user settings self.thumb_period = int(0.5 * Gst.SECOND) self.thumb_height = EXPANDED_SIZE - 2 * THUMB_MARGIN_PX # Maps (quantized) times to Thumbnail objects self.thumbs = {} self.thumb_cache = get_cache_for_uri(self.uri) self.thumb_width, unused_height = self.thumb_cache.getImagesSize() self.cpu_usage_tracker = CPUUsageTracker() self.interval = 500 # Every 0.5 second, reevaluate the situation # Connect signals and fire things up self.bElement.connect("notify::in-point", self._inpointChangedCb) self.pipeline = None self.__last_rectangle = Gdk.Rectangle() self.becomeControlled() self.connect("notify::height-request", self._heightChangedCb)
def __init__(self, timeline): """ This will hold the widgets responsible for zooming. """ Gtk.HBox.__init__(self) Zoomable.__init__(self) self.timeline = timeline zoom_fit_btn = Gtk.Button() zoom_fit_btn.set_relief(Gtk.ReliefStyle.NONE) zoom_fit_btn.set_tooltip_text(ZOOM_FIT) zoom_fit_icon = Gtk.Image() zoom_fit_icon.set_from_stock(Gtk.STOCK_ZOOM_FIT, Gtk.IconSize.BUTTON) zoom_fit_btn_hbox = Gtk.HBox() zoom_fit_btn_hbox.pack_start(zoom_fit_icon, False, True, 0) zoom_fit_btn_hbox.pack_start(Gtk.Label(_("Zoom")), False, True, 0) zoom_fit_btn.add(zoom_fit_btn_hbox) zoom_fit_btn.connect("clicked", self._zoomFitCb) self.pack_start(zoom_fit_btn, False, True, 0) # zooming slider self._zoomAdjustment = Gtk.Adjustment() self._zoomAdjustment.set_value(Zoomable.getCurrentZoomLevel()) self._zoomAdjustment.connect("value-changed", self._zoomAdjustmentChangedCb) self._zoomAdjustment.props.lower = 0 self._zoomAdjustment.props.upper = Zoomable.zoom_steps zoomslider = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, adjustment=self._zoomAdjustment) zoomslider.props.draw_value = False zoomslider.set_tooltip_text(_("Zoom Timeline")) zoomslider.connect("scroll-event", self._zoomSliderScrollCb) zoomslider.set_size_request(100, 0) # At least 100px wide for precision self.pack_start(zoomslider, True, True, 0) self.show_all() self._updateZoomSlider = True
def __init__(self, timeline): """ This will hold the widgets responsible for zooming. """ Gtk.HBox.__init__(self) Zoomable.__init__(self) self.timeline = timeline zoom_fit_btn = Gtk.Button() zoom_fit_btn.set_relief(Gtk.ReliefStyle.NONE) zoom_fit_btn.set_tooltip_text(ZOOM_FIT) zoom_fit_icon = Gtk.Image.new_from_icon_name("zoom-best-fit", Gtk.IconSize.BUTTON) zoom_fit_btn_hbox = Gtk.HBox() zoom_fit_btn_hbox.pack_start(zoom_fit_icon, expand=False, fill=True, padding=0) zoom_fit_btn_hbox.pack_start(Gtk.Label(label=_("Zoom")), expand=False, fill=True, padding=0) zoom_fit_btn.add(zoom_fit_btn_hbox) zoom_fit_btn.connect("clicked", self._zoomFitCb) self.pack_start(zoom_fit_btn, expand=False, fill=True, padding=0) # zooming slider self._zoomAdjustment = Gtk.Adjustment() self._zoomAdjustment.props.lower = 0 self._zoomAdjustment.props.upper = Zoomable.zoom_steps zoomslider = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, adjustment=self._zoomAdjustment) # Setting _zoomAdjustment's value must be done after we create the # zoom slider, otherwise the slider remains at the leftmost position. self._zoomAdjustment.set_value(Zoomable.getCurrentZoomLevel()) self._zoomAdjustment.connect("value-changed", self._zoomAdjustmentChangedCb) zoomslider.props.draw_value = False zoomslider.set_tooltip_text(_("Zoom Timeline")) zoomslider.connect("scroll-event", self._zoomSliderScrollCb) zoomslider.set_size_request(100, 0) # At least 100px wide for precision self.pack_start(zoomslider, expand=True, fill=True, padding=ZOOM_SLIDER_PADDING) self.set_size_request(CONTROL_WIDTH, -1) self.show_all() self._updateZoomSlider = True
def __init__(self, ges_elem, max_cpu_usage): Previewer.__init__(self, GES.TrackType.VIDEO, max_cpu_usage) Zoomable.__init__(self) Loggable.__init__(self) self.ges_elem = ges_elem # Guard against malformed URIs self.uri = quote_uri(get_proxy_target(ges_elem).props.id) self.__start_id = 0 self.__image_pixbuf = None self.thumbs = {} self.thumb_height = THUMB_HEIGHT self.thumb_width = 0 self.ges_elem.connect("notify::duration", self._duration_changed_cb) self.become_controlled() self.connect("notify::height-request", self._height_changed_cb)
def __init__(self, bElement, timeline): """ @param bElement : the backend GES.TrackElement @param track : the track to which the bElement belongs @param timeline : the containing graphic timeline. """ Zoomable.__init__(self) Clutter.ScrollActor.__init__(self) Loggable.__init__(self) # Variables related to the timeline objects self.timeline = timeline self.bElement = bElement self.uri = bElement.props.uri self.duration = bElement.props.duration # Variables related to thumbnailing self.wishlist = [] self._callback_id = None self._allAnimated = False self.thumb_period = long( 0.5 * Gst.SECOND) # TODO: get this from user settings self.thumb_margin = BORDER_WIDTH self.thumb_height = EXPANDED_SIZE - 2 * self.thumb_margin # self.thumb_width will be set by self._setupPipeline() # Maps (quantized) times to Thumbnail objects self.thumbs = {} self.thumb_cache = get_cache_for_uri(self.uri) # Connect signals and fire things up self.timeline.connect("scrolled", self._scrollCb) self.bElement.connect("notify::duration", self._durationChangedCb) self.bElement.connect("notify::in-point", self._inpointChangedCb) self.bElement.connect("notify::start", self._startChangedCb) self._setupPipeline() self._startThumbnailing()
def __init__(self, element, timeline): Gtk.Layout.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.set_name(element.get_name()) self.timeline = timeline self._ges_elem = element self._ges_elem.selected = Selected() self._ges_elem.selected.connect( "selected-changed", self.__selectedChangedCb) self.__width = 0 self.__height = 0 # Needed for effect's keyframe toggling self._ges_elem.ui_element = self self.props.vexpand = True self.__previewer = self._getPreviewer() if self.__previewer: self.add(self.__previewer) self.__background = self._getBackground() if self.__background: self.add(self.__background) self.keyframe_curve = None self.show_all() # We set up the default mixing property right here, if a binding was # already set (when loading a project), it will be added later # and override that one. self.showDefaultKeyframes()
def __init__(self, element, timeline): Gtk.Layout.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.set_name(element.get_name()) self.timeline = timeline self._ges_elem = element self._ges_elem.selected = Selected() self._ges_elem.selected.connect("selected-changed", self.__selectedChangedCb) self.__width = 0 self.__height = 0 # Needed for effect's keyframe toggling self._ges_elem.ui_element = self self.props.vexpand = True self.__previewer = self._getPreviewer() if self.__previewer: self.add(self.__previewer) self.__background = self._getBackground() if self.__background: self.add(self.__background) self.keyframe_curve = None self.show_all() # We set up the default mixing property right here, if a binding was # already set (when loading a project), it will be added later # and override that one. self.showDefaultKeyframes()
def __init__(self, bElement, timeline): """ @param bElement : the backend GES.TrackElement @param track : the track to which the bElement belongs @param timeline : the containing graphic timeline. """ Zoomable.__init__(self) Clutter.ScrollActor.__init__(self) Loggable.__init__(self) # Variables related to the timeline objects self.timeline = timeline self.bElement = bElement self.uri = bElement.props.uri self.duration = bElement.props.duration # Variables related to thumbnailing self.wishlist = [] self._callback_id = None self._allAnimated = False self.thumb_period = long(0.5 * Gst.SECOND) # TODO: get this from user settings self.thumb_margin = BORDER_WIDTH self.thumb_height = EXPANDED_SIZE - 2 * self.thumb_margin # self.thumb_width will be set by self._setupPipeline() # Maps (quantized) times to Thumbnail objects self.thumbs = {} self.thumb_cache = get_cache_for_uri(self.uri) # Connect signals and fire things up self.timeline.connect("scrolled", self._scrollCb) self.bElement.connect("notify::duration", self._durationChangedCb) self.bElement.connect("notify::in-point", self._inpointChangedCb) self.bElement.connect("notify::start", self._startChangedCb) self._setupPipeline() self._startThumbnailing()
def __init__(self, ges_layer, timeline): Gtk.Layout.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.ges_layer = ges_layer self.ges_layer.ui = self self.timeline = timeline self.app = timeline.app self._children = [] self._changed = False self.ges_layer.connect("clip-added", self._clip_added_cb) self.ges_layer.connect("clip-removed", self._clip_removed_cb) # The layer is always the width of the Timeline which contains it. self.props.hexpand = True self.props.valign = Gtk.Align.START self.media_types = GES.TrackType(0) for ges_clip in ges_layer.get_clips(): self._add_clip(ges_clip) self.check_media_types()
def __init__(self, ges_layer, timeline): Gtk.Layout.__init__(self) Zoomable.__init__(self) Loggable.__init__(self) self.ges_layer = ges_layer self.ges_layer.ui = self self.timeline = timeline self.app = timeline.app self._children = [] self._changed = False self.ges_layer.connect("clip-added", self._clipAddedCb) self.ges_layer.connect("clip-removed", self._clipRemovedCb) # The layer is always the width of the Timeline which contains it. self.props.hexpand = True self.props.valign = Gtk.Align.START self.media_types = GES.TrackType(0) for ges_clip in ges_layer.get_clips(): self._add_clip(ges_clip) self.checkMediaTypes()