diff options
| author | tassaron | 2017-08-15 22:20:25 -0400 |
|---|---|---|
| committer | tassaron | 2017-08-15 22:20:25 -0400 |
| commit | a1d7cbb984f2a6c2ea976daa8914a2c9845ee21c (patch) | |
| tree | d1129d435b0548f4538bf0099cd82013c2fc1f7d /src/toolkit/common.py | |
| parent | 733c005eeaf5d3ff15e0f60d320f5c03472bad60 (diff) | |
undoable edits for normal component settings; TODO: merge small edits
Diffstat (limited to 'src/toolkit/common.py')
| -rw-r--r-- | src/toolkit/common.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/toolkit/common.py b/src/toolkit/common.py index eba57d9..51ad023 100644 --- a/src/toolkit/common.py +++ b/src/toolkit/common.py @@ -9,6 +9,18 @@ import subprocess from collections import OrderedDict +class blockSignals: + '''A context manager to temporarily block a Qt widget from updating''' + def __init__(self, widget): + self.widget = widget + + def __enter__(self): + self.widget.blockSignals(True) + + def __exit__(self, *args): + self.widget.blockSignals(False) + + def badName(name): '''Returns whether a name contains non-alphanumeric chars''' return any([letter in string.punctuation for letter in name]) |
