From 387622623d682751b213f9d789ac0e45d32d3c57 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 24 Sep 2014 07:27:32 +0200 Subject: [PATCH] Detach meta object registry from application. --- qutebrowser/app.py | 5 +---- qutebrowser/utils/objreg.py | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 255f8ab7b..1417d6791 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -53,7 +53,6 @@ class Application(QApplication): """Main application instance. Attributes: - meta_registry: The object registry of object registries. _args: ArgumentParser instance. _commandrunner: The main CommandRunner instance. _keyparsers: A mapping from modes to keyparsers. @@ -82,8 +81,6 @@ class Application(QApplication): 'tabs': False, 'main': False, } - self.meta_registry = objreg.ObjectRegistry() - self.meta_registry['global'] = objreg.global_registry objreg.register('app', self) self._shutting_down = False self._keyparsers = None @@ -480,7 +477,7 @@ class Application(QApplication): """Get all registered objects in all registries as a string.""" blocks = [] lines = [] - for name, registry in self.meta_registry.items(): + for name, registry in objreg.meta_registry.items(): blocks.append((name, registry.dump_objects())) for name, data in blocks: lines.append("{} object registry - {} objects:".format( diff --git a/qutebrowser/utils/objreg.py b/qutebrowser/utils/objreg.py index 7636a0f0b..45bc5fed3 100644 --- a/qutebrowser/utils/objreg.py +++ b/qutebrowser/utils/objreg.py @@ -70,7 +70,11 @@ class ObjectRegistry(collections.UserDict): return lines +# The registry for global objects global_registry = ObjectRegistry() +# The object registry of object registries. +meta_registry = ObjectRegistry() +meta_registry['global'] = global_registry def get(name, default=_UNSET):