utils: Add helper functions get_object/register_object.

This commit is contained in:
Florian Bruhin 2014-09-23 07:31:54 +02:00
parent 2694ab2e80
commit 3b3675d1af

View File

@ -578,3 +578,13 @@ def is_enum(obj):
return issubclass(obj, enum.Enum)
except TypeError:
return False
def get_object(name, scope='global'):
"""Helper function to get an object."""
return QCoreApplication.instance().obj.get(name, scope)
def register_object(name, obj, scope='global'):
"""Helper function to register an object."""
return QCoreApplication.instance().obj.register(name, obj, scope)