summaryrefslogtreecommitdiff
path: root/silx/gui/utils/__init__.py
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2020-07-21 14:45:14 +0200
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2020-07-21 14:45:14 +0200
commit328032e2317e3ac4859196bbf12bdb71795302fe (patch)
tree8cd13462beab109e3cb53410c42335b6d1e00ee6 /silx/gui/utils/__init__.py
parent33ed2a64c92b0311ae35456c016eb284e426afc2 (diff)
New upstream version 0.13.0+dfsg
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.