Index: simulator/plugins/GeneralProgressMessage/interface.ui =================================================================== diff -u --- simulator/plugins/GeneralProgressMessage/interface.ui (revision 0) +++ simulator/plugins/GeneralProgressMessage/interface.ui (revision 2204a65b0af94e7e555f0f4207fd2701c164d1d5) @@ -0,0 +1,282 @@ + + + ui_interface + + + + 0 + 0 + 468 + 153 + + + + &9 General/&1 Progress Message + + + + 6 + + + 6 + + + 6 + + + 6 + + + + + + + + 10 + + + + Qt::Horizontal + + + + + + + + + + 30 + 0 + + + + + 10 + + + + 0 + + + Qt::AlignCenter + + + + + + + + 10 + + + + 0 + + + 300 + + + 300 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + Countdown + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + sldCountdown + + + + + + + + 0 + 0 + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(46, 52, 54); + + + Progress data + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + Timeout + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 10 + + + + 0 + + + 300 + + + 300 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 50 + 16777215 + + + + + 10 + + + + D000 + + + 300 + + + Qt::AlignCenter + + + + + + + MsgID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + D000 + + + 96 + + + + + + + Decimal + + + + + + + + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(46, 52, 54); + + + General Progress Message + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + sldCountdown + valueChanged(int) + lblCountdown + setNum(int) + + + 485 + 106 + + + 541 + 99 + + + + + Index: simulator/plugins/GeneralProgressMessage/loader.py =================================================================== diff -u --- simulator/plugins/GeneralProgressMessage/loader.py (revision 0) +++ simulator/plugins/GeneralProgressMessage/loader.py (revision 2204a65b0af94e7e555f0f4207fd2701c164d1d5) @@ -0,0 +1,75 @@ +""" +The Disposable Prime 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 + """ + leMessageID: QtWidgets.QLineEdit + leTargetMax: QtWidgets.QLineEdit + sldTimeout: QtWidgets.QSlider + sldTimeout: QtWidgets.QSlider + sldCountdown: 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.leMessageID = self.find_line_edit('leMessageID') + self.leTargetMax = self.find_line_edit('leTargetMax') + self.sldTimeout = self.find_slider('sldTimeout') + self.sldCountdown = self.find_slider('sldCountdown') + + def _init_widgets(self): + """ + initializes the widgets' properties + :return: none + """ + pass + + def _init_connections(self): + """ + initializes the widgets connections + :return: + """ + self.leTargetMax.textChanged.connect(self.do_set_target_maximum) + self.sldTimeout.valueChanged.connect(self.do_data) + self.sldCountdown.valueChanged.connect(self.do_data) + + @Slot() + def do_set_target_maximum(self, value): + """ + sets the target slider maximum to the value of value + :return: none + """ + self.sldTimeout.setMaximum(int(value)) + + @Slot() + def do_data(self): + """ + the slot which is called to send the data + by calling the denaliMessage API cmd_send_treatment_blood_prime_data + :return: none + """ + message_id = self.leMessageID.text() + timeout = self.sldTimeout.value() + countdown = self.sldCountdown.value() + self.hd_simulator.cmd_send_general_progress_data(int(message_id), timeout, countdown) Index: simulator/plugins/GeneralResponseMessage/interface.ui =================================================================== diff -u --- simulator/plugins/GeneralResponseMessage/interface.ui (revision 0) +++ simulator/plugins/GeneralResponseMessage/interface.ui (revision 2204a65b0af94e7e555f0f4207fd2701c164d1d5) @@ -0,0 +1,193 @@ + + + ui_interface + + + + 0 + 0 + 299 + 149 + + + + &9 General/&2 Response Message + + + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(46, 52, 54); + + + General Response Message + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + reason + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 10 + + + + QFrame::StyledPanel + + + QFrame::Plain + + + + + + + + + + + 10 + + + + Accept + + + + + + + + 10 + + + + Reject + + + + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(46, 52, 54); + + + Response Message + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 10 + + + + + + + + MsgID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Decimal + + + + + + + D000 + + + 94 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + btnAccept + btnReject + spnReason + + + + Index: simulator/plugins/GeneralResponseMessage/loader.py =================================================================== diff -u --- simulator/plugins/GeneralResponseMessage/loader.py (revision 0) +++ simulator/plugins/GeneralResponseMessage/loader.py (revision 2204a65b0af94e7e555f0f4207fd2701c164d1d5) @@ -0,0 +1,79 @@ +""" +The ui loader class +""" +# Python +import os +# Qt +from email import message + +from PySide2 import QtWidgets +from PySide2.QtCore import Slot +# parent +from simulator.dynamicloader import DynamicLoader +# hd Simulator +from dialin.ui.hd_simulator import HDSimulator +from dialin.ui.hd_simulator import RequestRejectReasons +# plugin specific +# -- None -- + + +class Loader(DynamicLoader): + """ + The ui loader class + """ + + leMessageID: QtWidgets.QLineEdit + btnAccept: QtWidgets.QPushButton + btnReject: QtWidgets.QPushButton + lblAction: QtWidgets.QLabel + spnReason: QtWidgets.QSpinBox + + 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.leMessageID = self.find_line_edit('leMessageID') + self.btnAccept = self.find_button('btnAccept') + self.btnReject = self.find_button('btnReject') + self.lblAction = self.find_label('lblAction') + self.spnReason = self.find_spinbox('spnReason') + + 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 + """ + message_id = self.leMessageID.text() + self.hd_simulator.cmd_send_general_response(int(message_id), True, 0) + self.lblAction.setText('Accepted ') + + @Slot() + def do_reject(self): + """ + the slot for reject button + :return: none + """ + message_id = self.leMessageID.text() + reason = self.spnReason.value() + self.hd_simulator.cmd_send_general_response(int(message_id), False, reason) + self.lblAction.setText('Rejected ' + "{}".format(reason)) Index: simulator/plugins/treatmentstates/interface.ui =================================================================== diff -u -r6f84fdb12153d7d74fee34bcca613fac1af72464 -r2204a65b0af94e7e555f0f4207fd2701c164d1d5 --- simulator/plugins/treatmentstates/interface.ui (.../interface.ui) (revision 6f84fdb12153d7d74fee34bcca613fac1af72464) +++ simulator/plugins/treatmentstates/interface.ui (.../interface.ui) (revision 2204a65b0af94e7e555f0f4207fd2701c164d1d5) @@ -14,7 +14,7 @@ &1 States/&3 Treatment States - + @@ -33,14 +33,34 @@ - + reset - + + + + Qt::Vertical + + + + 20 + 3 + + + + + + + + send + + + + @@ -874,19 +894,6 @@ - - - - Qt::Vertical - - - - 20 - 3 - - - - Index: simulator/plugins/treatmentstates/loader.py =================================================================== diff -u -r68ba5188e33d6f05936fb77626822f416b9abb37 -r2204a65b0af94e7e555f0f4207fd2701c164d1d5 --- simulator/plugins/treatmentstates/loader.py (.../loader.py) (revision 68ba5188e33d6f05936fb77626822f416b9abb37) +++ simulator/plugins/treatmentstates/loader.py (.../loader.py) (revision 2204a65b0af94e7e555f0f4207fd2701c164d1d5) @@ -18,6 +18,7 @@ """ The Ultrafiltration ui loader """ + tbSend: QtWidgets.QToolButton tbReset: QtWidgets.QToolButton tblSubMode: QtWidgets.QTableWidget @@ -38,6 +39,7 @@ finds and creates widgets :return: none """ + self.tbSend = self.find_tool_button('tbSend') self.tbReset = self.find_tool_button('tbReset') self.tblSubMode = self.find_table_widget('tblSubMode') @@ -56,6 +58,7 @@ :return: none """ self.tbReset.clicked.connect(self._init_widgets) + self.tbSend.clicked.connect(self.do_treatment_states) self.tblSubMode.currentCellChanged.connect(self.do_treatment_states) self.tblUFStates.currentCellChanged.connect(self.do_treatment_states) @@ -76,7 +79,7 @@ :return: none """ self.tblSubMode.setCurrentCell(TXStates.TREATMENT_START_STATE, 0) - self.tblUFStates.setCurrentCell(TXStates.UF_OFF_STATE, 0) + self.tblUFStates.setCurrentCell(TXStates.UF_RUNNING_STATE, 0) self.tblSalineStates.setCurrentCell(TXStates.SALINE_BOLUS_STATE_IDLE, 0) self.tblHeparinStates.setCurrentCell(TXStates.HEPARIN_STATE_OFF, 0) self.tblRinsebackStates.setCurrentCell(TXStates.RINSEBACK_STOP_INIT_STATE, 0) Index: simulator/simulator/dynamicloader.py =================================================================== diff -u -r1779b6711f3791e8bf570e06ddb4c2e7d2a52e18 -r2204a65b0af94e7e555f0f4207fd2701c164d1d5 --- simulator/simulator/dynamicloader.py (.../dynamicloader.py) (revision 1779b6711f3791e8bf570e06ddb4c2e7d2a52e18) +++ simulator/simulator/dynamicloader.py (.../dynamicloader.py) (revision 2204a65b0af94e7e555f0f4207fd2701c164d1d5) @@ -106,6 +106,15 @@ child = self.find_widget(QtWidgets.QLabel, name) return child + def find_line_edit(self, name: str) -> QtWidgets.QLineEdit: + """ + convenient method of find_widget for QLineEdit + :param name: (str) name of the QLabel Object + :return: (QLabel) reference to the QLineEdit + """ + child = self.find_widget(QtWidgets.QLineEdit, name) + return child + def find_button(self, name: str) -> QtWidgets.QPushButton: """ convenient method of find_widget for QPushButton