utils: Add helper functions get_object/register_object.
This commit is contained in:
parent
2694ab2e80
commit
3b3675d1af
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user