GNOME Bugzilla – Bug 635992
Missing files dialog: opening a project with a moved file does not allow saving the project after loading
Last modified: 2010-11-29 16:20:29 UTC
Steps to reproduce: - $ ./bin/pitivi - Import /tmp/clip.mkv - Ctrl+S, /tmp/1.xptv - Close PiTiVi. - $ mv /tmp/clip.mkv /tmp/clip2.mkv - $ ./bin/pitivi /tmp/1.xptv, notice it asks where the file has moved. Specify the new location, notice the File -> Save menu item is disabled. It should be enabled.
Wasted a ton of time trying to figure why this doesn't work: diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py index 0227eac..a622729 100644 @@ -975,6 +975,9 @@ class PitiviMainWindow(gtk.Window, Loggable): new = chooser.get_uri() if new: formatter.addMapping(uri, unquote(new)) + # FIXME: why won't the two lines below work? + self.app.current.setModificationState(True) # Allow saving + self.actiongroup.get_action("SaveProject").set_sensitive(True) else: self.log("User didn't choose a URI for the missing file") # FIXME: not calling addMapping doesn't keep the formatter from The fact that directly setting the sensitivity of the button doesn't work tells me that something is overriding it all when the project finishes loading... but I can't figure out why. ---------------------- Workaround for users: actually change something in the project after loading it.
Created attachment 175466 [details] [review] Fixes the problem, not sure it is the best way to do it
Review of attachment 175466 [details] [review]: Seems reasonable. Not completely sure I understand how it works. ::: pitivi/ui/mainwindow.py @@ +801,3 @@ self._syncDoUndo(self.app.action_log) + if self._missingUriOnLoading: I'm guessing that this variable is actually set by line 993 below @@ +805,3 @@ + self.actiongroup.get_action("SaveProject").set_sensitive(True) + self._missingUriOnLoading = False + Is it necessary to clear this? @@ +991,3 @@ if new: formatter.addMapping(uri, unquote(new)) + self._missingUriOnLoading = True So here, I assume, the formatter detected that files were missing?
If we detect that a file is missing, the user is asked, and if he can find it: * We set the modification state the project to 'dirty' (so the user will be asked to save it or not if he closes PiTiVi) * We make sure that the user can save it right after it is loaded.
commit 38f6362071f7a86c5ad5b0d87c989af16d003fbb Author: Thibault Saunier <thibault.saunier@collabora.co.uk> Date: Mon Nov 29 15:51:19 2010 +0000 fig bug 635992 Missing files dialog: ...does not allow saving the project after loading
Tested, works as expected with the committed fix in pitivi git.