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

fix: widget_IO.py added handler for QCheckBox

This commit is contained in:
wyzula-jan
2023-11-08 12:14:03 +01:00
parent 63f23cf78e
commit 18a702572f

View File

@ -8,6 +8,7 @@ from PyQt5.QtWidgets import (
QDoubleSpinBox, QDoubleSpinBox,
QTableWidgetItem, QTableWidgetItem,
QVBoxLayout, QVBoxLayout,
QCheckBox,
) )
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
@ -68,6 +69,14 @@ class SpinBoxHandler(WidgetHandler):
widget.setValue(value) widget.setValue(value)
class CheckBoxHandler(WidgetHandler):
def get_value(self, widget):
return widget.isChecked()
def set_value(self, widget, value):
widget.setChecked(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"""
@ -77,6 +86,7 @@ class WidgetIO:
QTableWidget: TableWidgetHandler, QTableWidget: TableWidgetHandler,
QSpinBox: SpinBoxHandler, QSpinBox: SpinBoxHandler,
QDoubleSpinBox: SpinBoxHandler, QDoubleSpinBox: SpinBoxHandler,
QCheckBox: CheckBoxHandler,
} }
@staticmethod @staticmethod