Fisheye: Tag 63183a23c930b861a2f59b8dc62ea520d597ee96 refers to a dead (removed) revision in file `simulator/SalineBolusSimulator.ui'. Fisheye: No comparison available. Pass `N' to diff? Index: simulator/Simulator.ui =================================================================== diff -u -rdb6844f9c8bf44c39b1e6eb6f3a55a84aacebd4e -r63183a23c930b861a2f59b8dc62ea520d597ee96 --- simulator/Simulator.ui (.../Simulator.ui) (revision db6844f9c8bf44c39b1e6eb6f3a55a84aacebd4e) +++ simulator/Simulator.ui (.../Simulator.ui) (revision 63183a23c930b861a2f59b8dc62ea520d597ee96) @@ -7,531 +7,866 @@ 0 0 919 - 745 + 869 Form - + - - - - - - - - 0 - 0 - + + + + + Saline Bolus Adjustment + + + Qt::AlignCenter + + + + + + + Accept + + + + + + + + 0 + 0 + + + + + + + + + 50 + 0 + + + + reason + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Reject + + + + + + + + 50 + 0 + + + + mL + + + + + + + + 0 + 0 + + + + + 100 + + + + + 200 + + + + + 300 + + + + + + + + + + + + + + + + + Qt::Vertical + + + + + + + + + + 0 + 0 + + + + + + + + UF Pause + + + Qt::AlignCenter + + + + + + + + 50 + 0 + + + + reason + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Pause + + + + + + + Reject + + + + + + + + + + + + + + + + Qt::Vertical + + + + + + + + + Resume + + + + + + + Reject + + + + + + + UF Resume + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + 50 + 0 + + + + reason + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + + + + + + + 75 + 0 + + + + Target + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + 0 + + + + + + + Saline Bolus Data + + + Qt::AlignCenter + + + + + + + Max + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 300 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 300 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 1000 + + + Qt::Horizontal + + + + + + + 300 + + + Qt::Horizontal + + + + + + + + 75 + 0 + + + + Cumulative + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + Volume + + + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + + + + + + + + 50 + 0 + + + + 1000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 300 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 0 + + + + + + + 0 + + + + + + + + + + + + 50 + 0 + + + + reason + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + UF Edit Volume + + + Qt::AlignCenter + + + + + + + Reject + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + Next + + + + + + + + + + + UF delivered Volume + + + Qt::AlignCenter + + + + + + + 8000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 8000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + Qt::Horizontal + + + + + + + + + + + Dialysate + + Qt::AlignCenter + + + + + Range + + + - + 50 0 - mL + mL/min - - + + - + 600 - - - - Ultrafiltration Adjustment - - - Qt::AlignCenter - - - - + 50 0 - reason + mL/min - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - Accept - - - - - - - Reject - - - - + 0 0 - - 8000 + + 100 - - - - - - - - Qt::Horizontal - - - - - - - - 8000 + 600 - - Qt::Horizontal + + 50 - - - - - 50 - 0 - + + + + + 0 + 0 + - - 8000 + + 100 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Max - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 8000 + 600 - - Qt::Horizontal + + 50 - - - - - 75 - 0 - - + + - Target + Min - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - + + - 0 + Max - - + + - 0 + 100 - - + + + + + + - Ultrafiltration Data + Duration Qt::AlignCenter - - + + - Volume + Range - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - + + - 8000 + 480 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Qt::Vertical - - - - - - - - - - - - 0 - 0 - - - - - + 50 0 - mL + min - + 0 0 - - - 100 - - - - - 200 - - - - - 300 - - - - - - - - + + 480 - - - - Saline Bolus Adjustment - - - Qt::AlignCenter - - - - + 50 0 - reason + min - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 0 + 0 + + + 480 + - + - Accept + Min - + - Reject + Max - - - - - - Qt::Horizontal - - - - - - - - - - 50 - 0 - - + + - 1000 + 0 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + + + + - 300 + UF Volume - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignCenter - - - - 1000 + + + + Range - - Qt::Horizontal - - - + + - 75 + 50 0 - Target + mL - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - 0 + + + + 0 + 0 + - - - - - 300 + 8000 - - Qt::Horizontal - - - - - 300 - - - Qt::Horizontal - - - - - + + - Volume + Min - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - + + - Saline Bolus Data + 8000 - - Qt::AlignCenter - - - - - Max - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - + + - 75 + 50 0 - Cumulative + mL - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - - 50 - 0 - + + + + + 0 + 0 + - - 300 + + 8000 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + - 0 + Max - - + + 0 - - - - Qt::Vertical + + + + Treatment Ranges - - - 20 - 40 - + + Qt::AlignCenter - + - + Qt::Horizontal - + @@ -553,8 +888,17 @@ 400 + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + - true + false 300 @@ -684,6 +1028,15 @@ 225 + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + 180 @@ -752,6 +1105,15 @@ 0 + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + 350 @@ -809,6 +1171,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -820,11 +1195,11 @@ setNum(int) - 851 + 891 192 - 851 + 858 170 @@ -836,12 +1211,12 @@ setNum(int) - 851 - 284 + 891 + 240 - 851 - 262 + 891 + 218 @@ -852,46 +1227,14 @@ setNum(int) - 851 - 238 + 392 + 276 - 851 - 216 + 396 + 261 - - sldUFTarget - valueChanged(int) - lblUFTarget - setNum(int) - - - 176 - 188 - - - 172 - 167 - - - - - sldUFVolume - valueChanged(int) - lblUFVolume - setNum(int) - - - 263 - 235 - - - 263 - 212 - - - Index: simulator/run.py =================================================================== diff -u -r393fd43e9a1cbf6b25a0f107928a051a622b2be2 -r63183a23c930b861a2f59b8dc62ea520d597ee96 --- simulator/run.py (.../run.py) (revision 393fd43e9a1cbf6b25a0f107928a051a622b2be2) +++ simulator/run.py (.../run.py) (revision 63183a23c930b861a2f59b8dc62ea520d597ee96) @@ -5,12 +5,13 @@ # import project classes # import names from dialin.squish import utils, denaliMessages - +from dialin.squish.denaliMessages import txStates, EResponse # Import PySide2 classes from PySide2.QtUiTools import QUiLoader from PySide2 import QtCore, QtWidgets from PySide2.QtCore import QFile, Slot from PySide2.QtGui import qApp +from PySide2.QtCore import QTimer class RunTimeWidget: @@ -55,7 +56,7 @@ :return: (QtWidgets.QWidget) reference to the child """ child: QtWidgets.QWidget = self.window.findChild(child_type, child_name) - assert child != 0, "child name '{}' with type '{}' can't be found.".format(child_name, child_type) + assert child is not None, "child name '{}' with type '{}' can't be found.".format(child_name, child_type) return child def find_label(self, name: str) -> QtWidgets.QLabel: @@ -119,21 +120,41 @@ and can be eventually shown. """ # global variables declarations - ui_file_name = "SalineBolusSimulator.ui" + ui_file_name = "Simulator.ui" + timer: QTimer # pushbutton btnSalineAccept: QtWidgets.QPushButton btnSalineReject: QtWidgets.QPushButton + btnUfPauseAccept: QtWidgets.QPushButton + btnUfPauseReject: QtWidgets.QPushButton + btnUfResumeAccept: QtWidgets.QPushButton + btnUfResumeReject: QtWidgets.QPushButton + btnUfEditAccept: QtWidgets.QPushButton + btnUfEditReject: QtWidgets.QPushButton # label lblSalineAction: QtWidgets.QLabel + lblUfPauseAction: QtWidgets.QLabel + lblUfResumeAction: QtWidgets.QLabel + lblUfEditAction: QtWidgets.QLabel # spinbox spnSalineRejectReason: QtWidgets.QSpinBox + spnUfPauseRejectReason: QtWidgets.QSpinBox + spnUfResumeRejectReason: QtWidgets.QSpinBox + spnUfEditRejectReason: QtWidgets.QSpinBox + spnDurationMin: QtWidgets.QSpinBox + spnDurationMax: QtWidgets.QSpinBox + spnUFVolumeMin: QtWidgets.QSpinBox + spnUFVolumeMax: QtWidgets.QSpinBox + spnDialysateMin: QtWidgets.QSpinBox + spnDialysateMax: QtWidgets.QSpinBox # combobox cmbSalineAcceptTarget: QtWidgets.QComboBox # sliders sldSalineTarget: QtWidgets.QSlider sldSalineCumulative: QtWidgets.QSlider sldSalineVolume: QtWidgets.QSlider + sldUfVolume: QtWidgets.QSlider # tables tblSalineSubMode: QtWidgets.QTableWidget tblSalineUFStates: QtWidgets.QTableWidget @@ -143,6 +164,47 @@ super().__init__(Simulator.ui_file_name) self.initialize() + def setup_ranges(self): + """ + sets up the treatment ranges timer and 1 sec interval + :return: none + """ + self.spnDurationMin = self.find_spinbox('spnDurationMin') + self.spnDurationMax = self.find_spinbox('spnDurationMax') + self.spnUFVolumeMin = self.find_spinbox('spnUFVolumeMin') + self.spnUFVolumeMax = self.find_spinbox('spnUFVolumeMax') + self.spnDialysateMin = self.find_spinbox('spnDialysateMin') + self.spnDialysateMax = self.find_spinbox('spnDialysateMax') + self.timer = QTimer() + self.timer.start(1000) + self.timer.timeout.connect(self.do_ranges_data) + + def setup_uf_adjustment(self): + """ + sets up the treatment Ultrafiltration adjustment GUI section + :return: none + """ + self.btnUfPauseAccept = self.find_button('btnUfPauseAccept') + self.btnUfPauseReject = self.find_button('btnUfPauseReject') + self.btnUfResumeAccept = self.find_button('btnUfResumeAccept') + self.btnUfResumeReject = self.find_button('btnUfResumeReject') + self.btnUfEditAccept = self.find_button('btnUfEditAccept') + self.btnUfEditReject = self.find_button('btnUfEditReject') + self.lblUfPauseAction = self.find_label('lblUfPauseAction') + self.lblUfResumeAction = self.find_label('lblUfResumeAction') + self.lblUfEditAction = self.find_label('lblUfEditAction') + self.spnUfPauseRejectReason = self.find_spinbox('spnUfPauseRejectReason') + self.spnUfResumeRejectReason = self.find_spinbox('spnUfResumeRejectReason') + self.spnUfEditRejectReason = self.find_spinbox('spnUfEditRejectReason') + self.sldUfVolume = self.find_slider('sldUfVolume') + self.btnUfPauseAccept.clicked.connect(self.do_uf_pause_accept) + self.btnUfPauseReject.clicked.connect(self.do_uf_pause_reject) + self.btnUfResumeAccept.clicked.connect(self.do_uf_resume_accept) + self.btnUfResumeReject.clicked.connect(self.do_uf_resume_reject) + self.btnUfEditAccept.clicked.connect(self.do_uf_edit_accept) + self.btnUfEditReject.clicked.connect(self.do_uf_edit_reject) + self.sldUfVolume.valueChanged.connect(self.do_uf_volume_data) + def setup_saline_adjustment(self): """ sets up the treatment saline bolus adjustment GUI section @@ -153,8 +215,8 @@ self.lblSalineAction = self.find_label('lblSalineAction') self.spnSalineRejectReason = self.find_spinbox('spnSalineRejectReason') self.cmbSalineAcceptTarget = self.find_combobox('cmbSalineAcceptTarget') - self.btnSalineAccept.clicked.connect(self.do_accept) - self.btnSalineReject.clicked.connect(self.do_reject) + self.btnSalineAccept.clicked.connect(self.do_sb_accept) + self.btnSalineReject.clicked.connect(self.do_sb_reject) def setup_saline_data(self): """ @@ -184,26 +246,91 @@ self.tblSalineSalineStates.cellClicked.connect(self.do_saline_saline_state) @Slot() - def do_accept(self): + def do_sb_accept(self): """ the slot for accept saline bolus button :return: none """ target = self.cmbSalineAcceptTarget.currentText() - denaliMessages.setSalineBolusResponse(True, 0, target) + denaliMessages.setSalineBolusResponse(True, 0, target, txStates.SALINE_BOLUS_STATE_IN_PROGRESS) self.lblSalineAction.setText('Accepted ' + target) @Slot() - def do_reject(self): + def do_sb_reject(self): """ the slot for accept saline bolus button :return: none """ reason = self.spnSalineRejectReason.value() - denaliMessages.setSalineBolusResponse(False, reason, 0) + denaliMessages.setSalineBolusResponse(False, reason, 0, txStates.SALINE_BOLUS_STATE_IN_PROGRESS) self.lblSalineAction.setText('Rejected ' + "{}".format(reason)) @Slot() + def do_uf_pause_accept(self): + """ + the slot for accept ultrafiltration pause button + :return: none + """ + denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( + EResponse.Accepted, 0, txStates.UF_PAUSED_STATE) + self.lblUfPauseAction.setText('Accepted ') + + @Slot() + def do_uf_pause_reject(self): + """ + the slot for reject ultrafiltration pause button + :return: none + """ + reason = self.spnUfPauseRejectReason.value() + denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( + EResponse.Rejected, reason, txStates.UF_RUNNING_STATE) + self.lblUfPauseAction.setText('Rejected ' + "{}".format(reason)) + + @Slot() + def do_uf_resume_accept(self): + """ + the slot for accept ultrafiltration resume accept + :return: none + """ + denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( + EResponse.Accepted, 0, txStates.UF_RUNNING_STATE) + self.lblUfResumeAction.setText('Accepted ') + + @Slot() + def do_uf_resume_reject(self): + """ + the slot for reject ultrafiltration resume button + :return: none + """ + reason = self.spnUfResumeRejectReason.value() + denaliMessages.setTreatmentAdjustUltrafiltrationStateResponse( + EResponse.Rejected, reason, txStates.UF_PAUSED_STATE) + self.lblUfResumeAction.setText('Rejected ' + "{}".format(reason)) + + @Slot() + def do_uf_edit_accept(self): + """ + the slot for accept ultrafiltration next button + :return: none + """ + denaliMessages.setTreatmentAdjustUltrafiltrationEditResponse( + EResponse.Accepted, 0, 2500, 60, 0, 10, 0, 10) + self.lblUfAction.setText('Accepted ') + print("do_uf_edit_accept") + + @Slot() + def do_uf_edit_reject(self): + """ + the slot for reject ultrafiltration next button + :return: none + """ + reason = self.spnUfEditRejectReason.value() + denaliMessages.setTreatmentAdjustUltrafiltrationEditResponse( + EResponse.Rejected, reason, 2500, 60, 0, 10, 0, 10) + self.lblUfEditAction.setText('Rejected ' + "{}".format(reason)) + print("do_uf_edit_reject") + + @Slot() def do_saline_saline_state(self): """ the slot for saline bolus state change @@ -225,13 +352,38 @@ self.sldSalineCumulative.value(), self.sldSalineVolume.value()) + @Slot() + def do_uf_volume_data(self): + """ + sends the ultrafiltration delivered volume message + :return: none + """ + denaliMessages.setTreatmentUltrafiltration(self.sldUfVolume.value(), 0, 0, 0, 0, 0, 0) + + @Slot() + def do_ranges_data(self): + """ + sends the treatment ranges message with given value on the screen + :return: none + """ + denaliMessages.setTreatmentParamRanges( + self.spnDurationMin.value(), + self.spnDurationMax.value(), + self.spnUFVolumeMin.value(), + self.spnUFVolumeMax.value(), + self.spnDialysateMin.value(), + self.spnDialysateMax.value() + ) + def initialize(self): """ initializes the class by calling it's initializer methods to make objects ready :return: none """ + self.setup_ranges() self.setup_saline_adjustment() self.setup_saline_data() + self.setup_uf_adjustment() self.setup_treatment_states()