Exemple #1
0
    def test_keyframe_toggle(self):
        """Checks keyframes toggling at the playhead position."""
        timeline_container = common.create_timeline_container()
        timeline_container.app.action_log = UndoableActionLog()
        timeline = timeline_container.timeline
        ges_layer = timeline.ges_timeline.append_layer()
        ges_clip1 = self.add_clip(ges_layer, 0, duration=Gst.SECOND)
        ges_clip2 = self.add_clip(ges_layer, Gst.SECOND, duration=Gst.SECOND)
        ges_clip3 = self.add_clip(ges_layer,
                                  2 * Gst.SECOND,
                                  inpoint=Gst.SECOND,
                                  duration=Gst.SECOND)

        # For variety, add TitleClip to the list of clips.
        ges_clip4 = common.create_test_clip(GES.TitleClip)
        ges_clip4.props.start = 3 * Gst.SECOND
        ges_clip4.props.duration = Gst.SECOND
        self.assertTrue(ges_layer.add_clip(ges_clip4))

        self.check_keyframe_toggle(ges_clip1, timeline_container)
        self.check_keyframe_toggle(ges_clip2, timeline_container)
        self.check_keyframe_toggle(ges_clip3, timeline_container)
        self.check_keyframe_toggle(ges_clip4, timeline_container)

        self.check_keyframe_ui_toggle(ges_clip1, timeline_container)
        self.check_keyframe_ui_toggle(ges_clip2, timeline_container)
        self.check_keyframe_ui_toggle(ges_clip3, timeline_container)
        self.check_keyframe_ui_toggle(ges_clip4, timeline_container)
    def test_keyframe_toggle(self):
        """Checks keyframes toggling at the playhead position."""
        timeline_container = create_timeline_container()
        timeline_container.app.action_log = UndoableActionLog()
        timeline = timeline_container.timeline
        ges_layer = timeline.ges_timeline.append_layer()
        ges_clip1 = self.add_clip(ges_layer, 0, duration=2 * Gst.SECOND)
        ges_clip2 = self.add_clip(ges_layer, 10, duration=2 * Gst.SECOND)
        ges_clip3 = self.add_clip(ges_layer,
                                  20,
                                  inpoint=100,
                                  duration=2 * Gst.SECOND)
        # For variety, add TitleClip to the list of clips.
        ges_clip4 = create_test_clip(GES.TitleClip)
        ges_clip4.props.start = 30
        ges_clip4.props.duration = int(0.9 * Gst.SECOND)
        ges_layer.add_clip(ges_clip4)

        self.check_keyframe_toggle(ges_clip1, timeline_container)
        self.check_keyframe_toggle(ges_clip2, timeline_container)
        self.check_keyframe_toggle(ges_clip3, timeline_container)
        self.check_keyframe_toggle(ges_clip4, timeline_container)

        for ges_clip in [ges_clip1, ges_clip2, ges_clip3, ges_clip4]:
            self.check_keyframe_ui_toggle(ges_clip, timeline_container)
    def _newProjectLoaded(self, unused_project_manager, project):
        self.action_log = UndoableActionLog()
        self.action_log.connect("pre-push", self._action_log_pre_push_cb)
        self.action_log.connect("commit", self._actionLogCommit)
        self.action_log.connect("move", self._action_log_move_cb)

        self.project_observer = ProjectObserver(project, self.action_log)
Exemple #4
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id="org.pitivi",
                                 flags=Gio.ApplicationFlags.HANDLES_OPEN)
        Loggable.__init__(self)

        self.settings = None
        self.threads = None
        self.effects = None
        self.system = None
        self.project_manager = ProjectManager(self)

        self.action_log = UndoableActionLog(self)
        self.timeline_log_observer = None
        self.project_log_observer = None
        self._last_action_time = Gst.util_get_timestamp()

        self.gui = None
        self.welcome_wizard = None

        self._version_information = {}

        self._scenario_file = None
        self._first_action = True

        self.connect("startup", self._startupCb)
        self.connect("activate", self._activateCb)
        self.connect("open", self.openCb)
 def setUp(self):
     self.timeline = GES.Timeline.new_audio_video()
     self.layer = GES.Layer()
     self.timeline.add_layer(self.layer)
     self.action_log = UndoableActionLog()
     self.observer = TimelineLogObserverSpy(self.action_log)
     self.observer.startObserving(self.timeline)
Exemple #6
0
    def setUp(self):
        super().setUp()

        timeline_container = common.create_timeline_container()
        self.ges_timeline = timeline_container.timeline.ges_timeline

        timeline_container.app.action_log = UndoableActionLog()
        self.timeline_observer = TimelineObserver(
            timeline_container.ges_timeline, timeline_container.app.action_log)
Exemple #7
0
    def setUp(self):
        app = Pitivi()
        app._startupCb(app)
        app.project_manager.newBlankProject()

        self.timeline = app.project_manager.current_project.timeline
        self.layer = GES.Layer()
        self.timeline.add_layer(self.layer)
        self.action_log = UndoableActionLog()
        self.observer = TimelineLogObserverSpy(self.action_log)
        self.observer.startObserving(self.timeline)
Exemple #8
0
 def _newProjectLoaded(self, unused_project_manager, project):
     uri = project.get_uri()
     if uri:
         # We remove the project from recent projects list
         # and then re-add it to this list to make sure it
         # gets positioned at the top of the recent projects list.
         self.recent_manager.remove_item(uri)
         self.recent_manager.add_item(uri)
     self.action_log = UndoableActionLog()
     self.action_log.connect("pre-push", self._action_log_pre_push_cb)
     self.action_log.connect("commit", self._actionLogCommit)
     self.action_log.connect("move", self._action_log_move_cb)
     self.project_observer = ProjectObserver(project, self.action_log)
Exemple #9
0
    def __init__(self):
        """
        initialize pitivi with the command line arguments
        """
        Loggable.__init__(self)

        # init logging as early as possible so we can log startup code
        enable_color = os.environ.get('PITIVI_DEBUG_NO_COLOR',
                                      '0') in ('', '0')
        # Let's show a human-readable pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        log.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')

        # store ourself in the instance global
        if instance.PiTiVi:
            raise RuntimeWarning(
                _("There is already a %s instance, please inform "
                  "the developers by filing a bug at "
                  "http://bugzilla.gnome.org/enter_bug.cgi?product=pitivi") %
                APPNAME)
        instance.PiTiVi = self

        self.current = None

        # get settings
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        #self.screencast = False

        self.effects = EffectsHandler()
        self.system = getSystem()

        self.projectManager = ProjectManager(self)
        self._connectToProjectManager(self.projectManager)

        self.action_log = UndoableActionLog()
        self.debug_action_log_observer = DebugActionLogObserver()
        self.debug_action_log_observer.startObserving(self.action_log)
        # TODO reimplement the observing after GES port
        #self.timelineLogObserver = TimelineLogObserver(self.action_log)
        self.projectLogObserver = ProjectLogObserver(self.action_log)

        self.version_information = {}
        self._checkVersion()
Exemple #10
0
 def _newProjectLoaded(self, unused_project_manager, project):
     uri = project.get_uri()
     if uri:
         # We remove the project from recent projects list
         # and then re-add it to this list to make sure it
         # gets positioned at the top of the recent projects list.
         try:
             self.recent_manager.remove_item(uri)
         except GLib.Error as e:
             if e.domain != "gtk-recent-manager-error-quark":
                 raise e
             pass
         self.recent_manager.add_item(uri)
     self.action_log = UndoableActionLog()
     self.action_log.connect("pre-push", self._action_log_pre_push_cb)
     self.action_log.connect("commit", self._actionLogCommit)
     self.action_log.connect("move", self._action_log_move_cb)
     self.project_observer = ProjectObserver(project, self.action_log)
Exemple #11
0
    def test_property_change(self):
        action_log = UndoableActionLog()
        action_log.begin("complex stuff")
        stack, = action_log.stacks

        clip = GES.TitleClip()
        unused_observer = GObjectObserver(clip, ["start"], action_log)

        self.assertEqual(len(stack.done_actions), 0)
        clip.props.start = 2
        self.assertEqual(len(stack.done_actions), 1)

        clip.props.start = 2
        self.assertEqual(len(stack.done_actions), 1)

        clip.props.start = 4
        self.assertEqual(len(stack.done_actions), 2)
        action = stack.done_actions[-1]
        self.assertEqual(action.old_value, 2)
        self.assertEqual(action.new_value, 4)
 def setUp(self):
     self.log = UndoableActionLog()
     self._connectToUndoableActionLog(self.log)
     self.signals = []
Exemple #13
0
 def setUp(self):
     self.log = UndoableActionLog()
     self._connect_to_undoable_action_log(self.log)
     self.signals = []
Exemple #14
0
 def setUp(self):
     self.action_log = UndoableActionLog()
     self.observer = TimelineLogObserverSpy(self.action_log)
Exemple #15
0
    def test_axis_lock(self):
        """Checks keyframes moving."""
        timeline_container = common.create_timeline_container()
        timeline_container.app.action_log = UndoableActionLog()
        timeline = timeline_container.timeline
        timeline.get_window = mock.Mock()
        pipeline = timeline._project.pipeline
        ges_layer = timeline.ges_timeline.append_layer()
        ges_clip = self.add_clip(ges_layer, 0, duration=Gst.SECOND)

        start = ges_clip.props.start
        inpoint = ges_clip.props.in_point
        duration = ges_clip.props.duration
        timeline.selection.select([ges_clip])

        ges_video_source = ges_clip.find_track_element(None, GES.VideoSource)
        binding = ges_video_source.get_control_binding("alpha")
        control_source = binding.props.control_source
        keyframe_curve = ges_video_source.ui.keyframe_curve
        values = [item.timestamp for item in control_source.get_all()]
        self.assertEqual(values, [inpoint, inpoint + duration])

        # Add a keyframe.
        position = start + int(duration / 2)
        with mock.patch.object(pipeline, "get_position") as get_position:
            get_position.return_value = position
            timeline_container._keyframe_cb(None, None)

        # Start dragging the keyframe.
        x, y = keyframe_curve._ax.transData.transform((position, 1))
        event = MouseEvent(
            name="button_press_event",
            canvas=keyframe_curve,
            x=x,
            y=y,
            button=MouseButton.LEFT
        )
        event.guiEvent = Gdk.Event.new(Gdk.EventType.BUTTON_PRESS)
        self.assertIsNone(keyframe_curve._offset)
        keyframe_curve._mpl_button_press_event_cb(event)
        self.assertIsNotNone(keyframe_curve._offset)

        # Drag and make sure x and y are not locked.
        timeline_container.control_mask = False
        event = mock.Mock(
            x=x + 1,
            y=y + 1,
            xdata=position + 1,
            ydata=0.9,
        )
        with mock.patch.object(keyframe_curve,
                               "_move_keyframe") as _move_keyframe:
            keyframe_curve._mpl_motion_event_cb(event)
            # Check the keyframe is moved exactly where the cursor is.
            _move_keyframe.assert_called_once_with(position, position + 1, 0.9)

        # Drag locked horizontally.
        timeline_container.control_mask = True
        event = mock.Mock(
            x=x + 1,
            y=y + 2,
            xdata=position + 2,
            ydata=0.8,
        )
        with mock.patch.object(keyframe_curve,
                               "_move_keyframe") as _move_keyframe:
            keyframe_curve._mpl_motion_event_cb(event)
            # Check the keyframe is kept on the same timestamp.
            _move_keyframe.assert_called_once_with(position + 1, position, 0.8)

        # Drag locked vertically.
        timeline_container.control_mask = True
        event = mock.Mock(
            x=x + 2,
            y=y + 1,
            xdata=position + 3,
            ydata=0.7,
        )
        with mock.patch.object(keyframe_curve,
                               "_move_keyframe") as _move_keyframe:
            keyframe_curve._mpl_motion_event_cb(event)
            # Check the keyframe is kept on the same value.
            _move_keyframe.assert_called_once_with(position, position + 3, 1)