[pitivi] Fix backtraces when loading a project with missing assets
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Fix backtraces when loading a project with missing assets
- Date: Sun, 20 Mar 2016 23:58:59 +0000 (UTC)
commit bcd6932a318454ff49cb1bfe25ab814a992a6c67
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Wed Feb 17 02:07:27 2016 +0100
Fix backtraces when loading a project with missing assets
Differential Revision: https://phabricator.freedesktop.org/D784
pitivi/application.py | 8 ++++++--
pitivi/mainwindow.py | 5 +++--
pitivi/project.py | 13 ++++++++-----
3 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 3080f22..c89f0d9 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -271,8 +271,9 @@ class Pitivi(Gtk.Application, Loggable):
self.project_log_observer.startObserving(project)
def _projectClosed(self, unused_project_manager, project):
- self.project_log_observer.stopObserving(project)
- self.timeline_log_observer.stopObserving(project.timeline)
+ if project.loaded:
+ self.project_log_observer.stopObserving(project)
+ self.timeline_log_observer.stopObserving(project.timeline)
if self._scenario_file:
self.write_action("stop")
@@ -370,6 +371,9 @@ class Pitivi(Gtk.Application, Loggable):
can_redo = bool(action_log.redo_stacks)
self.redo_action.set_enabled(can_redo)
+ if not self.project_manager.current_project:
+ return
+
dirty = action_log.dirty()
self.project_manager.current_project.setModificationState(dirty)
# In the tests we do not want to create any gui
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 2675b94..7fb2025 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -860,7 +860,8 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
self.info("Project closed")
self.updateTitle()
- self._disconnectFromProject(project)
+ if project.loaded:
+ self._disconnectFromProject(project)
self.timeline_ui.setProject(None)
self.render_button.set_sensitive(False)
return False
@@ -906,7 +907,6 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
return None
uri = asset.get_id()
- new_uri = None
dialog = Gtk.Dialog(title=_("Locate missing file..."),
transient_for=self,
modal=True)
@@ -984,6 +984,7 @@ class PitiviMainWindow(Gtk.ApplicationWindow, Loggable):
dialog.set_default_size(1024, 1000)
response = dialog.run()
+ new_uri = None
if response == Gtk.ResponseType.OK:
self.log("User chose a new URI for the missing file")
new_uri = chooser.get_uri()
diff --git a/pitivi/project.py b/pitivi/project.py
index 661000f..34b3337 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -679,14 +679,14 @@ class ProjectManager(GObject.Object, Loggable):
new_uri = self.emit("missing-uri", project, error, asset)
if not new_uri:
project.at_least_one_asset_missing = True
- self.current_project.setModificationState(True)
+ project.setModificationState(True)
return new_uri
- def _projectLoadedCb(self, unused_project, unused_timeline):
- self.debug("Project loaded %s", self.current_project.props.uri)
- self.emit("new-project-loaded", self.current_project)
+ def _projectLoadedCb(self, project, unused_timeline):
+ self.debug("Project loaded %s", project.props.uri)
if self.__missing_uris:
- self.current_project.setModificationState(True)
+ return
+ self.emit("new-project-loaded", project)
self.time_loaded = time.time()
@@ -1219,6 +1219,9 @@ class Project(Loggable, GES.Project):
def do_loaded(self, unused_timeline):
""" vmethod, get called on "loaded" """
+ if not self.timeline:
+ return
+
self._ensureTracks()
self.timeline.props.auto_transition = True
self._ensureLayer()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]