summaryrefslogtreecommitdiff
path: root/silx/gui/utils/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'silx/gui/utils/__init__.py')
-rwxr-xr-xsilx/gui/utils/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/silx/gui/utils/__init__.py b/silx/gui/utils/__init__.py
index a4e442f..726ad74 100755
--- a/silx/gui/utils/__init__.py
+++ b/silx/gui/utils/__init__.py
@@ -48,6 +48,23 @@ def blockSignals(*objs):
obj.blockSignals(previous)
+class LockReentrant():
+ """Context manager to lock a code block and check the state.
+ """
+ def __init__(self):
+ self.__locked = False
+
+ def __enter__(self):
+ self.__locked = True
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.__locked = False
+
+ def locked(self):
+ """Returns True if the code block is locked"""
+ return self.__locked
+
+
def getQEventName(eventType):
"""
Returns the name of a QEvent.