From aa4c7c3385f52e4bbc805ee2aced181929943a89 Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Thu, 9 Nov 2023 21:00:05 +0100 Subject: [PATCH] feat: WidgetIO support for QLabel --- bec_widgets/qt_utils/widget_io.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bec_widgets/qt_utils/widget_io.py b/bec_widgets/qt_utils/widget_io.py index 6220fc4c..d99714d3 100644 --- a/bec_widgets/qt_utils/widget_io.py +++ b/bec_widgets/qt_utils/widget_io.py @@ -9,6 +9,7 @@ from PyQt5.QtWidgets import ( QTableWidgetItem, QVBoxLayout, QCheckBox, + QLabel, ) from abc import ABC, abstractmethod @@ -77,6 +78,14 @@ class CheckBoxHandler(WidgetHandler): widget.setChecked(value) +class LabelHandler(WidgetHandler): + def get_value(self, widget): + return widget.text() + + def set_value(self, widget, value): + widget.setText(value) + + class WidgetIO: """Public interface for getting and setting values using handler mapping""" @@ -87,6 +96,7 @@ class WidgetIO: QSpinBox: SpinBoxHandler, QDoubleSpinBox: SpinBoxHandler, QCheckBox: CheckBoxHandler, + QLabel: LabelHandler, } @staticmethod