Index: simulator/plugins/ultrafiltration/loader.py =================================================================== diff -u -rc13dc6ba2410716a3f1c446e564085aeb9114a60 -r316fd2f51b0fa89c0f69949d79ef246e1e4bc4ed --- simulator/plugins/ultrafiltration/loader.py (.../loader.py) (revision c13dc6ba2410716a3f1c446e564085aeb9114a60) +++ simulator/plugins/ultrafiltration/loader.py (.../loader.py) (revision 316fd2f51b0fa89c0f69949d79ef246e1e4bc4ed) @@ -1,14 +1,35 @@ """ +########################################################################### +# +# Copyright (c) 2020-2025 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) Behrouz NematiPour +# @date (last) 11-Feb-2021 +# @author (original) Behrouz NematiPour +# @date (original) 23-Nov-2020 +# +############################################################################ The Ultrafiltration ui loader """ -from runtimewidget import RunTimeWidget +# Python +import os +# Qt from PySide2 import QtWidgets from PySide2.QtCore import Slot -from dialin.squish import denaliMessages -from dialin.squish.denaliMessages import txStates, EResponse +# parent +from simulator.dynamicloader import DynamicLoader +# hd Simulator +from dialin.ui.hd_simulator import HDSimulator, TXStates +# plugin specific +# -- none -- -class Ultrafiltration(RunTimeWidget): +class Loader(DynamicLoader): """ The Ultrafiltration ui loader """ @@ -30,13 +51,11 @@ spnUfResumeRejectReason: QtWidgets.QSpinBox sldUfVolume: QtWidgets.QSlider - def __init__(self): - super().__init__("plugins/ultrafiltration/interface.ui") - self.initialize() - self.init_widgets() - self.init_connections() + def __init__(self, hd_simulator: HDSimulator): + super().__init__(os.path.dirname(__file__), hd_simulator) + print(" ---------- ", self.hd_simulator) - def initialize(self): + def _init_loader(self): """ finds and creates widgets :return: none @@ -55,14 +74,14 @@ self.spnUfEditRejectReason = self.find_spinbox('spnUfEditRejectReason') self.sldUfVolume = self.find_slider('sldUfVolume') - def init_widgets(self): + def _init_widgets(self): """ initializes the widgets' properties :return: none """ pass - def init_connections(self): + def _init_connections(self): """ initializes the widgets connections :return: none @@ -81,8 +100,9 @@ the slot for accept ultrafiltration pause button :return: none """ - denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( - EResponse.Accepted, 0, txStates.UF_PAUSED_STATE) + self.hd_simulator.cmd_set_treatment_adjust_ultrafiltration_state_response( + True, 0, TXStates.UF_PAUSED_STATE + ) self.lblUfPauseAction.setText('Accepted ') @Slot() @@ -92,8 +112,8 @@ :return: none """ reason = self.spnUfPauseRejectReason.value() - denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( - EResponse.Rejected, reason, txStates.UF_RUNNING_STATE) + self.hd_simulator.cmd_set_treatment_adjust_ultrafiltration_state_response( + False, reason, TXStates.UF_RUNNING_STATE) self.lblUfPauseAction.setText('Rejected ' + "{}".format(reason)) @Slot() @@ -102,8 +122,8 @@ the slot for accept ultrafiltration resume accept :return: none """ - denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( - EResponse.Accepted, 0, txStates.UF_RUNNING_STATE) + self.hd_simulator.cmd_set_treatment_adjust_ultrafiltration_state_response( + True, 0, TXStates.UF_RUNNING_STATE) self.lblUfResumeAction.setText('Accepted ') @Slot() @@ -113,8 +133,8 @@ :return: none """ reason = self.spnUfResumeRejectReason.value() - denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( - EResponse.Rejected, reason, txStates.UF_PAUSED_STATE) + self.hd_simulator.cmd_set_treatment_adjust_ultrafiltration_state_response( + False, reason, TXStates.UF_PAUSED_STATE) self.lblUfResumeAction.setText('Rejected ' + "{}".format(reason)) @Slot() @@ -123,8 +143,8 @@ the slot for accept ultrafiltration next button :return: none """ - denaliMessages.setTreatmentAdjustUltrafiltrationEditResponse( - EResponse.Accepted, 0, 2500, 60, 0, 10, 0, 10) + self.hd_simulator.cmd_set_treatment_adjust_ultrafiltration_edit_response( + True, 0, 2325, 60, 0, 10, 0, 10) self.lblUfEditAction.setText('Accepted ') @Slot() @@ -134,8 +154,8 @@ :return: none """ reason = self.spnUfEditRejectReason.value() - denaliMessages.setTreatmentAdjustUltrafiltrationEditResponse( - EResponse.Rejected, reason, 2500, 60, 0, 10, 0, 10) + self.hd_simulator.cmd_set_treatment_adjust_ultrafiltration_edit_response( + False, reason, 2500, 60, 0, 10, 0, 10) self.lblUfEditAction.setText('Rejected ' + "{}".format(reason)) @Slot() @@ -144,5 +164,6 @@ sends the ultrafiltration delivered volume message :return: none """ - denaliMessages.setTreatmentUltrafiltration(self.sldUfVolume.value(), 0, 0, 0, 0, 0, 0) - + self.hd_simulator.cmd_set_treatment_ultrafiltration_outlet_flow_data( + self.sldUfVolume.value(), 0, 0, 0, 0, 0, 0 + )