[pitivi] SourceList: Allow only giving the factory to addFactory.



commit 3bfd9a6e41d019f835e3785257d0ddb73ea8e11d
Author: Edward Hervey <bilboed bilboed com>
Date:   Fri Apr 17 15:36:09 2009 +0200

    SourceList: Allow only giving the factory to addFactory.
    
    When providing a URISourceFactoryMixin factory we don't need to specify
    the URI (it's contained in the factory).
---
 pitivi/sourcelist.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/pitivi/sourcelist.py b/pitivi/sourcelist.py
index f7cac59..4b5eed0 100644
--- a/pitivi/sourcelist.py
+++ b/pitivi/sourcelist.py
@@ -26,6 +26,7 @@ import urllib
 from pitivi.discoverer import Discoverer
 from pitivi.signalinterface import Signallable
 from pitivi.log.loggable import Loggable
+from pitivi.factories.base import URISourceFactoryMixin
 
 class SourceList(object, Signallable, Loggable):
     """
@@ -137,10 +138,14 @@ class SourceList(object, Signallable, Loggable):
         for uri in rmuri:
             del self[uri]
 
-    def addFactory(self, uri, factory):
+    # FIXME : Invert the order of the arguments so we can just have:
+    # addFactory(self, factory, uri=None)
+    def addFactory(self, uri=None, factory=None):
         """
         Add an objectfactory for the given uri.
         """
+        if uri==None and isinstance(factory, URISourceFactoryMixin):
+            uri = factory.uri
         if uri in self and self[uri]:
             raise Exception("We already have an objectfactory for uri %s", uri)
         self.sources[uri] = factory



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