0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

feat: WidgetIO support for QLabel

This commit is contained in:
wyzula-jan
2023-11-09 21:00:05 +01:00
parent b85cc898d5
commit aa4c7c3385

View File

@ -9,6 +9,7 @@ from PyQt5.QtWidgets import (
QTableWidgetItem, QTableWidgetItem,
QVBoxLayout, QVBoxLayout,
QCheckBox, QCheckBox,
QLabel,
) )
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
@ -77,6 +78,14 @@ class CheckBoxHandler(WidgetHandler):
widget.setChecked(value) 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: class WidgetIO:
"""Public interface for getting and setting values using handler mapping""" """Public interface for getting and setting values using handler mapping"""
@ -87,6 +96,7 @@ class WidgetIO:
QSpinBox: SpinBoxHandler, QSpinBox: SpinBoxHandler,
QDoubleSpinBox: SpinBoxHandler, QDoubleSpinBox: SpinBoxHandler,
QCheckBox: CheckBoxHandler, QCheckBox: CheckBoxHandler,
QLabel: LabelHandler,
} }
@staticmethod @staticmethod