Detach meta object registry from application.

This commit is contained in:
Florian Bruhin 2014-09-24 07:27:32 +02:00
parent b0a9ecf094
commit 387622623d
2 changed files with 5 additions and 4 deletions

View File

@ -53,7 +53,6 @@ class Application(QApplication):
"""Main application instance. """Main application instance.
Attributes: Attributes:
meta_registry: The object registry of object registries.
_args: ArgumentParser instance. _args: ArgumentParser instance.
_commandrunner: The main CommandRunner instance. _commandrunner: The main CommandRunner instance.
_keyparsers: A mapping from modes to keyparsers. _keyparsers: A mapping from modes to keyparsers.
@ -82,8 +81,6 @@ class Application(QApplication):
'tabs': False, 'tabs': False,
'main': False, 'main': False,
} }
self.meta_registry = objreg.ObjectRegistry()
self.meta_registry['global'] = objreg.global_registry
objreg.register('app', self) objreg.register('app', self)
self._shutting_down = False self._shutting_down = False
self._keyparsers = None self._keyparsers = None
@ -480,7 +477,7 @@ class Application(QApplication):
"""Get all registered objects in all registries as a string.""" """Get all registered objects in all registries as a string."""
blocks = [] blocks = []
lines = [] lines = []
for name, registry in self.meta_registry.items(): for name, registry in objreg.meta_registry.items():
blocks.append((name, registry.dump_objects())) blocks.append((name, registry.dump_objects()))
for name, data in blocks: for name, data in blocks:
lines.append("{} object registry - {} objects:".format( lines.append("{} object registry - {} objects:".format(

View File

@ -70,7 +70,11 @@ class ObjectRegistry(collections.UserDict):
return lines return lines
# The registry for global objects
global_registry = ObjectRegistry() global_registry = ObjectRegistry()
# The object registry of object registries.
meta_registry = ObjectRegistry()
meta_registry['global'] = global_registry
def get(name, default=_UNSET): def get(name, default=_UNSET):