[pitivi] formatters, projectmanager.py: pass instance of factory in missing-uri signal



commit 650890d03cc15f3f7ce28dc5e1a1aa8b1941175f
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Tue Jul 28 15:08:12 2009 -0700

    formatters, projectmanager.py: pass instance of factory in missing-uri signal

 pitivi/formatters/base.py  |    6 +++---
 pitivi/formatters/etree.py |    9 +++++----
 pitivi/projectmanager.py   |    2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/formatters/base.py b/pitivi/formatters/base.py
index 7c7b087..2f76b74 100644
--- a/pitivi/formatters/base.py
+++ b/pitivi/formatters/base.py
@@ -69,7 +69,7 @@ class Formatter(Signallable, Loggable):
         "new-project-failed": ["uri", "exception"],
         "save-project-failed": ["project", "uri", "exception"],
         "project-saved": ["project", "uri"],
-        "missing-uri" : ["uri"]
+        "missing-uri" : ["uri", "factory"]
         }
 
     description = "Description of the format"
@@ -322,7 +322,7 @@ class Formatter(Signallable, Loggable):
 
         self.directorymapping[oldprefix] = newprefix
 
-    def validateSourceURI(self, uri):
+    def validateSourceURI(self, uri, factory):
         """
         Makes sure the given uri is accessible for reading.
 
@@ -361,7 +361,7 @@ class Formatter(Signallable, Loggable):
                     return probable
 
         # else, let's fire the signal...
-        self.emit('missing-uri', uri)
+        self.emit('missing-uri', uri, factory)
 
         # and check again
         for k, v in self.directorymapping.iteritems():
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index d1200c4..8f6d70f 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -167,10 +167,6 @@ class ElementTreeFormatter(Formatter):
         # FIXME : we should check if the given ObjectFactory
         # requires a filename !
         filename = element.attrib.get("filename", None)
-        if filename is not None:
-            if isinstance(filename, unicode):
-                filename = filename.encode("utf-8")
-            filename = self.validateSourceURI(filename)
 
         if filename is not None:
             factory = klass(filename)
@@ -190,6 +186,11 @@ class ElementTreeFormatter(Formatter):
             stream = self._loadStream(stream_element)
             factory.addOutputStream(stream)
 
+        if filename is not None:
+            if isinstance(filename, unicode):
+                filename = filename.encode("utf-8")
+            filename = self.validateSourceURI(filename, factory)
+
         self._context.factories[element.attrib["id"]] = factory
         return factory
 
diff --git a/pitivi/projectmanager.py b/pitivi/projectmanager.py
index b9673c7..0f1156f 100644
--- a/pitivi/projectmanager.py
+++ b/pitivi/projectmanager.py
@@ -189,7 +189,7 @@ class ProjectManager(Signallable, Loggable):
         self.current = None
         self.emit("new-project-failed", uri, exception)
 
-    def _formatterMissingURICb(self, formatter, uri):
+    def _formatterMissingURICb(self, formatter, uri, factory):
         return self.emit("missing-uri", formatter, uri)
 
     def _formatterSaveProjectFailed(self, formatter, project, uri, exception):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]