feat(main): implement def _unwrap_qvariant
This commit is contained in:
parent
ded74f065c
commit
051413472b
1 changed files with 24 additions and 0 deletions
|
|
@ -19,3 +19,27 @@ from .ui_builders import ScanSlicerUiBuilderMixin
|
||||||
|
|
||||||
|
|
||||||
# _unwrap_qvariant: function definition for ScanSlicer behavior.
|
# _unwrap_qvariant: function definition for ScanSlicer behavior.
|
||||||
|
def _unwrap_qvariant(value):
|
||||||
|
unwrapped = value
|
||||||
|
for _ in range(4):
|
||||||
|
if hasattr(unwrapped, "variant"):
|
||||||
|
try:
|
||||||
|
candidate = unwrapped.variant()
|
||||||
|
except Exception:
|
||||||
|
candidate = unwrapped
|
||||||
|
if candidate is not unwrapped:
|
||||||
|
unwrapped = candidate
|
||||||
|
continue
|
||||||
|
|
||||||
|
if hasattr(unwrapped, "value"):
|
||||||
|
try:
|
||||||
|
candidate = unwrapped.value()
|
||||||
|
except TypeError:
|
||||||
|
candidate = unwrapped.value
|
||||||
|
except Exception:
|
||||||
|
candidate = unwrapped
|
||||||
|
if candidate is not unwrapped:
|
||||||
|
unwrapped = candidate
|
||||||
|
continue
|
||||||
|
break
|
||||||
|
return unwrapped
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue