From 0d64d62fb0b46c0997bad39cd57dcb4950efa586 Mon Sep 17 00:00:00 2001 From: linuswck Date: Tue, 10 Sep 2024 15:29:11 +0800 Subject: [PATCH] gui: Add pd_mon config form - force user to follow a sequence of steps for safely configuring pd_mon --- pykirdy/kirdy_qt.py | 128 +++++++- pykirdy/ui/config_pd_mon_form.ui | 488 ++++++++++++++++++++++++++++ pykirdy/ui/ui_config_pd_mon_form.py | 295 +++++++++++++++++ 3 files changed, 904 insertions(+), 7 deletions(-) create mode 100644 pykirdy/ui/config_pd_mon_form.ui create mode 100644 pykirdy/ui/ui_config_pd_mon_form.py diff --git a/pykirdy/kirdy_qt.py b/pykirdy/kirdy_qt.py index 1bfc073..aa4417d 100644 --- a/pykirdy/kirdy_qt.py +++ b/pykirdy/kirdy_qt.py @@ -26,6 +26,7 @@ from datetime import datetime, timezone, timedelta from time import time from typing import Any, Optional, List from ui.ui_conn_settings_form import Ui_Conn_Settings_Form +from ui.ui_config_pd_mon_form import Ui_Cfg_Pd_Mon_Form from ui.ui_update_network_settings_form import Ui_Update_Network_Settings_Form from dateutil import tz import math @@ -54,6 +55,9 @@ def siConvert(val, suffix, typ=float): siConvert(0.1, "mA") # returns 100 """ + if val is None: + val = 0.0 + val, siprefix, suffix = siParse(str(val)+suffix, FLOAT_REGEX) v = typ(val) @@ -70,6 +74,7 @@ class Kirdy(QObject): connected_sig = pyqtSignal(bool) setting_update_sig = pyqtSignal(dict) report_update_sig = pyqtSignal(dict) + cmd_fail_sig = pyqtSignal(str) def __init__(self, parent, kirdy, _poll_interval): super().__init__(parent) @@ -80,6 +85,7 @@ class Kirdy(QObject): self.connected_sig.connect(self.connected_setup) self._kirdy.set_report_sig(self.report_update_sig) + self._kirdy.set_err_msg_sig(self.cmd_fail_sig) self._timer = QtCore.QBasicTimer() def connected(self): @@ -317,6 +323,10 @@ class UpdateNetSettingsForm(QtWidgets.QDialog, Ui_Update_Network_Settings_Form): except (OSError, ValueError): return None +class CfgPdMonForm(QtWidgets.QDialog, Ui_Cfg_Pd_Mon_Form): + def __init__(self): + super().__init__() + self.setupUi(self) class ConnSettingsForm(QtWidgets.QDialog, Ui_Conn_Settings_Form): def __init__(self): @@ -355,18 +365,19 @@ class MainWindow(QtWidgets.QMainWindow): {'name': 'LF Mod Termination (50 Ohm)', 'type': 'list', 'limits': ['On', 'Off'], 'readonly': True, "compactHeight": False} ]}, {'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [ - {'name': 'LD Current Set', 'type': 'float', 'value': 0, 'step': 0.001, 'decimals': 6, 'limits': (0, 300), + {'name': 'LD Current Set', 'type': 'float', 'value': 0, 'step': 0.001, 'format': '{value:.4f}', 'decimals': 6, 'limits': (0, 300), 'unit': 'mA', 'lock': False, 'target': 'laser', 'action': 'set_i', "compactHeight": False}, {'name': 'LD Terminals Short', 'type': 'bool', 'value': False, 'lock': False, 'target': 'laser', 'action': 'set_ld_terms_short', "compactHeight": False}, {'name': 'Default Power On', 'type': 'bool', 'value': False, 'lock': False, 'target': 'laser', 'action': 'set_default_pwr_on', "compactHeight": False}, ]}, {'name': 'Photodiode Monitor Config', 'expanded': False, 'type': 'group', 'children': [ - {'name': 'LD Power Limit', 'type': 'float', 'value': 0, 'step': 0.001, 'decimals': 6, 'limits': (0, float("inf")), + {'name': 'LD Power Limit', 'type': 'float', 'value': 0, 'step': 0.001, 'format': '{value:.4f}', 'decimals': 6, 'limits': (0, float("inf")), 'unit': 'mW', 'lock': False, 'target': 'laser', 'action': 'set_ld_pwr_limit', "compactHeight": False}, - {'name': 'Responsitivity', 'type': 'float', 'value': 0, 'step': 0.001, 'decimals': 6, 'limits': (0, float("inf")), - 'unit': 'mA/W', 'lock': False, 'target': 'laser', 'action': 'set_pd_mon_responsitivity', "compactHeight": False}, - {'name': 'Dark Current', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, float("inf")), - 'unit': 'uA', 'lock': False, 'target': 'laser', 'action': 'set_pd_mon_dark_current', "compactHeight": False}, + {'name': 'Responsitivity', 'type': 'float', 'value': 0, 'step': 0.001, 'format': '{value:.4f}', 'decimals': 6, 'limits': (0, float("inf")), + 'unit': 'mA/W', 'lock': False, 'target': 'laser', 'action': 'set_pd_mon_responsitivity', "compactHeight": False, 'readonly': True}, + {'name': 'Dark Current', 'type': 'float', 'value': 0, 'step': 1, 'format': '{value:.4f}', 'decimals': 6, 'limits': (0, float("inf")), + 'unit': 'uA', 'lock': False, 'target': 'laser', 'action': 'set_pd_mon_dark_current', "compactHeight": False, 'readonly': True}, + {'name': 'Configure Photodiode Monitor', 'type': 'action'}, ]}, ] @@ -451,6 +462,8 @@ class MainWindow(QtWidgets.QMainWindow): self.ip_addr = self.DEFAULT_IP_ADDR self.port = self.DEFAULT_PORT + self.cfg_pd_mon_form = CfgPdMonForm() + self.conn_settings_form = ConnSettingsForm() self.conn_settings_form.accepted.connect(self.start_connecting) @@ -502,6 +515,7 @@ class MainWindow(QtWidgets.QMainWindow): Parameter.create(name=f"Thermostat Parameters", type='group', value=3, children=self.THERMOSTAT_PARAMETERS), ] self._set_param_tree() + self._set_up_pd_mon_form() self.tec_i_graph.setTitle("TEC Current") self.tec_temp_graph.setTitle("TEC Temperature") @@ -516,6 +530,7 @@ class MainWindow(QtWidgets.QMainWindow): self.kirdy_handler.setting_update_sig.connect(self.update_thermostat_ctrl_panel_settings) self.kirdy_handler.report_update_sig.connect(self.update_ld_ctrl_panel_readings) self.kirdy_handler.report_update_sig.connect(self.update_thermostat_ctrl_panel_readings) + self.kirdy_handler.cmd_fail_sig.connect(self.cmd_cannot_execute) self.graphs = Graphs(self.ld_i_set_graph, self.pd_mon_pwr_graph, self.tec_i_graph, self.tec_temp_graph, max_samples=self.max_samples) self.kirdy_handler.report_update_sig.connect(self.graphs.plot_append) @@ -586,6 +601,21 @@ class MainWindow(QtWidgets.QMainWindow): self.update_net_settings_form.show() self.menu_action_update_net_settings.triggered.connect(show_update_net_settings_form) + def update_pd_mon_form_readings(self, ld_settings): + pwr_unit = self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').opts.get("unit", None) + self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').setOpts(limits= (0, siConvert(ld_settings["ld_pwr_limit"]["max"], pwr_unit))) + self.cfg_pd_mon_form.settable_pwr_range_display_lbl.setText(f" 0 - {siConvert(ld_settings['ld_pwr_limit']['max'], pwr_unit):.4f}") + self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.setMaximum(siConvert(ld_settings['ld_pwr_limit']['max'], pwr_unit)) + + responsitivity_unit = self.cfg_pd_mon_form.cfg_responsitivity_spinbox.unit + self.cfg_pd_mon_form.cfg_responsitivity_reading.setText(f"{siConvert(ld_settings['pd_mon_params']['responsitivity'], responsitivity_unit):.4f}") + + i_dark_unit = self.cfg_pd_mon_form.cfg_dark_current_spinbox.unit + self.cfg_pd_mon_form.cfg_dark_current_reading.setText(f"{siConvert(ld_settings['pd_mon_params']['i_dark'], i_dark_unit):.4f}") + + pwr_limit_unit = self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.unit + self.cfg_pd_mon_form.cfg_pwr_limit_reading.setText(f"{siConvert(ld_settings['ld_pwr_limit']['value'], pwr_limit_unit):.4f}") + def show_conn_settings_form(self): ip_addr = self.ip_addr.split(".") self.conn_settings_form.addr_in_0.setText(ip_addr[0]) @@ -648,6 +678,70 @@ class MainWindow(QtWidgets.QMainWindow): self.plot_settings.setMenu(self.plot_menu) + def _set_up_pd_mon_form(self): + @pyqtSlot(bool) + def ld_pwr_on(_): + self.kirdy.task_dispatcher(self.kirdy.laser.clear_alarm()) + self.kirdy.task_dispatcher(self.kirdy.laser.set_power_on(True)) + self.cfg_pd_mon_form.pwr_on_btn.clicked.connect(ld_pwr_on) + + @pyqtSlot(bool) + def ld_pwr_off(_): + self.kirdy.task_dispatcher(self.kirdy.laser.set_power_on(False)) + self.cfg_pd_mon_form.pwr_off_btn.clicked.connect(ld_pwr_off) + + def get_spinbox_value(spinbox): + _, _, suffix = siParse(str(spinbox.value())+spinbox.unit, regex=FLOAT_REGEX) + return siEval(str(spinbox.value())+spinbox.unit, regex=FLOAT_REGEX, suffix=suffix) + + def set_spinbox_value(spinbox, val): + spinbox.setValue(siConvert(val, spinbox.unit)) + + @pyqtSlot(bool) + def apply_pd_params(_): + responsitivity = get_spinbox_value(self.cfg_pd_mon_form.cfg_responsitivity_spinbox) + dark_current = get_spinbox_value(self.cfg_pd_mon_form.cfg_dark_current_spinbox) + self.kirdy.task_dispatcher(self.kirdy.laser.set_pd_mon_responsitivity(responsitivity)) + self.kirdy.task_dispatcher(self.kirdy.laser.set_pd_mon_dark_current(dark_current)) + self.kirdy.task_dispatcher(self.kirdy.laser.apply_pd_params()) + self.cfg_pd_mon_form.apply_pd_params_btn.clicked.connect(apply_pd_params) + + @pyqtSlot(bool) + def apply_ld_pwr_limit(_): + pwr_limit = get_spinbox_value(self.cfg_pd_mon_form.cfg_pwr_limit_spinbox) + self.kirdy.task_dispatcher(self.kirdy.laser.set_ld_pwr_limit(pwr_limit)) + self.cfg_pd_mon_form.apply_pwr_limit_btn.clicked.connect(apply_ld_pwr_limit) + + @pyqtSlot(bool) + def rst_ld_pwr_limit(_): + pwr_limit = self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.value() + self.kirdy.task_dispatcher(self.kirdy.laser.set_ld_pwr_limit(0)) + self.cfg_pd_mon_form.rst_ld_pwr_limit_btn.clicked.connect(rst_ld_pwr_limit) + + @asyncSlot(bool) + async def apply_ld_pwr_limit_max(_): + settings = await self.kirdy.device.get_settings_summary() + set_spinbox_value(self.cfg_pd_mon_form.cfg_pwr_limit_spinbox, settings['laser']['ld_pwr_limit']['max']) + self.kirdy.task_dispatcher(self.kirdy.laser.set_ld_pwr_limit(settings['laser']['ld_pwr_limit']['max'])) + self.cfg_pd_mon_form.apply_pwr_limit_max_btn.clicked.connect(apply_ld_pwr_limit_max) + + ld_pwr_limit_unit = self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').opts["unit"] + ld_pwr_limit_text = self.cfg_pd_mon_form.cfg_pwr_limit_lbl.text() + self.cfg_pd_mon_form.cfg_pwr_limit_lbl.setText(ld_pwr_limit_text.replace(":", f" ({ld_pwr_limit_unit}):")) + self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.unit = ld_pwr_limit_unit + settable_pwr_limit_text = self.cfg_pd_mon_form.settable_pwr_range_lbl.text() + self.cfg_pd_mon_form.settable_pwr_range_lbl.setText(settable_pwr_limit_text.replace(":", f" ({ld_pwr_limit_unit}):")) + + pd_responsitivity_unit = self.params[1].child('Photodiode Monitor Config', 'Responsitivity').opts["unit"] + pd_responsitivity_text = self.cfg_pd_mon_form.cfg_responsitivity_lbl.text() + self.cfg_pd_mon_form.cfg_responsitivity_lbl.setText(pd_responsitivity_text.replace(":", f" ({pd_responsitivity_unit}):")) + self.cfg_pd_mon_form.cfg_responsitivity_spinbox.unit = pd_responsitivity_unit + + pd_dark_current_unit = self.params[1].child('Photodiode Monitor Config', 'Dark Current').opts["unit"] + pd_dark_current_text = self.cfg_pd_mon_form.cfg_dark_current_lbl.text() + self.cfg_pd_mon_form.cfg_dark_current_lbl.setText(pd_dark_current_text.replace(":", f" ({pd_dark_current_unit}):")) + self.cfg_pd_mon_form.cfg_dark_current_spinbox.unit = pd_dark_current_unit + def _set_param_tree(self): status = self.ld_status status.setHeaderHidden(True) @@ -695,6 +789,25 @@ class MainWindow(QtWidgets.QMainWindow): self.loading_spinner.hide() self.params[3].child('PID Config', 'PID Auto Tune', 'Run').sigActivated.connect(autotune) + @pyqtSlot() + def show_pd_mon_cfg_form(parm): + ld_pwr_limit = self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').value() + pd_responsitivity = self.params[1].child('Photodiode Monitor Config', 'Responsitivity').value() + pd_dark_current = self.params[1].child('Photodiode Monitor Config', 'Dark Current').value() + + self.cfg_pd_mon_form.cfg_responsitivity_spinbox.setValue(pd_responsitivity) + self.cfg_pd_mon_form.cfg_pwr_limit_spinbox.setValue(ld_pwr_limit) + self.cfg_pd_mon_form.cfg_dark_current_spinbox.setValue(pd_dark_current) + + self.cfg_pd_mon_form.show() + self.params[1].child('Photodiode Monitor Config', 'Configure Photodiode Monitor').sigActivated.connect(show_pd_mon_cfg_form) + + @pyqtSlot(str) + def cmd_cannot_execute(self, kirdy_msg): + self.info_box.setText(kirdy_msg) + self.info_box.setWindowTitle("Command fails to execute") + self.info_box.show() + @pyqtSlot(dict) def autotune_tick(self, report): match self.autotuner.state(): @@ -803,7 +916,8 @@ class MainWindow(QtWidgets.QMainWindow): self.params[1].child('Output Config', 'LD Current Set').setValuewithLock(settings["ld_drive_current"]['value']) self.params[1].child('Output Config', 'LD Terminals Short').setValuewithLock(settings["ld_terms_short"]) self.params[1].child('Output Config', 'Default Power On').setValuewithLock(settings["default_pwr_on"]) - self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').setValuewithLock(settings["ld_pwr_limit"]) + self.params[1].child('Photodiode Monitor Config', 'LD Power Limit').setValuewithLock(settings["ld_pwr_limit"]["value"]) + self.update_pd_mon_form_readings(settings) if settings["pd_mon_params"]["responsitivity"] is not None: self.params[1].child('Photodiode Monitor Config', 'Responsitivity').setValuewithLock(settings["pd_mon_params"]["responsitivity"]) else: diff --git a/pykirdy/ui/config_pd_mon_form.ui b/pykirdy/ui/config_pd_mon_form.ui new file mode 100644 index 0000000..415b47e --- /dev/null +++ b/pykirdy/ui/config_pd_mon_form.ui @@ -0,0 +1,488 @@ + + + Cfg_Pd_Mon_Form + + + + 0 + 0 + 500 + 520 + + + + + 500 + 520 + + + + + 500 + 520 + + + + config_pd_mon_form + + + + + 10 + 10 + 481 + 500 + + + + + + + + 22 + + + + Configure Photodiode Monitor + + + Qt::AlignmentFlag::AlignCenter + + + + + + + 12 + + + QLayout::SizeConstraint::SetDefaultConstraint + + + + + + 14 + + + + Step 1: Turn off Laser Power + + + + + + + Power Off + + + + + + + + + + + + 14 + + + + Step 2: Reset Ld Pwr Limit to 0 + + + + + + + Reset Ld Pwr Limit + + + + + + + + + + + + 14 + + + + Step 3: Configure Photodiode Parameters + + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + Value + + + + + + + Reading + + + + + + + + + + + + 0 + 0 + + + + + 12 + + + + Responsitivity: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + + + + 4 + + + 1000.000000000000000 + + + 0.001000000000000 + + + + + + + + 0 + 0 + + + + 0.0000 + + + + + + + + + + + Dark Current: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + 4 + + + 0.001000000000000 + + + + + + + 0.0000 + + + + + + + + + 12 + + + + + Qt::Orientation::Horizontal + + + + 10 + 20 + + + + + + + + Apply + + + + + + + + + + + + + + 14 + + + + Step 4: Configure Laser Diode Power Limit + + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + Value + + + + + + + Reading + + + + + + + + + + + + 12 + + + + Power Limit: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + 4 + + + 0.001000000000000 + + + + + + + 0.0000 + + + + + + + + + 12 + + + + + + 12 + + + + Settable Power Range: + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + + 0 + 28 + + + + ( Power Range ) + + + + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + Apply Max + + + + + + + Apply + + + + + + + + + + + 12 + + + + + + 14 + + + + Step 5: Turn On Laser Power + + + + + + + Clear Alarm and Power On + + + + + + + + + 12 + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + + + + + + close_btn + clicked() + Cfg_Pd_Mon_Form + accept() + + + 141 + 456 + + + 281 + 355 + + + + + diff --git a/pykirdy/ui/ui_config_pd_mon_form.py b/pykirdy/ui/ui_config_pd_mon_form.py new file mode 100644 index 0000000..a5ece43 --- /dev/null +++ b/pykirdy/ui/ui_config_pd_mon_form.py @@ -0,0 +1,295 @@ +# Form implementation generated from reading ui file 'config_pd_mon_form.ui' +# +# Created by: PyQt6 UI code generator 6.6.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_Cfg_Pd_Mon_Form(object): + def setupUi(self, Cfg_Pd_Mon_Form): + Cfg_Pd_Mon_Form.setObjectName("Cfg_Pd_Mon_Form") + Cfg_Pd_Mon_Form.resize(500, 520) + Cfg_Pd_Mon_Form.setMinimumSize(QtCore.QSize(500, 520)) + Cfg_Pd_Mon_Form.setMaximumSize(QtCore.QSize(500, 520)) + self.verticalLayoutWidget_2 = QtWidgets.QWidget(parent=Cfg_Pd_Mon_Form) + self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(10, 10, 481, 500)) + self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2") + self.cfg_pd_mon_form_layout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2) + self.cfg_pd_mon_form_layout.setContentsMargins(0, 0, 0, 0) + self.cfg_pd_mon_form_layout.setObjectName("cfg_pd_mon_form_layout") + self.title_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(22) + self.title_lbl.setFont(font) + self.title_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.title_lbl.setObjectName("title_lbl") + self.cfg_pd_mon_form_layout.addWidget(self.title_lbl) + self.pwr_off_layout = QtWidgets.QHBoxLayout() + self.pwr_off_layout.setSizeConstraint(QtWidgets.QLayout.SizeConstraint.SetDefaultConstraint) + self.pwr_off_layout.setSpacing(12) + self.pwr_off_layout.setObjectName("pwr_off_layout") + self.pwr_off_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(14) + self.pwr_off_lbl.setFont(font) + self.pwr_off_lbl.setObjectName("pwr_off_lbl") + self.pwr_off_layout.addWidget(self.pwr_off_lbl) + self.pwr_off_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget_2) + self.pwr_off_btn.setObjectName("pwr_off_btn") + self.pwr_off_layout.addWidget(self.pwr_off_btn) + self.pwr_off_layout.setStretch(0, 5) + self.pwr_off_layout.setStretch(1, 4) + self.cfg_pd_mon_form_layout.addLayout(self.pwr_off_layout) + self.rst_ld_pwr_limit_layout = QtWidgets.QHBoxLayout() + self.rst_ld_pwr_limit_layout.setObjectName("rst_ld_pwr_limit_layout") + self.rst_ld_pwr_limit_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(14) + self.rst_ld_pwr_limit_lbl.setFont(font) + self.rst_ld_pwr_limit_lbl.setObjectName("rst_ld_pwr_limit_lbl") + self.rst_ld_pwr_limit_layout.addWidget(self.rst_ld_pwr_limit_lbl) + self.rst_ld_pwr_limit_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget_2) + self.rst_ld_pwr_limit_btn.setObjectName("rst_ld_pwr_limit_btn") + self.rst_ld_pwr_limit_layout.addWidget(self.rst_ld_pwr_limit_btn) + self.rst_ld_pwr_limit_layout.setStretch(0, 5) + self.rst_ld_pwr_limit_layout.setStretch(1, 4) + self.cfg_pd_mon_form_layout.addLayout(self.rst_ld_pwr_limit_layout) + self.cfg_pd_params_layout = QtWidgets.QVBoxLayout() + self.cfg_pd_params_layout.setObjectName("cfg_pd_params_layout") + self.cfg_pd_params_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(14) + self.cfg_pd_params_lbl.setFont(font) + self.cfg_pd_params_lbl.setObjectName("cfg_pd_params_lbl") + self.cfg_pd_params_layout.addWidget(self.cfg_pd_params_lbl) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout.addItem(spacerItem) + self.label_2 = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.label_2.setObjectName("label_2") + self.horizontalLayout.addWidget(self.label_2) + self.label = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.label.setObjectName("label") + self.horizontalLayout.addWidget(self.label) + self.horizontalLayout.setStretch(0, 5) + self.horizontalLayout.setStretch(1, 2) + self.horizontalLayout.setStretch(2, 2) + self.cfg_pd_params_layout.addLayout(self.horizontalLayout) + self.cfg_responsitivity_layout = QtWidgets.QHBoxLayout() + self.cfg_responsitivity_layout.setObjectName("cfg_responsitivity_layout") + self.cfg_responsitivity_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cfg_responsitivity_lbl.sizePolicy().hasHeightForWidth()) + self.cfg_responsitivity_lbl.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setPointSize(12) + self.cfg_responsitivity_lbl.setFont(font) + self.cfg_responsitivity_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) + self.cfg_responsitivity_lbl.setObjectName("cfg_responsitivity_lbl") + self.cfg_responsitivity_layout.addWidget(self.cfg_responsitivity_lbl) + self.cfg_responsitivity_spinbox = QtWidgets.QDoubleSpinBox(parent=self.verticalLayoutWidget_2) + self.cfg_responsitivity_spinbox.setSuffix("") + self.cfg_responsitivity_spinbox.setDecimals(4) + self.cfg_responsitivity_spinbox.setMaximum(1000.0) + self.cfg_responsitivity_spinbox.setSingleStep(0.001) + self.cfg_responsitivity_spinbox.setObjectName("cfg_responsitivity_spinbox") + self.cfg_responsitivity_layout.addWidget(self.cfg_responsitivity_spinbox) + self.cfg_responsitivity_reading = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cfg_responsitivity_reading.sizePolicy().hasHeightForWidth()) + self.cfg_responsitivity_reading.setSizePolicy(sizePolicy) + self.cfg_responsitivity_reading.setObjectName("cfg_responsitivity_reading") + self.cfg_responsitivity_layout.addWidget(self.cfg_responsitivity_reading) + self.cfg_responsitivity_layout.setStretch(0, 5) + self.cfg_responsitivity_layout.setStretch(1, 2) + self.cfg_responsitivity_layout.setStretch(2, 2) + self.cfg_pd_params_layout.addLayout(self.cfg_responsitivity_layout) + self.cfg_dark_current_layout = QtWidgets.QHBoxLayout() + self.cfg_dark_current_layout.setObjectName("cfg_dark_current_layout") + self.cfg_dark_current_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.cfg_dark_current_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) + self.cfg_dark_current_lbl.setObjectName("cfg_dark_current_lbl") + self.cfg_dark_current_layout.addWidget(self.cfg_dark_current_lbl) + self.cfg_dark_current_spinbox = QtWidgets.QDoubleSpinBox(parent=self.verticalLayoutWidget_2) + self.cfg_dark_current_spinbox.setDecimals(4) + self.cfg_dark_current_spinbox.setSingleStep(0.001) + self.cfg_dark_current_spinbox.setObjectName("cfg_dark_current_spinbox") + self.cfg_dark_current_layout.addWidget(self.cfg_dark_current_spinbox) + self.cfg_dark_current_reading = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.cfg_dark_current_reading.setObjectName("cfg_dark_current_reading") + self.cfg_dark_current_layout.addWidget(self.cfg_dark_current_reading) + self.cfg_dark_current_layout.setStretch(0, 5) + self.cfg_dark_current_layout.setStretch(1, 2) + self.cfg_dark_current_layout.setStretch(2, 2) + self.cfg_pd_params_layout.addLayout(self.cfg_dark_current_layout) + self.apply_pd_params_layout = QtWidgets.QHBoxLayout() + self.apply_pd_params_layout.setSpacing(12) + self.apply_pd_params_layout.setObjectName("apply_pd_params_layout") + spacerItem1 = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.apply_pd_params_layout.addItem(spacerItem1) + self.apply_pd_params_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget_2) + self.apply_pd_params_btn.setObjectName("apply_pd_params_btn") + self.apply_pd_params_layout.addWidget(self.apply_pd_params_btn) + self.apply_pd_params_layout.setStretch(0, 5) + self.apply_pd_params_layout.setStretch(1, 4) + self.cfg_pd_params_layout.addLayout(self.apply_pd_params_layout) + self.cfg_pd_mon_form_layout.addLayout(self.cfg_pd_params_layout) + self.cfg_pwr_limit_layout = QtWidgets.QVBoxLayout() + self.cfg_pwr_limit_layout.setObjectName("cfg_pwr_limit_layout") + self.cfg_pd_pwr_limit_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(14) + self.cfg_pd_pwr_limit_lbl.setFont(font) + self.cfg_pd_pwr_limit_lbl.setObjectName("cfg_pd_pwr_limit_lbl") + self.cfg_pwr_limit_layout.addWidget(self.cfg_pd_pwr_limit_lbl) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.horizontalLayout_2.addItem(spacerItem2) + self.label_3 = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.label_3.setObjectName("label_3") + self.horizontalLayout_2.addWidget(self.label_3) + self.label_4 = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.label_4.setObjectName("label_4") + self.horizontalLayout_2.addWidget(self.label_4) + self.horizontalLayout_2.setStretch(0, 5) + self.horizontalLayout_2.setStretch(1, 2) + self.horizontalLayout_2.setStretch(2, 2) + self.cfg_pwr_limit_layout.addLayout(self.horizontalLayout_2) + self.pwr_limit_layout = QtWidgets.QHBoxLayout() + self.pwr_limit_layout.setObjectName("pwr_limit_layout") + self.cfg_pwr_limit_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(12) + self.cfg_pwr_limit_lbl.setFont(font) + self.cfg_pwr_limit_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) + self.cfg_pwr_limit_lbl.setObjectName("cfg_pwr_limit_lbl") + self.pwr_limit_layout.addWidget(self.cfg_pwr_limit_lbl) + self.cfg_pwr_limit_spinbox = QtWidgets.QDoubleSpinBox(parent=self.verticalLayoutWidget_2) + self.cfg_pwr_limit_spinbox.setDecimals(4) + self.cfg_pwr_limit_spinbox.setSingleStep(0.001) + self.cfg_pwr_limit_spinbox.setObjectName("cfg_pwr_limit_spinbox") + self.pwr_limit_layout.addWidget(self.cfg_pwr_limit_spinbox) + self.cfg_pwr_limit_reading = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.cfg_pwr_limit_reading.setObjectName("cfg_pwr_limit_reading") + self.pwr_limit_layout.addWidget(self.cfg_pwr_limit_reading) + self.pwr_limit_layout.setStretch(0, 5) + self.pwr_limit_layout.setStretch(1, 2) + self.pwr_limit_layout.setStretch(2, 2) + self.cfg_pwr_limit_layout.addLayout(self.pwr_limit_layout) + self.settable_pwr_range_layout = QtWidgets.QHBoxLayout() + self.settable_pwr_range_layout.setSpacing(12) + self.settable_pwr_range_layout.setObjectName("settable_pwr_range_layout") + self.settable_pwr_range_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(12) + self.settable_pwr_range_lbl.setFont(font) + self.settable_pwr_range_lbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter) + self.settable_pwr_range_lbl.setObjectName("settable_pwr_range_lbl") + self.settable_pwr_range_layout.addWidget(self.settable_pwr_range_lbl) + self.settable_pwr_range_display_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + self.settable_pwr_range_display_lbl.setMinimumSize(QtCore.QSize(0, 28)) + self.settable_pwr_range_display_lbl.setObjectName("settable_pwr_range_display_lbl") + self.settable_pwr_range_layout.addWidget(self.settable_pwr_range_display_lbl) + self.settable_pwr_range_layout.setStretch(0, 5) + self.settable_pwr_range_layout.setStretch(1, 4) + self.cfg_pwr_limit_layout.addLayout(self.settable_pwr_range_layout) + self.apply_pwr_limit_layout = QtWidgets.QHBoxLayout() + self.apply_pwr_limit_layout.setObjectName("apply_pwr_limit_layout") + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.apply_pwr_limit_layout.addItem(spacerItem3) + self.apply_pwr_limit_max_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget_2) + self.apply_pwr_limit_max_btn.setObjectName("apply_pwr_limit_max_btn") + self.apply_pwr_limit_layout.addWidget(self.apply_pwr_limit_max_btn) + self.apply_pwr_limit_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget_2) + self.apply_pwr_limit_btn.setObjectName("apply_pwr_limit_btn") + self.apply_pwr_limit_layout.addWidget(self.apply_pwr_limit_btn) + self.apply_pwr_limit_layout.setStretch(0, 2) + self.apply_pwr_limit_layout.setStretch(1, 3) + self.apply_pwr_limit_layout.setStretch(2, 4) + self.cfg_pwr_limit_layout.addLayout(self.apply_pwr_limit_layout) + self.cfg_pd_mon_form_layout.addLayout(self.cfg_pwr_limit_layout) + self.pwr_on_layout = QtWidgets.QHBoxLayout() + self.pwr_on_layout.setSpacing(12) + self.pwr_on_layout.setObjectName("pwr_on_layout") + self.pwr_on_lbl = QtWidgets.QLabel(parent=self.verticalLayoutWidget_2) + font = QtGui.QFont() + font.setPointSize(14) + self.pwr_on_lbl.setFont(font) + self.pwr_on_lbl.setObjectName("pwr_on_lbl") + self.pwr_on_layout.addWidget(self.pwr_on_lbl) + self.pwr_on_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget_2) + self.pwr_on_btn.setObjectName("pwr_on_btn") + self.pwr_on_layout.addWidget(self.pwr_on_btn) + self.pwr_on_layout.setStretch(0, 5) + self.pwr_on_layout.setStretch(1, 4) + self.cfg_pd_mon_form_layout.addLayout(self.pwr_on_layout) + self.close_btn_layout = QtWidgets.QHBoxLayout() + self.close_btn_layout.setSpacing(12) + self.close_btn_layout.setObjectName("close_btn_layout") + spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.close_btn_layout.addItem(spacerItem4) + self.close_btn = QtWidgets.QPushButton(parent=self.verticalLayoutWidget_2) + self.close_btn.setObjectName("close_btn") + self.close_btn_layout.addWidget(self.close_btn) + self.close_btn_layout.setStretch(0, 5) + self.close_btn_layout.setStretch(1, 4) + self.cfg_pd_mon_form_layout.addLayout(self.close_btn_layout) + self.cfg_pd_mon_form_layout.setStretch(1, 2) + self.cfg_pd_mon_form_layout.setStretch(2, 2) + self.cfg_pd_mon_form_layout.setStretch(3, 2) + self.cfg_pd_mon_form_layout.setStretch(4, 2) + self.cfg_pd_mon_form_layout.setStretch(5, 2) + self.cfg_pd_mon_form_layout.setStretch(6, 1) + + self.retranslateUi(Cfg_Pd_Mon_Form) + self.close_btn.clicked.connect(Cfg_Pd_Mon_Form.accept) # type: ignore + QtCore.QMetaObject.connectSlotsByName(Cfg_Pd_Mon_Form) + + def retranslateUi(self, Cfg_Pd_Mon_Form): + _translate = QtCore.QCoreApplication.translate + Cfg_Pd_Mon_Form.setWindowTitle(_translate("Cfg_Pd_Mon_Form", "config_pd_mon_form")) + self.title_lbl.setText(_translate("Cfg_Pd_Mon_Form", "Configure Photodiode Monitor")) + self.pwr_off_lbl.setText(_translate("Cfg_Pd_Mon_Form", " Step 1: Turn off Laser Power")) + self.pwr_off_btn.setText(_translate("Cfg_Pd_Mon_Form", "Power Off")) + self.rst_ld_pwr_limit_lbl.setText(_translate("Cfg_Pd_Mon_Form", " Step 2: Reset Ld Pwr Limit to 0")) + self.rst_ld_pwr_limit_btn.setText(_translate("Cfg_Pd_Mon_Form", "Reset Ld Pwr Limit")) + self.cfg_pd_params_lbl.setText(_translate("Cfg_Pd_Mon_Form", " Step 3: Configure Photodiode Parameters")) + self.label_2.setText(_translate("Cfg_Pd_Mon_Form", " Value")) + self.label.setText(_translate("Cfg_Pd_Mon_Form", "Reading")) + self.cfg_responsitivity_lbl.setText(_translate("Cfg_Pd_Mon_Form", "Responsitivity: ")) + self.cfg_responsitivity_reading.setText(_translate("Cfg_Pd_Mon_Form", "0.0000")) + self.cfg_dark_current_lbl.setText(_translate("Cfg_Pd_Mon_Form", "Dark Current: ")) + self.cfg_dark_current_reading.setText(_translate("Cfg_Pd_Mon_Form", "0.0000")) + self.apply_pd_params_btn.setText(_translate("Cfg_Pd_Mon_Form", "Apply")) + self.cfg_pd_pwr_limit_lbl.setText(_translate("Cfg_Pd_Mon_Form", " Step 4: Configure Laser Diode Power Limit")) + self.label_3.setText(_translate("Cfg_Pd_Mon_Form", " Value")) + self.label_4.setText(_translate("Cfg_Pd_Mon_Form", "Reading")) + self.cfg_pwr_limit_lbl.setText(_translate("Cfg_Pd_Mon_Form", "Power Limit:")) + self.cfg_pwr_limit_reading.setText(_translate("Cfg_Pd_Mon_Form", "0.0000")) + self.settable_pwr_range_lbl.setText(_translate("Cfg_Pd_Mon_Form", "Settable Power Range:")) + self.settable_pwr_range_display_lbl.setText(_translate("Cfg_Pd_Mon_Form", "( Power Range )")) + self.apply_pwr_limit_max_btn.setText(_translate("Cfg_Pd_Mon_Form", "Apply Max")) + self.apply_pwr_limit_btn.setText(_translate("Cfg_Pd_Mon_Form", "Apply")) + self.pwr_on_lbl.setText(_translate("Cfg_Pd_Mon_Form", " Step 5: Turn On Laser Power")) + self.pwr_on_btn.setText(_translate("Cfg_Pd_Mon_Form", "Clear Alarm and Power On")) + self.close_btn.setText(_translate("Cfg_Pd_Mon_Form", "Close")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + Cfg_Pd_Mon_Form = QtWidgets.QDialog() + ui = Ui_Cfg_Pd_Mon_Form() + ui.setupUi(Cfg_Pd_Mon_Form) + Cfg_Pd_Mon_Form.show() + sys.exit(app.exec())