mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 19:21:50 +02:00
fix(signal_line_edit): red painter for SignalLineEdit fixed
This commit is contained in:
@ -62,7 +62,7 @@ class SignalLineEdit(DeviceSignalInputBase, QLineEdit):
|
|||||||
self.set_device(device)
|
self.set_device(device)
|
||||||
if default is not None:
|
if default is not None:
|
||||||
self.set_signal(default)
|
self.set_signal(default)
|
||||||
self.textChanged.connect(self.validate_device)
|
self.textChanged.connect(self.check_validity)
|
||||||
self.validate_device(self.text())
|
self.validate_device(self.text())
|
||||||
|
|
||||||
def get_current_device(self) -> object:
|
def get_current_device(self) -> object:
|
||||||
@ -111,7 +111,6 @@ class SignalLineEdit(DeviceSignalInputBase, QLineEdit):
|
|||||||
Args:
|
Args:
|
||||||
text (str): Text in the combobox.
|
text (str): Text in the combobox.
|
||||||
"""
|
"""
|
||||||
print("test")
|
|
||||||
if self.validate_device(self.device) is False:
|
if self.validate_device(self.device) is False:
|
||||||
return
|
return
|
||||||
if self.validate_signal(text) is False:
|
if self.validate_signal(text) is False:
|
||||||
@ -122,12 +121,24 @@ class SignalLineEdit(DeviceSignalInputBase, QLineEdit):
|
|||||||
device_signal = f"{self.device}_{text}"
|
device_signal = f"{self.device}_{text}"
|
||||||
self.device_signal_changed.emit(device_signal)
|
self.device_signal_changed.emit(device_signal)
|
||||||
|
|
||||||
|
@Slot(str)
|
||||||
|
def set_device(self, device: str) -> None:
|
||||||
|
"""
|
||||||
|
Set the device name.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
device (str): Device name.
|
||||||
|
"""
|
||||||
|
super().set_device(device)
|
||||||
|
self.check_validity(self.text())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
if __name__ == "__main__": # pragma: no cover
|
||||||
# pylint: disable=import-outside-toplevel
|
# pylint: disable=import-outside-toplevel
|
||||||
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
||||||
|
|
||||||
from bec_widgets.utils.colors import set_theme
|
from bec_widgets.utils.colors import set_theme
|
||||||
|
from bec_widgets.widgets.device_line_edit.device_line_edit import DeviceLineEdit
|
||||||
|
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
set_theme("dark")
|
set_theme("dark")
|
||||||
@ -135,6 +146,10 @@ if __name__ == "__main__": # pragma: no cover
|
|||||||
widget.setFixedSize(200, 200)
|
widget.setFixedSize(200, 200)
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
widget.setLayout(layout)
|
widget.setLayout(layout)
|
||||||
layout.addWidget(SignalLineEdit(device="samx"))
|
line_edit = DeviceLineEdit()
|
||||||
|
signal_line_edit = SignalLineEdit()
|
||||||
|
layout.addWidget(line_edit)
|
||||||
|
line_edit.textChanged.connect(signal_line_edit.set_device)
|
||||||
|
layout.addWidget(signal_line_edit)
|
||||||
widget.show()
|
widget.show()
|
||||||
app.exec_()
|
app.exec_()
|
||||||
|
Reference in New Issue
Block a user