[pitivi] CachedFactoryList: We sort factories by reverse order of rank. Fixes #594181



commit bd6e035e13dbf15611c55f8fa03127cdedd97db6
Author: Edward Hervey <bilboed bilboed com>
Date:   Sat Sep 5 11:01:30 2009 +0200

    CachedFactoryList: We sort factories by reverse order of rank. Fixes #594181
    
    Also add some debugging.

 pitivi/utils.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/utils.py b/pitivi/utils.py
index c3744f6..7bd8521 100644
--- a/pitivi/utils.py
+++ b/pitivi/utils.py
@@ -447,13 +447,18 @@ class CachedFactoryList(object):
 
     def _buildFactories(self):
         # build the cache
+        log.debug("utils", "Getting factories list")
         factories = self._registry.get_feature_list(gst.ElementFactory)
         if self._factoryFilter is not None:
+            log.debug("utils", "filtering")
             factories = filter(self._factoryFilter, factories)
 
-        factories.sort(key=lambda factory: factory.get_rank())
+        log.debug("utils", "Sorting by rank")
+        factories.sort(key=lambda factory: factory.get_rank(), reverse=True)
         self._factories = factories
+        log.debug("utils", "Cached factories is now %r", self._factories)
 
     def _registryFeatureAddedCb(self, registry, feature):
         # invalidate the cache
+        log.warning("utils", "New feature added, invalidating cached factories")
         self._factories = None



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