[pitivi] project: Emit settings-set-from-imported-asset once
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] project: Emit settings-set-from-imported-asset once
- Date: Thu, 23 Jun 2016 06:58:50 +0000 (UTC)
commit 4ee1be6da87334ea0211c3a173da6055bfc9bd0a
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed Jun 22 03:51:24 2016 +0200
project: Emit settings-set-from-imported-asset once
It was being emitted twice if the asset had audio and video.
Differential Revision: https://phabricator.freedesktop.org/D1102
pitivi/medialibrary.py | 3 ---
pitivi/project.py | 6 +++++-
2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 36dfd70..cb63c3b 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -989,9 +989,6 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._selectLastImportedUris()
def __projectSettingsSetFromImportedAssetCb(self, unused_project, asset):
- if self._project_settings_set_infobar.is_visible():
- # One is enough.
- return
asset_path = path_from_uri(asset.get_id())
file_name = os.path.basename(asset_path)
message = _("The project settings have been set to match file '%s'") % file_name
diff --git a/pitivi/project.py b/pitivi/project.py
index 8e9d969..4fd4365 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -1453,6 +1453,8 @@ class Project(Loggable, GES.Project):
if not isinstance(asset, GES.UriClipAsset):
# We are only interested in actual files, not in titles, for example.
return
+
+ emit = False
info = asset.get_info()
video_streams = info.get_video_streams()
if video_streams and self._has_default_video_settings:
@@ -1467,13 +1469,15 @@ class Project(Loggable, GES.Project):
self.videopar = Gst.Fraction(video.get_par_num(),
video.get_par_denom())
self._has_default_video_settings = False
- self.emit("settings-set-from-imported-asset", asset)
+ emit = True
audio_streams = info.get_audio_streams()
if audio_streams and self._has_default_audio_settings:
audio = audio_streams[0]
self.audiochannels = audio.get_channels()
self.audiorate = audio.get_sample_rate()
self._has_default_audio_settings = False
+ emit = True
+ if emit:
self.emit("settings-set-from-imported-asset", asset)
def _emitChange(self, signal, key, value):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]