""" ########################################################################### # # Copyright (c) 2020-2022 Diality Inc. - All Rights Reserved. # # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # @file loader.py # # @author (last) Peter Lucia # @date (last) 22-Jan-2021 # @author (original) Behrouz NematiPour # @date (original) 04-Dec-2020 # ############################################################################ The Heparin ui loader class """ import os from simulator.dynamicloader import DynamicLoader from PySide2 import QtWidgets from PySide2.QtCore import Slot class Loader(DynamicLoader): """ The Saline Bolus ui loader class """ btnAccept: QtWidgets.QPushButton btnReject: QtWidgets.QPushButton lblAction: QtWidgets.QLabel spnRejectReason: QtWidgets.QSpinBox def __init__(self): super().__init__(os.path.dirname(__file__)) def _init_loader(self): """ finds and creates widgets :return: none """ # saline adjustment self.btnAccept = self.find_button('btnAccept') self.btnReject = self.find_button('btnReject') self.lblAction = self.find_label('lblAction') self.spnRejectReason = self.find_spinbox('spnRejectReason') def _init_widgets(self): """ initializes the widgets' properties :return: none """ pass def _init_connections(self): """ initializes the widgets connections :return: """ self.btnAccept.clicked.connect(self.do_accept) self.btnReject.clicked.connect(self.do_reject) @Slot() def do_accept(self): """ the slot for accept button :return: none """ self.hd_simulator.cmd_send_start_treatment_response(1, 0) self.lblAction.setText('Accepted ') @Slot() def do_reject(self): """ the slot for accept saline bolus button :return: none """ reason = self.spnRejectReason.value() self.hd_simulator.cmd_set_heparin_pause_resume_response(False, reason, self.requested_state) self.lblAction.setText('Rejected ' + "{}".format(reason)) @Slot() def do_data(self, value): """ the slot which is called to send the data by calling the denaliMessage API setTreatmentHeparinData :return: none """ volume = value * 0.1 self.hd_simulator.cmd_set_treatment_heparin_data(volume) self.lblCumulative.setNum(volume)