From 3b3675d1afcc77803b62dbe3c062f14f1cdadd42 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 23 Sep 2014 07:31:54 +0200 Subject: [PATCH] utils: Add helper functions get_object/register_object. --- qutebrowser/utils/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 387c53d90..2df4aa889 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -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)