45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
import os
|
|
import sys
|
|
|
|
from PySide6.QtCore import Qt
|
|
from PySide6.QtGui import QColor, QFont, QFontInfo, QIcon, QPalette
|
|
from PySide6.QtWidgets import (
|
|
QApplication,
|
|
QGridLayout,
|
|
QHBoxLayout,
|
|
QLabel,
|
|
QMainWindow,
|
|
QPushButton,
|
|
QWidget,
|
|
)
|
|
|
|
from .autoslicer import Autoslicer, AutoslicerParams
|
|
from .controller import ScanSlicerControllerMixin
|
|
from .ui_builders import ScanSlicerUiBuilderMixin
|
|
|
|
|
|
# _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
|