Commit 2a5f94f1 authored by Thibault Saunier's avatar Thibault Saunier Committed by Alexandru Băluț

mainwindow: Do not purge clips when an asset is removed

That does not belong to the main window but to the media library
that have a much better knowledge of what is going on

Differential Revision: https://phabricator.freedesktop.org/D579
parent 939eb1c2
......@@ -538,11 +538,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
self.save_action.set_enabled(True)
self.updateTitle()
def _mediaLibrarySourceRemovedCb(self, unused_project, asset):
"""When a clip is removed from the Media Library, tell the timeline
to remove all instances of that clip."""
self.timeline_ui.purgeObject(asset.get_id())
def _builderConnectCb(self, builder, gobject, signal_name, handler_name,
connect_object, flags, user_data):
id_ = gobject.connect(signal_name, getattr(self, handler_name))
......@@ -1021,7 +1016,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
def _connectToProject(self, project):
# FIXME GES we should re-enable this when possible
# medialibrary.connect("missing-plugins", self._sourceListMissingPluginsCb)
project.connect("asset-removed", self._mediaLibrarySourceRemovedCb)
project.connect("project-changed", self._projectChangedCb)
project.connect(
"rendering-settings-changed", self._renderingSettingsChangedCb)
......@@ -1076,7 +1070,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
self.settings.lastProjectFolder = folder_path
def _disconnectFromProject(self, project):
project.disconnect_by_func(self._mediaLibrarySourceRemovedCb)
project.disconnect_by_func(self._projectChangedCb)
project.disconnect_by_func(self._renderingSettingsChangedCb)
......
......@@ -379,6 +379,8 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
for row in rows:
asset = model[row.get_path()][COL_ASSET]
self.app.project_manager.current_project.remove_asset(asset)
self.app.gui.timeline_ui.purgeAsset(asset.props.id)
self.app.action_log.commit()
# The treeview can make some of the remaining items selected, so
......
......@@ -1231,13 +1231,13 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
return self.bTimeline.props.duration
return position
def purgeObject(self, asset_id):
def purgeAsset(self, asset_id):
"""Remove all instances of an asset from the timeline."""
layers = self.bTimeline.get_layers()
for layer in layers:
for tlobj in layer.get_clips():
if asset_id == tlobj.get_id():
layer.remove_clip(tlobj)
for clip in layer.get_clips():
if asset_id == clip.get_id():
layer.remove_clip(clip)
self._project.pipeline.commit_timeline()
def setProjectManager(self, projectmanager):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment