fix(digital-twin): resolve offsets file from package
CI for debye_bec / test (push) Successful in 1m5s
CI for debye_bec / test (push) Successful in 1m5s
Load x01da_offsets.yaml relative to digital_twin.py instead of the process working directory so the widget starts correctly from any launch location.
This commit is contained in:
committed by
Stephan
co-authored by
Stephan
parent
0bfa9c10b8
commit
95d920e661
@@ -62,6 +62,8 @@ from debye_bec.bec_widgets.widgets.digital_twin.widgets.qt_widgets import ComboB
|
||||
|
||||
logger = bec_logger.logger
|
||||
|
||||
OFFSET_FILE = Path(__file__).with_name("x01da_offsets.yaml")
|
||||
|
||||
|
||||
class DigitalTwin(BECWidget, QWidget):
|
||||
"""
|
||||
@@ -665,11 +667,10 @@ class DigitalTwin(BECWidget, QWidget):
|
||||
|
||||
if self.offsets == {}:
|
||||
# Load offsets
|
||||
file = Path(self.offset_file)
|
||||
if not file.exists():
|
||||
raise FileNotFoundError(f"Offset file not found: {self.offset_file}")
|
||||
if not OFFSET_FILE.exists():
|
||||
raise FileNotFoundError(f"Offset file not found: {OFFSET_FILE}")
|
||||
|
||||
with file.open("r", encoding="utf-8") as f:
|
||||
with OFFSET_FILE.open("r", encoding="utf-8") as f:
|
||||
data = yaml.safe_load(f)
|
||||
|
||||
if not isinstance(data, dict):
|
||||
@@ -710,7 +711,7 @@ class DigitalTwin(BECWidget, QWidget):
|
||||
intro_label.setWordWrap(True)
|
||||
layout.addWidget(intro_label)
|
||||
|
||||
file = QLabel(self.offset_file)
|
||||
file = QLabel(str(OFFSET_FILE))
|
||||
file.setWordWrap(True)
|
||||
font = QFont()
|
||||
font.setItalic(True)
|
||||
|
||||
Reference in New Issue
Block a user