def __init__(self, settings=None, realizedCb=None): # Prevent black frames and flickering while resizing or changing focus: # The aspect ratio gets overridden by setDisplayAspectRatio. Gtk.AspectFrame.__init__(self, xalign=0.5, yalign=1.0, ratio=4.0 / 3.0, obey_child=False) Loggable.__init__(self) self.drawing_area = Gtk.DrawingArea() self.drawing_area.set_double_buffered(False) self.drawing_area.connect("draw", self._drawCb, None) # We keep the ViewerWidget hidden initially, or the desktop wallpaper # would show through the non-double-buffered widget! if realizedCb: self.drawing_area.connect("realize", realizedCb, self) self.add(self.drawing_area) self.drawing_area.show() self.seeker = Seeker() self.settings = settings self.box = None self.stored = False self.area = None self.zoom = 1.0 self.sink = None self.pixbuf = None self.pipeline = None self.transformation_properties = None
def setPipeline(self, pipeline, position=None): """ Set the Viewer to the given Pipeline. Properly switches the currently set action to that new Pipeline. @param pipeline: The Pipeline to switch to. @type pipeline: L{Pipeline}. @param position: Optional position to seek to initially. """ self.debug("self.pipeline:%r", self.pipeline) self.seeker = Seeker() self._disconnectFromPipeline() if self.pipeline: self.pipeline.set_state(Gst.State.NULL) self.pipeline = pipeline if self.pipeline: self.pipeline.pause() self.seeker.seek(position) self.pipeline.connect("state-change", self._pipelineStateChangedCb) self.pipeline.connect("position", self._positionCb) self.pipeline.connect("duration-changed", self._durationChangedCb) self.sink = pipeline.video_overlay self._switch_output_window() self._setUiActive()
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, uimap): Loggable.__init__(self) Signallable.__init__(self) self.app = instance self.bt = {} self.settings = {} self.source = None self.created = False self.seeker = Seeker() #Drag attributes self._drag_events = [] self._signals_connected = False self._createUI() self.textbuffer = Gtk.TextBuffer() self.pangobuffer = InteractivePangoBuffer() self.textarea.set_buffer(self.pangobuffer) self.textbuffer.connect("changed", self._updateSourceText) self.pangobuffer.connect("changed", self._updateSourceText) #Connect buttons self.pangobuffer.setup_widget_from_pango(self.bt["bold"], "<b>bold</b>") self.pangobuffer.setup_widget_from_pango(self.bt["italic"], "<i>italic</i>")
def __init__(self, app): Loggable.__init__(self) self.app = app self.settings = {} self.source = None self.seeker = Seeker() # Drag attributes self._drag_events = [] self._signals_connected = False self._createUI()
def __init__(self, settings=None): Gtk.DrawingArea.__init__(self) Loggable.__init__(self) self.seeker = Seeker() self.settings = settings self.box = None self.stored = False self.area = None self.zoom = 1.0 self.sink = None self.pixbuf = None self.pipeline = None self.transformation_properties = None
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, app): Loggable.__init__(self) self.app = app self.action_log = app.action_log self.settings = {} self.source = None self.seeker = Seeker() # Drag attributes self._drag_events = [] self._signals_connected = False self._setting_props = False self._setting_initial_props = False self._children_props_handler = None self._createUI()
def __init__(self, app): Gtk.VBox.__init__(self) self.set_border_width(SPACING) self.app = app self.settings = app.settings self.system = app.system Loggable.__init__(self) self.log("New ViewerContainer") self.pipeline = None self.docked = True self.seeker = Seeker() # Only used for restoring the pipeline position after a live clip trim preview: self._oldTimelinePos = None self._haveUI = False self._createUi() if not self.settings.viewerDocked: self.undock()