[pitivi] Rename Formatter._parse to Formatter._loadProject for consistency with Formatter._saveProject.



commit ded955ecc529a35639ae1da52f504777c5a0fc90
Author: Alessandro Decina <alessandro d gmail com>
Date:   Fri Jun 5 16:37:06 2009 +0200

    Rename Formatter._parse to Formatter._loadProject for consistency with Formatter._saveProject.
    
    Also, remove the optional project argument from _loadProject (it was unused).
---
 pitivi/formatters/base.py     |    8 ++++----
 pitivi/formatters/etree.py    |    2 +-
 pitivi/formatters/playlist.py |    2 +-
 pitivi/projectmanager.py      |    3 +--
 tests/test_projectmanager.py  |    6 +++---
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/pitivi/formatters/base.py b/pitivi/formatters/base.py
index 707ca84..0b3fff6 100644
--- a/pitivi/formatters/base.py
+++ b/pitivi/formatters/base.py
@@ -123,7 +123,7 @@ class Formatter(Signallable, Loggable):
 
         # parse the format (subclasses)
         # FIXME : maybe have a convenience method for opening a location
-        self._parse(location, project)
+        self._loadProject(location, project)
 
         self.debug("About to get used sources")
         # ask for all sources being used
@@ -235,14 +235,14 @@ class Formatter(Signallable, Loggable):
         The returned locations (C{URI}) must be valid uri. Subclasses can
         call L{validateSourceURI} to make sure the C{URI} is valid.
 
-        @precondition: L{_parse} will be called before, so subclasses can
+        @precondition: L{_loadProject} will be called before, so subclasses can
         use any information they extracted during that call.
         @returns: A list of sources used in the given project.
         @precondition: self.project is not available at this point.
         """
         raise NotImplementedError
 
-    def _parse(self, location, project=None):
+    def _loadProject(self, location, project=None):
         """
         Open and parse the given location.
 
@@ -265,7 +265,7 @@ class Formatter(Signallable, Loggable):
 
         To be implemented by subclasses.
 
-        @precondition: L{_parse} and L{_getSources} will have been called
+        @precondition: L{_loadProject} and L{_getSources} will have been called
         before, and all the sources will have been discovered.
         @precondition: self.project is valid and exists when this method
         is called.
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index 9d94801..af93805 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -535,7 +535,7 @@ class ElementTreeFormatter(Formatter):
         f.write(tostring(root))
         f.close()
 
-    def _parse(self, location, project=None):
+    def _loadProject(self, location, project=None):
         self.debug("location:%s, project:%r", location, project)
         # open the given location
         self._context.rootelement = parse(location.split('://', 1)[1])
diff --git a/pitivi/formatters/playlist.py b/pitivi/formatters/playlist.py
index ed7d8c0..1ca313c 100644
--- a/pitivi/formatters/playlist.py
+++ b/pitivi/formatters/playlist.py
@@ -41,7 +41,7 @@ class PlaylistFormatter(LoadOnlyFormatter):
             return 'file://' + ln.strip()
         return 'file://' + os.path.join(self._basedir, ln.strip())
 
-    def _parse(self, location, project=None):
+    def _loadProject(self, location, project=None):
         path = location.split('file://', 1)[1]
         self._basedir = os.path.dirname(path)
         res = []
diff --git a/pitivi/projectmanager.py b/pitivi/projectmanager.py
index bfd3eda..139ca40 100644
--- a/pitivi/projectmanager.py
+++ b/pitivi/projectmanager.py
@@ -64,10 +64,9 @@ class ProjectManager(Signallable, Loggable):
                     FormatterLoadError(_("Couldn't close current project")))
             return
 
-        project = formatter.newProject()
         self._connectToFormatter(formatter)
         # start loading the project, from now on everything is async
-        formatter.loadProject(uri, project)
+        formatter.loadProject(uri)
 
     def closeRunningProject(self):
         """ close the current project """
diff --git a/tests/test_projectmanager.py b/tests/test_projectmanager.py
index de80579..9d0938d 100644
--- a/tests/test_projectmanager.py
+++ b/tests/test_projectmanager.py
@@ -119,7 +119,7 @@ class TestProjectManager(TestCase):
             def _validateUri(self, uri):
                 pass
 
-            def _parse(self, location, project=None):
+            def _loadProject(self, location, project=None):
                 raise FormatterError()
         self.manager._getFormatterForUri = lambda uri: FailFormatter()
 
@@ -143,7 +143,7 @@ class TestProjectManager(TestCase):
             def _validateUri(self, uri):
                 pass
 
-            def _parse(self, location, project=None):
+            def _loadProject(self, location, project=None):
                 pass
 
             def _getSources(self):
@@ -175,7 +175,7 @@ class TestProjectManager(TestCase):
             def _validateUri(self, uri):
                 pass
 
-            def _parse(self, location, project=None):
+            def _loadProject(self, location, project=None):
                 pass
 
             def _getSources(self):



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