[pitivi] medialibrary: Inform the project settings have been set from an imported asset
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] medialibrary: Inform the project settings have been set from an imported asset
- Date: Thu, 26 Nov 2015 14:10:53 +0000 (UTC)
commit f99d4a033140637f278353be1ad2bb6200c3cc5a
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed Nov 25 21:43:43 2015 +0100
medialibrary: Inform the project settings have been set from an imported asset
Differential Revision: https://phabricator.freedesktop.org/D507
pitivi/medialibrary.py | 28 ++++++++++++++++++++++++++++
pitivi/project.py | 6 +++++-
2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 7390b65..a9f07a6 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -137,6 +137,12 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
builder.add_from_file(os.path.join(get_ui_dir(), "medialibrary.ui"))
builder.connect_signals(self)
self._welcome_infobar = builder.get_object("welcome_infobar")
+ self._project_settings_set_infobar = Gtk.InfoBar()
+ self._project_settings_set_infobar.hide()
+ self._project_settings_set_infobar.set_message_type(Gtk.MessageType.OTHER)
+ self._project_settings_set_infobar.set_show_close_button(True)
+ self._project_settings_set_infobar.add_button(_("Project Settings"), Gtk.ResponseType.OK)
+ self._project_settings_set_infobar.connect("response", self.__projectSettingsSetInfobarCb)
self._import_warning_infobar = builder.get_object("warning_infobar")
self._import_warning_infobar.hide()
self._warning_label = builder.get_object("warning_label")
@@ -305,6 +311,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
# Add all the child widgets.
self.pack_start(toolbar, False, False, 0)
self.pack_start(self._welcome_infobar, False, False, 0)
+ self.pack_start(self._project_settings_set_infobar, False, False, 0)
self.pack_start(self._import_warning_infobar, False, False, 0)
self.pack_start(self.iconview_scrollwin, True, True, 0)
self.pack_start(self.treeview_scrollwin, True, True, 0)
@@ -417,6 +424,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
project.connect("error-loading-asset", self._errorCreatingAssetCb)
project.connect("done-importing", self._sourcesStoppedImportingCb)
project.connect("start-importing", self._sourcesStartedImportingCb)
+ project.connect("settings-set-from-imported-asset", self.__projectSettingsSetFromImportedAssetCb)
# The start-importing signal would have already been emited at that
# time, make sure to catch if it is the case
@@ -715,6 +723,21 @@ 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
+ label = Gtk.Label(message)
+ label.set_line_wrap(True)
+ content_area = self._project_settings_set_infobar.get_content_area()
+ for widget in content_area.get_children():
+ content_area.remove(widget)
+ content_area.add(label)
+ self._project_settings_set_infobar.show_all()
+
def _selectLastImportedUris(self):
if not self._last_imported_uris:
return
@@ -830,6 +853,11 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
# UI callbacks
+ def __projectSettingsSetInfobarCb(self, infobar, response_id):
+ if response_id == Gtk.ResponseType.OK:
+ self.app.gui.showProjectSettingsDialog()
+ infobar.hide()
+
def _removeClickedCb(self, unused_widget=None):
""" Called when a user clicks on the remove button """
self._removeSources()
diff --git a/pitivi/project.py b/pitivi/project.py
index df86177..a0e9af0 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -711,7 +711,9 @@ class Project(Loggable, GES.Project):
"project-changed": (GObject.SignalFlags.RUN_LAST, None, ()),
"rendering-settings-changed": (GObject.SignalFlags.RUN_LAST, None,
(GObject.TYPE_PYOBJECT,
- GObject.TYPE_PYOBJECT,))
+ GObject.TYPE_PYOBJECT,)),
+ "settings-set-from-imported-asset": (GObject.SignalFlags.RUN_LAST, None,
+ (GES.Asset,)),
}
def __init__(self, app, name="", uri=None, scenario=None, **unused_kwargs):
@@ -1338,12 +1340,14 @@ 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)
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
+ self.emit("settings-set-from-imported-asset", asset)
def _emitChange(self, signal, key=None, value=None):
if key and value:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]