""" The Heparin ui loader class """ # Python import os # Qt from PySide2 import QtWidgets from PySide2.QtCore import Slot # parent from simulator.dynamicloader import DynamicLoader # hd Simulator from dialin.ui.hd_simulator import HDSimulator # plugin specific # -- none -- class Loader(DynamicLoader): """ The Saline Bolus ui loader class """ btnAcceptDisinfect: QtWidgets.QPushButton btnRejectDisinfect: QtWidgets.QPushButton spnReasonDisinfect: QtWidgets.QSpinBox lblActionDisinfect: QtWidgets.QLabel btnAcceptChemical: QtWidgets.QPushButton btnRejectChemical: QtWidgets.QPushButton spnReasonChemical: QtWidgets.QSpinBox lblActionChemical: QtWidgets.QLabel sldTimeoutTotalFlush: QtWidgets.QSlider sldTimeoutCountDownFlush: QtWidgets.QSlider sldTimeoutTotalHeat: QtWidgets.QSlider sldTimeoutCountDownHeat: QtWidgets.QSlider sldTimeoutTotalChemical: QtWidgets.QSlider sldTimeoutCountDownChemical: QtWidgets.QSlider def __init__(self, hd_simulator: HDSimulator): super().__init__(os.path.dirname(__file__), hd_simulator) def _init_loader(self): """ finds and creates widgets :return: none """ self.btnAcceptDisinfect = self.find_button('btnAcceptDisinfect') self.btnRejectDisinfect = self.find_button('btnRejectDisinfect') self.spnReasonDisinfect = self.find_spinbox('spnReasonDisinfect') self.lblActionDisinfect = self.find_label('lblActionDisinfect') self.btnAcceptChemical = self.find_button('btnAcceptChemical') self.btnRejectChemical = self.find_button('btnRejectChemical') self.spnReasonChemical = self.find_spinbox('spnReasonChemical') self.lblActionChemical = self.find_label('lblActionChemical') self.sldTimeoutTotalFlush = self.find_slider('sldTimeoutTotalFlush') self.sldTimeoutCountDownFlush = self.find_slider('sldTimeoutCountDownFlush') self.sldTimeoutTotalHeat = self.find_slider('sldTimeoutTotalHeat') self.sldTimeoutCountDownHeat = self.find_slider('sldTimeoutCountDownHeat') self.sldTimeoutTotalChemical = self.find_slider('sldTimeoutTotalChemical') self.sldTimeoutCountDownChemical = self.find_slider('sldTimeoutCountDownChemical') def _init_widgets(self): """ initializes the widgets' properties :return: none """ pass def _init_connections(self): """ initializes the widgets connections :return: """ self.btnAcceptDisinfect.clicked.connect(self.do_accept_disinfect) self.btnRejectDisinfect.clicked.connect(self.do_reject_disinfect) self.btnAcceptChemical.clicked.connect(self.do_accept_chemical) self.btnRejectChemical.clicked.connect(self.do_reject_chemical) self.sldTimeoutTotalFlush.valueChanged.connect(self.do_data_flush) self.sldTimeoutCountDownFlush.valueChanged.connect(self.do_data_flush) self.sldTimeoutTotalHeat.valueChanged.connect(self.do_data_heat) self.sldTimeoutCountDownHeat.valueChanged.connect(self.do_data_heat) self.sldTimeoutTotalChemical.valueChanged.connect(self.do_data_chemical) self.sldTimeoutCountDownChemical.valueChanged.connect(self.do_data_chemical) @Slot() def do_accept_disinfect(self): """ the slot for accept button :return: none """ self.hd_simulator.cmd_send_hd_disinfect_response(True, 0) self.lblActionDisinfect.setText('Accepted ') @Slot() def do_reject_disinfect(self): """ the slot for reject button :return: none """ reason = self.spnReasonDisinfect.value() self.hd_simulator.cmd_send_hd_disinfect_response(False, reason) self.lblActionDisinfect.setText('Rejected ' + "{}".format(reason)) @Slot() def do_accept_chemical(self): """ the slot for accept button :return: none """ self.hd_simulator.cmd_send_hd_disinfect_chemical_confirm(True, 0) self.lblAction.setText('Accepted ') @Slot() def do_reject_chemical(self): """ the slot for reject button :return: none """ reason = self.spnReasonDisinfect.value() self.hd_simulator.cmd_send_hd_disinfect_chemical_confirm(False, reason) self.lblActionDisinfect.setText('Rejected ' + "{}".format(reason)) @Slot() def do_data_flush(self): """ the slot which is called to send the data by calling the denaliMessage API cmd_send_treatment_recirculate_data :return: none """ timeout_total = self.sldTimeoutTotalFlush.value() timeout_countdown = self.sldTimeoutCountDownFlush.value() self.hd_simulator.cmd_send_dg_disinfect_progress_time_flush(timeout_total, timeout_countdown) @Slot() def do_data_heat(self): """ the slot which is called to send the data by calling the denaliMessage API cmd_send_treatment_recirculate_data :return: none """ timeout_total = self.sldTimeoutTotalHeat.value() timeout_countdown = self.sldTimeoutCountDownHeat.value() self.hd_simulator.cmd_send_dg_disinfect_progress_time_heat(timeout_total, timeout_countdown) @Slot() def do_data_chemical(self): """ the slot which is called to send the data by calling the denaliMessage API cmd_send_treatment_recirculate_data :return: none """ timeout_total = self.sldTimeoutTotalChemical.value() timeout_countdown = self.sldTimeoutCountDownChemical.value() self.hd_simulator.cmd_send_dg_disinfect_progress_time_checmical(timeout_total, timeout_countdown)