Index: MainTreatmentData/interface.ui =================================================================== diff -u -r5e32491166e1ccf47a90c9d2db5d0b37ecf249bb -rbae5b1087788172ce26168cd6b167d490f8993f4 --- MainTreatmentData/interface.ui (.../interface.ui) (revision 5e32491166e1ccf47a90c9d2db5d0b37ecf249bb) +++ MainTreatmentData/interface.ui (.../interface.ui) (revision bae5b1087788172ce26168cd6b167d490f8993f4) @@ -17,7 +17,7 @@ - &2 Treatment/&1 Main treatment + &3 Treatment/&1 Main treatment Index: TD_BloodPump/interface.ui =================================================================== diff -u -ra4f4b16cfdbaf955c6febbff8a5140aeb2ef5427 -rbae5b1087788172ce26168cd6b167d490f8993f4 --- TD_BloodPump/interface.ui (.../interface.ui) (revision a4f4b16cfdbaf955c6febbff8a5140aeb2ef5427) +++ TD_BloodPump/interface.ui (.../interface.ui) (revision bae5b1087788172ce26168cd6b167d490f8993f4) @@ -11,7 +11,7 @@ - &2 Treatment/&3 TD Blood Pump + &3 Treatment/&3 TD Blood Pump Index: TD_Pressures/interface.ui =================================================================== diff -u -ra4f4b16cfdbaf955c6febbff8a5140aeb2ef5427 -rbae5b1087788172ce26168cd6b167d490f8993f4 --- TD_Pressures/interface.ui (.../interface.ui) (revision a4f4b16cfdbaf955c6febbff8a5140aeb2ef5427) +++ TD_Pressures/interface.ui (.../interface.ui) (revision bae5b1087788172ce26168cd6b167d490f8993f4) @@ -23,7 +23,7 @@ - &2 Treatment/&2 Pressures + &3 Treatment/&2 Pressures Index: TD_TreatmentStates/interface.ui =================================================================== diff -u --- TD_TreatmentStates/interface.ui (revision 0) +++ TD_TreatmentStates/interface.ui (revision bae5b1087788172ce26168cd6b167d490f8993f4) @@ -0,0 +1,1045 @@ + + + ui_interface + + + + 0 + 0 + 721 + 889 + + + + &1 States/&3 Treatment + + + + + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color:rgb(55, 179, 119) + + + Treatment Mode Data + + + Qt::AlignCenter + + + + + + + send + + + + + + + reset + + + + + + + + + + + + 275 + 130 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 260 + + + 21 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 : Rinseback States + + + + + RINSEBACK_STOP_INIT_STATE + + + ItemIsSelectable|ItemIsEnabled + + + + + RINSEBACK_RUN_STATE + + + + + RINSEBACK_PAUSED_STATE + + + + + RINSEBACK_STOP_STATE + + + + + RINSEBACK_RUN_ADDITIONAL_STATE + + + + + + + + + 300 + 110 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 275 + + + 21 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 6 : Recirculate States + + + + + TREATMENT_RECIRC_DISCONNECT_PATIENT_STATE + + + + + TREATMENT_RECIRC_RECIRC_STATE + + + ItemIsSelectable|ItemIsEnabled + + + + + TREATMENT_RECIRC_STOPPED_STATE + + + + + TREATMENT_RECIRC_RECONNECT_PATIENT_STATE + + + + + + + + + 0 + 71 + + + + + 16777215 + 71 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 260 + + + 21 + + + + 0 + + + + + 1 + + + + + 7 : Treatment End States + + + + + TREATMENT_END_WAIT_FOR_RINSEBACK_STATE + + + ItemIsSelectable|ItemIsEnabled + + + + + TREATMENT_END_PAUSED_STATE + + + + + + + + + 275 + 100 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 260 + + + 21 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 8 : Saline States + + + + + SALINE_BOLUS_STATE_IDLE + + + ItemIsSelectable|ItemIsEnabled + + + + + SALINE_BOLUS_STATE_WAIT_FOR_PUMPS_STOP + + + + + SALINE_BOLUS_STATE_IN_PROGRESS + + + + + SALINE_BOLUS_STATE_MAX_DELIVERED + + + + + + + + + 225 + 175 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 210 + + + 21 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 9 : Heparin States + + + + + HEPARIN_STATE_OFF + + + ItemIsSelectable|ItemIsEnabled + + + + + HEPARIN_STATE_STOPPED + + + + + HEPARIN_STATE_PAUSED + + + + + HEPARIN_STATE_INITIAL_BOLUS + + + + + HEPARIN_STATE_DISPENSING + + + + + HEPARIN_STATE_COMPLETED + + + + + HEPARIN_STATE_EMPTY + + + + + + + + + + + + + 275 + 231 + + + + + 8 + 50 + false + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + false + + + true + + + 260 + + + true + + + 18 + + + 21 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 0 : Treatment States (subMode) + + + + + TREATMENT_START_STATE + + + + + TREATMENT_BLOOD_PRIME_STATE + + + + + TREATMENT_DIALYSIS_STATE + + + + + TREATMENT_PAUSED_STATE + + + + + TREATMENT_RINSEBACK_STATE + + + + + TREATMENT_RECIRC_STATE + + + + + TREATMENT_END_STATE + + + + + TREATMENT_ISO_UF_STATE + + + + + TREATMENT_SALINE_STATE + + + + + TREATMENT_DIALYSIS_PAUSED_STATE + + + + + + + + + 0 + 51 + + + + + 16777215 + 51 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 210 + + + 21 + + + + 0 + + + + + 1 : Blood Prime States + + + + + BLOOD_PRIME_RAMP_STATE + + + ItemIsSelectable|ItemIsEnabled + + + + + + + + + 0 + 70 + + + + + 16777215 + 70 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 210 + + + 21 + + + + 0 + + + + + 1 + + + + + 2: Dialysis States + + + + + DIALYSIS_UF_STATE + + + ItemIsSelectable|ItemIsEnabled + + + + + DIALYSIS_UF_PAUSED_STATE + + + + + + + + + 0 + 131 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 210 + + + 21 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 : Isolated UF States + + + + + UF_START_STATE + + + + + UF_PAUSED_STATE + + + + + UF_RUNNING_STATE + + + + + + + + + 0 + 110 + + + + + 16777215 + 16777215 + + + + + 8 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + true + + + 275 + + + 21 + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 : Treatment Stop States + + + + + TREATMENT_STOP_RECIRC_STATE + + + ItemIsSelectable|ItemIsEnabled + + + + + TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE + + + + + TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE + + + + + TREATMENT_STOP_NO_RECIRC_STATE + + + + + + + + + + + Index: TD_TreatmentStates/loader.py =================================================================== diff -u --- TD_TreatmentStates/loader.py (revision 0) +++ TD_TreatmentStates/loader.py (revision bae5b1087788172ce26168cd6b167d490f8993f4) @@ -0,0 +1,127 @@ +""" + The Ultrafiltration ui loader +""" +# Python +import os +# Qt +from PySide2 import QtWidgets +from PySide2.QtCore import Slot +# parent +from engine.dynamicloader import DynamicLoader + +# plugin specific +from leahi_dialin.common.td_defs import TDTreatmentStates as TXStates +from leahi_dialin.common.td_defs import TDDialysisStates as DialStates + +# hd Simulator +from leahi_dialin.ui.td_messaging import TD_Messaging +# -- none -- + + +class Loader(DynamicLoader): + """ + The Ultrafiltration ui loader + """ + tbSend: QtWidgets.QToolButton + tbReset: QtWidgets.QToolButton + + tblSubMode: QtWidgets.QTableWidget + tblUFStates: QtWidgets.QTableWidget + tblSalineStates: QtWidgets.QTableWidget + tblHeparinStates: QtWidgets.QTableWidget + tblRinsebackStates: QtWidgets.QTableWidget + tblRecirculateStates: QtWidgets.QTableWidget + tblBloodPrimeStates: QtWidgets.QTableWidget + tblTreatmentEndStates: QtWidgets.QTableWidget + tblTreatmentStopStates: QtWidgets.QTableWidget + + def __init__(self): + self.td_interface = TD_Messaging() + super().__init__(os.path.dirname(__file__)) + + def _init_loader(self): + """ + finds and creates widgets + :return: none + """ + self.tbReset = self.find_widget(QtWidgets.QToolButton , 'tbReset' ) + self.tbSend = self.find_widget(QtWidgets.QToolButton , 'tbSend' ) + + self.tblSubMode = self.find_widget(QtWidgets.QTableWidget , 'tblSubMode') + self.tblBloodPrimeStates = self.find_widget(QtWidgets.QTableWidget , 'tblBloodPrimeStates') + self.tblDialysisStates = self.find_widget(QtWidgets.QTableWidget , 'tblDialysisStates') + self.tblUFStates = self.find_widget(QtWidgets.QTableWidget , 'tblUFStates') + self.tblTreatmentStopStates = self.find_widget(QtWidgets.QTableWidget , 'tblTreatmentStopStates') + self.tblRinsebackStates = self.find_widget(QtWidgets.QTableWidget , 'tblRinsebackStates') + self.tblRecirculateStates = self.find_widget(QtWidgets.QTableWidget , 'tblRecirculateStates') + self.tblTreatmentEndStates = self.find_widget(QtWidgets.QTableWidget , 'tblTreatmentEndStates') + self.tblSalineStates = self.find_widget(QtWidgets.QTableWidget , 'tblSalineStates') + self.tblHeparinStates = self.find_widget(QtWidgets.QTableWidget , 'tblHeparinStates') + + def _init_connections(self): + """ + initializes the widgets connections + :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.tblBloodPrimeStates .currentCellChanged.connect(self.do_treatment_states) + self.tblDialysisStates .currentCellChanged.connect(self.do_treatment_states) + self.tblUFStates .currentCellChanged.connect(self.do_treatment_states) + self.tblTreatmentStopStates.currentCellChanged.connect(self.do_treatment_states) + self.tblRinsebackStates .currentCellChanged.connect(self.do_treatment_states) + self.tblRecirculateStates .currentCellChanged.connect(self.do_treatment_states) + self.tblTreatmentEndStates .currentCellChanged.connect(self.do_treatment_states) + self.tblSalineStates .currentCellChanged.connect(self.do_treatment_states) + self.tblHeparinStates .currentCellChanged.connect(self.do_treatment_states) + # apply/send the initial states + # self.do_treatment_states() + + @Slot() + def _init_widgets(self): + """ + initializes the widgets' properties + :return: none + """ + self.tblSubMode .setCurrentCell(TXStates.TREATMENT_START_STATE.value, 0) + self.tblBloodPrimeStates .setCurrentCell(0 , 0) + self.tblDialysisStates .setCurrentCell(DialStates.DIALYSIS_UF_STATE.value, 0) + self.tblUFStates .setCurrentCell(0, 0) + self.tblTreatmentStopStates.setCurrentCell(0, 0) + self.tblRinsebackStates .setCurrentCell(0, 0) + self.tblRecirculateStates .setCurrentCell(0, 0) + self.tblTreatmentEndStates .setCurrentCell(0, 0) + self.tblSalineStates .setCurrentCell(0, 0) + self.tblHeparinStates .setCurrentCell(0, 0) + + @Slot() + def do_treatment_states(self): + """ + the slot for saline bolus state change + :return: none + """ + sub_mode = int(self.tblSubMode .verticalHeaderItem(self.tblSubMode .currentRow()).text()) + blood_prime_state = int(self.tblBloodPrimeStates .verticalHeaderItem(self.tblBloodPrimeStates .currentRow()).text()) + dialysis_state = int(self.tblDialysisStates .verticalHeaderItem(self.tblDialysisStates .currentRow()).text()) + isolated_uf_state = int(self.tblUFStates .verticalHeaderItem(self.tblUFStates .currentRow()).text()) + tx_stop_state = int(self.tblTreatmentStopStates.verticalHeaderItem(self.tblTreatmentStopStates.currentRow()).text()) + tx_rinseback_state = int(self.tblRinsebackStates .verticalHeaderItem(self.tblRinsebackStates .currentRow()).text()) + tx_recirculate_state = int(self.tblRecirculateStates .verticalHeaderItem(self.tblRecirculateStates .currentRow()).text()) + tx_end_state = int(self.tblTreatmentEndStates .verticalHeaderItem(self.tblTreatmentEndStates .currentRow()).text()) + tx_saline_state = int(self.tblSalineStates .verticalHeaderItem(self.tblSalineStates .currentRow()).text()) + tx_heparin_state = int(self.tblHeparinStates .verticalHeaderItem(self.tblHeparinStates .currentRow()).text()) + + self.td_interface.td_tx_state( + sub_mode , + blood_prime_state , + dialysis_state , + isolated_uf_state , + tx_stop_state , + tx_rinseback_state , + tx_recirculate_state , + tx_end_state , + tx_saline_state , + tx_heparin_state + ) \ No newline at end of file