Пример #1
0
    def __init__(self, pipeline):
        Loggable.__init__(self)
        Signallable.__init__(self)

        self._pipeline = pipeline
        self._bus = self._pipeline.get_bus()
        self._bus.add_signal_watch()
        self._bus.connect("message", self._busMessageCb)
        self._listening = False  # for the position handler
        self._listeningInterval = 300  # default 300ms
        self._listeningSigId = 0
        self._duration = Gst.CLOCK_TIME_NONE
        self.lastPosition = int(0 * Gst.SECOND)
        self.pendingRecovery = False
        self._attempted_recoveries = 0
        self._waiting_for_async_done = True
        self._next_seek = None
        self._timeout_async_id = 0

        # Create a cluttersink element used for display. Subclasses must connect
        # it to self._pipeline themselves
        self._clutter_sink = Gst.ElementFactory.make("cluttersink", None)
        if isinstance(pipeline, GES.Pipeline):
            self._pipeline.preview_set_video_sink(self._clutter_sink)
        else:
            self._pipeline.set_property("video_sink", self._clutter_sink)
Пример #2
0
    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>")
Пример #3
0
    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>")
Пример #4
0
    def __init__(self, focus, timeline, mode, edge, settings):
        """
        @param focus: the Clip or TrackElement which is to be the
        main target of interactive editing, such as the object directly under the
        mouse pointer
        @type focus: L{GES.Clip} or L{GES.TrackElement}

        @param timeline: the timeline to edit
        @type timeline: instance of L{GES.Timeline}

        @param edge: The edge on which the edition will happen, this parametter
        can be change during the time using the same context.
        @type edge: L{GES.Edge}

        @param mode: The mode in which the edition will happen, this parametter
        can be change during the time using the same context.
        @type mode: L{GES.EditMode}

        @param setting: The PiTiVi settings, used to get the snap_distance
        parametter

        @returns: An instance of L{pitivi.utils.timeline.EditingContext}
        """
        Signallable.__init__(self)

        if isinstance(focus, GES.TrackElement):
            self.focus = focus.get_parent()
        else:
            self.focus = focus
        self.timeline = timeline

        self.edge = edge
        self.mode = mode
Пример #5
0
    def __init__(self, avalaible_effects={}):
        Signallable.__init__(self)
        Loggable.__init__(self)

        self.current = None
        self.backup_lock = 0
        self.avalaible_effects = avalaible_effects
        self.formatter = None
        self._medialib_awaiting_discovery = []
Пример #6
0
    def __init__(self, timeout=80):
        """
        @param timeout (optional): the amount of miliseconds for a seek attempt
        """
        Signallable.__init__(self)
        Loggable.__init__(self)

        self.timeout = timeout
        self.pending_seek_id = None
        self.position = None
        self.format = None
        self._time = None
Пример #7
0
 def __init__(self, pipeline, video_overlay):
     Loggable.__init__(self)
     Signallable.__init__(self)
     self._pipeline = pipeline
     self._bus = self._pipeline.get_bus()
     self._bus.add_signal_watch()
     self._bus.connect("message", self._busMessageCb)
     self._listening = False  # for the position handler
     self._listeningInterval = 300  # default 300ms
     self._listeningSigId = 0
     self._duration = Gst.CLOCK_TIME_NONE
     self.video_overlay = video_overlay
Пример #8
0
 def __init__(self, pipeline, video_overlay):
     Loggable.__init__(self)
     Signallable.__init__(self)
     self._pipeline = pipeline
     self._bus = self._pipeline.get_bus()
     self._bus.add_signal_watch()
     self._bus.connect("message", self._busMessageCb)
     self._listening = False  # for the position handler
     self._listeningInterval = 300  # default 300ms
     self._listeningSigId = 0
     self._duration = Gst.CLOCK_TIME_NONE
     self.video_overlay = video_overlay
Пример #9
0
    def __init__(self, timeout=80):
        """
        @param timeout (optional): the amount of miliseconds for a seek attempt
        """
        Signallable.__init__(self)
        Loggable.__init__(self)

        self.timeout = timeout
        self.pending_seek_id = None
        self.position = None
        self.format = None
        self._time = None
Пример #10
0
    def __init__(self):
        Loggable.__init__(self)
        Signallable.__init__(self)
        # A (URI -> SourceFactory) map.
        self._sources = {}
        # A list of SourceFactory objects.
        self._ordered_sources = []
        self._resetImportCounters()

        self.discoverer = self.discovererClass.new(Gst.SECOND)
        self.discoverer.connect("discovered", self.addDiscovererInfo)
        self.discoverer.connect("finished", self.finishDiscovererCb)
        self.discoverer.start()
Пример #11
0
 def __init__(self, pipeline):
     Loggable.__init__(self)
     Signallable.__init__(self)
     self._pipeline = pipeline
     self._bus = self._pipeline.get_bus()
     self._bus.add_signal_watch()
     self._bus.connect("message", self._busMessageCb)
     # Initially, we set a synchronous bus message handler so that the window handle
     # is known right away and we can set the viewer synchronously, avoiding
     # the creation of an external window.
     # Afterwards, the window-handle-message is handled async (to avoid deadlocks).
     self._bus.set_sync_handler(self._busSyncMessageHandler, None)
     self._has_sync_bus_handler = True
     self._listening = False  # for the position handler
     self._listeningInterval = 300  # default 300ms
     self._listeningSigId = 0
     self._duration = Gst.CLOCK_TIME_NONE
Пример #12
0
 def __init__(self, pipeline, video_overlay):
     Loggable.__init__(self)
     Signallable.__init__(self)
     self._pipeline = pipeline
     self._bus = self._pipeline.get_bus()
     self._bus.add_signal_watch()
     self._bus.connect("message", self._busMessageCb)
     self._listening = False  # for the position handler
     self._listeningInterval = 300  # default 300ms
     self._listeningSigId = 0
     self._duration = Gst.CLOCK_TIME_NONE
     self.video_overlay = video_overlay
     self.lastPosition = long(0 * Gst.SECOND)
     self.pendingRecovery = False
     self._attempted_recoveries = 0
     self._waiting_for_async_done = True
     self._next_seek = None
     self._timeout_async_id = 0
Пример #13
0
    def __init__(self, focus, timeline, mode, edge, unused_settings, action_log):
        """
        @param focus: the Clip or TrackElement which is to be the
        main target of interactive editing, such as the object directly under the
        mouse pointer
        @type focus: L{GES.Clip} or L{GES.TrackElement}

        @param timeline: the timeline to edit
        @type timeline: instance of L{GES.Timeline}

        @param edge: The edge on which the edition will happen, this parametter
        can be change during the time using the same context.
        @type edge: L{GES.Edge}

        @param mode: The mode in which the edition will happen, this parametter
        can be change during the time using the same context.
        @type mode: L{GES.EditMode}

        @param setting: The Pitivi settings, used to get the snap_distance
        parametter

        @returns: An instance of L{pitivi.utils.timeline.EditingContext}
        """
        Signallable.__init__(self)

        if isinstance(focus, GES.TrackElement):
            self.focus = focus.get_parent()
        else:
            self.focus = focus

        self.old_position = self.focus.get_start()
        if edge == GES.Edge.EDGE_END and mode == GES.EditMode.EDIT_TRIM:
            self.old_position += self.focus.get_duration()

        self.old_priority = self.focus.get_priority()
        self.new_position = None

        self.timeline = timeline
        self.action_log = action_log

        self.edge = edge
        self.mode = mode

        self.action_log.begin("move-clip")
Пример #14
0
    def __init__(self, focus, timeline, mode, edge, other, settings):
        """
        @param focus: the TimelineObject or TrackObject which is to be the
        main target of interactive editing, such as the object directly under the
        mouse pointer
        @type focus: L{GES.TimelineObject} or L{GES.TrackObject}

        @param timeline: the timeline to edit
        @type timeline: instance of L{GES.Timeline}

        @param edge: The edge on which the edition will happen, this parametter
        can be change during the time using the same context.
        @type edge: L{GES.Edge}

        @param mode: The mode in which the edition will happen, this parametter
        can be change during the time using the same context.
        @type mode: L{GES.EditMode}

        @param other: a set of objects which are the secondary targets of
        interactive editing, such as objects in the current selection.
        @type other: a set() of L{TimelineObject}s or L{TrackObject}s

        @param setting: The PiTiVi settings, used to get the snap_distance
        parametter

        @returns: An instance of L{pitivi.utils.timeline.EditingContext}
        """
        Signallable.__init__(self)

        # make sure focus is not in secondary object list
        other.difference_update(set((focus,)))

        self.other = other
        if isinstance(focus, GES.TrackObject):
            self.focus = focus.get_timeline_object()
        else:
            self.focus = focus
        self.timeline = timeline

        self.edge = edge
        self.mode = mode

        self.timeline.enable_update(False)
Пример #15
0
 def __init__(self, **kwargs):
     Signallable.__init__(self)
     self._config = SafeConfigParser()
     self._readSettingsFromGlobalConfiguration()
     self._readSettingsFromConfigurationFile()
     self._readSettingsFromEnvironmentVariables()
Пример #16
0
 def __init__(self, **unused_kwargs):
     Signallable.__init__(self)
     self._config = SafeConfigParser()
     self._readSettingsFromGlobalConfiguration()
     self._readSettingsFromConfigurationFile()
     self._readSettingsFromEnvironmentVariables()
Пример #17
0
    def __init__(self, instance, unused_uiman):
        Gtk.VBox.__init__(self)
        Loggable.__init__(self)
        Signallable.__init__(self)

        self.app = instance
        self.element = None
        self._pixdir = os.path.join(get_pixmap_dir(), "transitions")
        icon_theme = Gtk.IconTheme.get_default()
        self._question_icon = icon_theme.load_icon("dialog-question", 48, 0)

        #Tooltip handling
        self._current_transition_name = None
        self._current_tooltip_icon = None

        #Searchbox
        self.searchbar = Gtk.HBox()
        self.searchbar.set_border_width(3)  # Prevents being flush against the notebook
        self.searchEntry = Gtk.Entry()
        self.searchEntry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, "edit-clear-symbolic")
        self.searchEntry.set_placeholder_text(_("Search..."))
        self.searchbar.pack_end(self.searchEntry, True, True, 0)

        self.props_widgets = Gtk.VBox()
        borderTable = Gtk.Table(n_rows=2, n_columns=3)

        self.border_mode_normal = Gtk.RadioButton(group=None, label=_("Normal"))
        self.border_mode_loop = Gtk.RadioButton(group=self.border_mode_normal, label=_("Loop"))
        self.border_mode_normal.set_active(True)
        self.borderScale = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, None)
        self.borderScale.set_draw_value(False)

        borderTable.attach(self.border_mode_normal, 0, 1, 0, 1, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL)
        borderTable.attach(self.border_mode_loop, 1, 2, 0, 1, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL)
        # The ypadding is a hack to make the slider widget align with the radiobuttons.
        borderTable.attach(self.borderScale, 2, 3, 0, 2, ypadding=SPACING * 2)

        self.invert_checkbox = Gtk.CheckButton(label=_("Reverse direction"))
        self.invert_checkbox.set_border_width(SPACING)

        self.props_widgets.add(borderTable)
        self.props_widgets.add(self.invert_checkbox)

        # Set the default values
        self._borderTypeChangedCb()

        self.infobar = Gtk.InfoBar()
        txtlabel = Gtk.Label()
        txtlabel.set_padding(PADDING, PADDING)
        txtlabel.set_line_wrap(True)
        txtlabel.set_text(
            _("Create a transition by overlapping two adjacent clips on the "
                "same layer. Click the transition on the timeline to change "
                "the transition type."))
        self.infobar.add(txtlabel)

        self.storemodel = Gtk.ListStore(GES.Asset, str, str, GdkPixbuf.Pixbuf)

        self.iconview_scrollwin = Gtk.ScrolledWindow()
        self.iconview_scrollwin.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        # FIXME: the "never" horizontal scroll policy in GTK2 messes up iconview
        # Re-enable this when we switch to GTK3
        # See also http://python.6.n6.nabble.com/Cannot-shrink-width-of-scrolled-textview-tp1945060.html
        #self.iconview_scrollwin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

        self.iconview = Gtk.IconView(model=self.storemodel)
        self.iconview.set_pixbuf_column(COL_ICON)
        # We don't show text because we have a searchbar and the names are ugly
        #self.iconview.set_text_column(COL_NAME_TEXT)
        self.iconview.set_item_width(48 + 10)
        self.iconview_scrollwin.add(self.iconview)
        self.iconview.set_property("has_tooltip", True)

        self.searchEntry.connect("changed", self._searchEntryChangedCb)
        self.searchEntry.connect("icon-press", self._searchEntryIconClickedCb)
        self.iconview.connect("selection-changed", self._transitionSelectedCb)
        self.iconview.connect("query-tooltip", self._queryTooltipCb)
        self.borderScale.connect("value-changed", self._borderScaleCb)
        self.invert_checkbox.connect("toggled", self._invertCheckboxCb)
        self.border_mode_normal.connect("released", self._borderTypeChangedCb)
        self.border_mode_loop.connect("released", self._borderTypeChangedCb)

        # Speed-up startup by only checking available transitions on idle
        GLib.idle_add(self._loadAvailableTransitionsCb)

        self.pack_start(self.infobar, False, True, 0)
        self.pack_start(self.searchbar, False, True, 0)
        self.pack_start(self.iconview_scrollwin, True, True, 0)
        self.pack_start(self.props_widgets, False, True, 0)

        # Create the filterModel for searching
        self.modelFilter = self.storemodel.filter_new()
        self.iconview.set_model(self.modelFilter)

        self.infobar.show_all()
        self.iconview_scrollwin.show_all()
        self.iconview.hide()
        self.props_widgets.set_sensitive(False)
        self.props_widgets.hide()
        self.searchbar.hide()
Пример #18
0
 def __init__(self, track_type):
     """
     @param track_type : GES.TrackType.*
     """
     Signallable.__init__(self)
     self.track_type = track_type
Пример #19
0
    def __init__(self, instance, uiman):
        Gtk.VBox.__init__(self)
        Loggable.__init__(self)
        Signallable.__init__(self)

        self.app = instance
        self.element = None
        self._pixdir = os.path.join(get_pixmap_dir(), "transitions")
        icon_theme = Gtk.IconTheme.get_default()
        self._question_icon = icon_theme.load_icon("dialog-question", 48, 0)

        #Tooltip handling
        self._current_transition_name = None
        self._current_tooltip_icon = None

        #Searchbox
        self.searchbar = Gtk.HBox()
        self.searchbar.set_border_width(
            3)  # Prevents being flush against the notebook
        self.searchEntry = Gtk.Entry()
        self.searchEntry.set_icon_from_icon_name(
            Gtk.EntryIconPosition.SECONDARY, "edit-clear-symbolic")
        self.searchEntry.set_placeholder_text(_("Search..."))
        self.searchbar.pack_end(self.searchEntry, True, True, 0)

        self.props_widgets = Gtk.VBox()
        borderTable = Gtk.Table(rows=2, columns=3)

        self.border_mode_normal = Gtk.RadioButton(group=None,
                                                  label=_("Normal"))
        self.border_mode_loop = Gtk.RadioButton(group=self.border_mode_normal,
                                                label=_("Loop"))
        self.border_mode_normal.set_active(True)
        self.borderScale = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, None)
        self.borderScale.set_draw_value(False)

        borderTable.attach(self.border_mode_normal,
                           0,
                           1,
                           0,
                           1,
                           xoptions=Gtk.AttachOptions.FILL,
                           yoptions=Gtk.AttachOptions.FILL)
        borderTable.attach(self.border_mode_loop,
                           1,
                           2,
                           0,
                           1,
                           xoptions=Gtk.AttachOptions.FILL,
                           yoptions=Gtk.AttachOptions.FILL)
        # The ypadding is a hack to make the slider widget align with the radiobuttons.
        borderTable.attach(self.borderScale, 2, 3, 0, 2, ypadding=SPACING * 2)

        self.invert_checkbox = Gtk.CheckButton(_("Reverse direction"))
        self.invert_checkbox.set_border_width(SPACING)

        self.props_widgets.add(borderTable)
        self.props_widgets.add(self.invert_checkbox)

        # Set the default values
        self._borderTypeChangedCb()

        self.infobar = Gtk.InfoBar()
        txtlabel = Gtk.Label()
        txtlabel.set_padding(PADDING, PADDING)
        txtlabel.set_line_wrap(True)
        txtlabel.set_text(
            _("Create a transition by overlapping two adjacent clips on the "
              "same layer. Click the transition on the timeline to change "
              "the transition type."))
        self.infobar.add(txtlabel)
        self.infobar.show_all()

        self.storemodel = Gtk.ListStore(GES.Asset, str, str, GdkPixbuf.Pixbuf)

        self.iconview_scrollwin = Gtk.ScrolledWindow()
        self.iconview_scrollwin.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        # FIXME: the "never" horizontal scroll policy in GTK2 messes up iconview
        # Re-enable this when we switch to GTK3
        # See also http://python.6.n6.nabble.com/Cannot-shrink-width-of-scrolled-textview-tp1945060.html
        #self.iconview_scrollwin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

        self.iconview = Gtk.IconView(self.storemodel)
        self.iconview.set_pixbuf_column(COL_ICON)
        # We don't show text because we have a searchbar and the names are ugly
        #self.iconview.set_text_column(COL_NAME_TEXT)
        self.iconview.set_item_width(48 + 10)
        self.iconview_scrollwin.add(self.iconview)
        self.iconview.set_property("has_tooltip", True)

        self.searchEntry.connect("changed", self._searchEntryChangedCb)
        self.searchEntry.connect("focus-in-event", self._searchEntryActivateCb)
        self.searchEntry.connect("focus-out-event",
                                 self._searchEntryDeactivateCb)
        self.searchEntry.connect("icon-press", self._searchEntryIconClickedCb)
        self.iconview.connect("selection-changed", self._transitionSelectedCb)
        self.iconview.connect("query-tooltip", self._queryTooltipCb)
        self.borderScale.connect("value-changed", self._borderScaleCb)
        self.invert_checkbox.connect("toggled", self._invertCheckboxCb)
        self.border_mode_normal.connect("released", self._borderTypeChangedCb)
        self.border_mode_loop.connect("released", self._borderTypeChangedCb)

        # Speed-up startup by only checking available transitions on idle
        GLib.idle_add(self._loadAvailableTransitionsCb)

        self.pack_start(self.infobar, False, True, 0)
        self.pack_start(self.searchbar, False, True, 0)
        self.pack_start(self.iconview_scrollwin, True, True, 0)
        self.pack_start(self.props_widgets, False, True, 0)

        # Create the filterModel for searching
        self.modelFilter = self.storemodel.filter_new()
        self.iconview.set_model(self.modelFilter)

        self.infobar.show()
        self.iconview_scrollwin.show_all()
        self.iconview.hide()
        self.props_widgets.set_sensitive(False)
        self.props_widgets.hide()
        self.searchbar.hide()
Пример #20
0
 def __init__(self, track_type):
     Signallable.__init__(self)
     self.track_type = track_type