Index: simulator/Simulator.ui =================================================================== diff -u -raa43a427ef1ad4d467585e321ead04b11b1cf1be -rc678a6653939736267d5301b524f32ff5d9cf4c5 --- simulator/Simulator.ui (.../Simulator.ui) (revision aa43a427ef1ad4d467585e321ead04b11b1cf1be) +++ simulator/Simulator.ui (.../Simulator.ui) (revision c678a6653939736267d5301b524f32ff5d9cf4c5) @@ -144,7 +144,7 @@ Cumulative - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -267,7 +267,7 @@ Volume - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -309,7 +309,7 @@ Target - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -1059,6 +1059,9 @@ Min + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -1077,6 +1080,9 @@ Max + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -1192,6 +1198,9 @@ Min + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -1273,6 +1282,9 @@ Max + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -1310,25 +1322,6 @@ - - - - - 10 - - - - background-color: rgb(117, 80, 123); -color: rgb(238, 238, 236); - - - Treatment Ranges - - - Qt::AlignCenter - - - @@ -1482,6 +1475,9 @@ Min + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -1500,6 +1496,9 @@ Max + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -1537,6 +1536,25 @@ + + + + + 10 + + + + background-color: rgb(117, 80, 123); +color: rgb(238, 238, 236); + + + Treatment Ranges + + + Qt::AlignCenter + + + @@ -1950,23 +1968,8 @@ - - - - - 10 - - - - 8000 - - - Qt::Horizontal - - - - - + + 0 @@ -1978,16 +1981,19 @@ 10 + + background-color: rgb(114, 159, 207); + - Volume + UF delivered Volume - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft + Qt::AlignCenter - - + + 0 @@ -1999,40 +2005,58 @@ 10 - - background-color: rgb(114, 159, 207); - - UF delivered Volume + Max - Qt::AlignCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 0 0 + + + 50 + 0 + + 10 - 0 + 8000 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + + 10 + + + + 8000 + + + Qt::Horizontal + + + + + 0 @@ -2045,34 +2069,28 @@ - Max + Volume - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - + + 0 0 - - - 50 - 0 - - 10 - 8000 + 0 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -2309,26 +2327,48 @@ - - + + 0 0 + + + 50 + 0 + + 10 - Min + mmHg - - + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 40 + + + + + + 0 @@ -2341,14 +2381,17 @@ - Max + 0 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + - - + + - + 0 0 @@ -2358,13 +2401,16 @@ 10 - - 8000 + + Min + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + - - + + 0 @@ -2376,21 +2422,18 @@ 10 - - background-color: rgb(229, 156, 156); - - Venous + 0 - Qt::AlignCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + - + 0 0 @@ -2400,66 +2443,48 @@ 10 - - 0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + - + 0 0 - - - 50 - 0 - - 10 - - mmHg - - - + + 0 0 - - - 50 - 0 - - 10 - mmHg + Max + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + - - + + - + 0 0 @@ -2469,31 +2494,43 @@ 10 - - 8000 + + background-color: rgb(229, 156, 156); + + Venous + + + Qt::AlignCenter + - - + + 0 0 + + + 50 + 0 + + 10 - Range + mmHg - - + + 0 @@ -2506,35 +2543,43 @@ + Range + + + + + + + Qt::Horizontal + + + + + + 0 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - Qt::Vertical + + + + Value - - QSizePolicy::Preferred + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 20 - 40 - - - + - - + + 0 @@ -2546,21 +2591,15 @@ 10 - - background-color: rgb(229, 156, 156); - - Arterial + Range - - Qt::AlignCenter - - - + + - + 0 0 @@ -2570,9 +2609,6 @@ 10 - - Range - @@ -2588,9 +2624,6 @@ 10 - - 480 - @@ -2609,24 +2642,6 @@ Max - - - - - - - 0 - 0 - - - - - 10 - - - - 0 - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -2680,10 +2695,26 @@ - - + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 40 + + + + + + - + 0 0 @@ -2693,9 +2724,12 @@ 10 - - 480 + + 0 + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + @@ -2714,10 +2748,37 @@ Min + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 0 + 0 + + + + + 10 + + + + background-color: rgb(229, 156, 156); + + + Arterial + + + Qt::AlignCenter + + + - + 0 @@ -2737,21 +2798,32 @@ - - + + + + Value + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + - Qt::Vertical + Qt::Horizontal - - QSizePolicy::Preferred + + + + + + 0 - - - 20 - 40 - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - + @@ -2857,15 +2929,6 @@ 10 - - 100 - - - 600 - - - 50 - @@ -2933,7 +2996,7 @@ color: rgb(238, 238, 236); - In-Line Blood Pressures Limits + In-Line Blood Pressures Qt::AlignCenter @@ -2971,12 +3034,12 @@ setNum(int) - 394 - 192 + 318 + 208 - 394 - 170 + 374 + 209 @@ -2987,12 +3050,12 @@ setNum(int) - 394 - 303 + 318 + 296 - 394 - 262 + 374 + 297 @@ -3003,12 +3066,12 @@ setNum(int) - 394 - 238 + 318 + 252 - 394 - 216 + 374 + 253 @@ -3019,14 +3082,46 @@ setNum(int) - 581 - 291 + 763 + 325 - 556 - 277 + 819 + 326 + + sldArterialPressureValue + valueChanged(int) + lblArterialPressureValue + setNum(int) + + + 174 + 459 + + + 251 + 460 + + + + + sldVenousPressureValue + valueChanged(int) + label_63 + setNum(int) + + + 345 + 461 + + + 520 + 459 + + + Index: simulator/run.py =================================================================== diff -u -rbefca1db0402e031a5b692aa93dc74bfb314eb9e -rc678a6653939736267d5301b524f32ff5d9cf4c5 --- simulator/run.py (.../run.py) (revision befca1db0402e031a5b692aa93dc74bfb314eb9e) +++ simulator/run.py (.../run.py) (revision c678a6653939736267d5301b524f32ff5d9cf4c5) @@ -118,6 +118,7 @@ """ The simulator class which loads the ui file dynamically and initializes the objects and can be eventually shown. + Note: this class is growing fast and seems like needs to be multiple classes """ # global variables declarations ui_file_name = "Simulator.ui" @@ -137,6 +138,10 @@ lblUfPauseAction: QtWidgets.QLabel lblUfResumeAction: QtWidgets.QLabel lblUfEditAction: QtWidgets.QLabel + lblArterialMin: QtWidgets.QLabel + lblArterialMax: QtWidgets.QLabel + lblVenousMin: QtWidgets.QLabel + lblVenousMax: QtWidgets.QLabel # spinbox spnSalineRejectReason: QtWidgets.QSpinBox spnUfPauseRejectReason: QtWidgets.QSpinBox @@ -148,13 +153,19 @@ spnUFVolumeMax: QtWidgets.QSpinBox spnDialysateMin: QtWidgets.QSpinBox spnDialysateMax: QtWidgets.QSpinBox + spnArterialMin: QtWidgets.QSpinBox + spnArterialMax: QtWidgets.QSpinBox + spnVenousMin: QtWidgets.QSpinBox + spnVenousMax: QtWidgets.QSpinBox # combobox cmbSalineAcceptTarget: QtWidgets.QComboBox # sliders sldSalineTarget: QtWidgets.QSlider sldSalineCumulative: QtWidgets.QSlider sldSalineVolume: QtWidgets.QSlider sldUfVolume: QtWidgets.QSlider + sldArterialPressureValue: QtWidgets.QSlider + sldVenousPressureValue: QtWidgets.QSlider # tables tblSalineSubMode: QtWidgets.QTableWidget tblSalineUFStates: QtWidgets.QTableWidget @@ -249,6 +260,104 @@ self.tblSalineUFStates.cellClicked.connect(self.do_saline_saline_state) self.tblSalineSalineStates.cellClicked.connect(self.do_saline_saline_state) + def setup_pressures_limits(self): + """ + sets up the treatment pressures + :return: none + """ + arterial_pressure_minimum = -300 + arterial_pressure_lower_bound = -300 + arterial_pressure_upper_bound = +100 + arterial_pressure_maximum = +200 + + venous_pressure_minimum = -100 + venous_pressure_lower_bound = -100 + venous_pressure_upper_bound = +400 + venous_pressure_maximum = +600 + + self.lblArterialMin = self.find_label('lblArterialMin') + self.lblArterialMax = self.find_label('lblArterialMax') + self.lblVenousMin = self.find_label('lblVenousMin') + self.lblVenousMax = self.find_label('lblVenousMax') + self.spnArterialMin = self.find_spinbox('spnArterialMin') + self.spnArterialMax = self.find_spinbox('spnArterialMax') + self.spnVenousMin = self.find_spinbox('spnVenousMin') + self.spnVenousMax = self.find_spinbox('spnVenousMax') + self.sldArterialPressureValue = self.find_slider('sldArterialPressureValue') + self.sldVenousPressureValue = self.find_slider('sldVenousPressureValue') + + self.lblArterialMin.setNum(arterial_pressure_minimum) + self.lblArterialMax.setNum(arterial_pressure_maximum) + self.lblVenousMin.setNum(venous_pressure_minimum) + self.lblVenousMax.setNum(venous_pressure_maximum) + + @Slot() + def do_set_arterial_min(arterial_min): + """ + set the acceptable arterial min value change + :param arterial_min: arterial pressure min + :return: none + """ + self.sldArterialPressureValue.setMinimum(arterial_min) + if self.sldArterialPressureValue.value() < arterial_min: + self.sldArterialPressureValue.setValue(arterial_min) + + @Slot() + def do_set_arterial_max(arterial_max): + """ + set the acceptable arterial max value change + :param arterial_max: arterial pressure max + :return: none + """ + self.sldArterialPressureValue.setMaximum(arterial_max) + if self.sldArterialPressureValue.value() > arterial_max: + self.sldArterialPressureValue.setValue(arterial_max) + + @Slot() + def do_set_venous_min(venous_min): + """ + set the acceptable venous min value change + :param venous_min: venous pressure min + :return: none + """ + self.sldVenousPressureValue.setMinimum(venous_min) + if self.sldVenousPressureValue.value() < venous_min: + self.sldVenousPressureValue.setValue(venous_min) + + @Slot() + def do_set_venous_max(venous_max): + """ + set the acceptable venous max value change + :param venous_max: venous pressure max + :return: none + """ + self.sldVenousPressureValue.setMaximum(venous_max) + if self.sldVenousPressureValue.value() > venous_max: + self.sldVenousPressureValue.setValue(venous_max) + + self.sldArterialPressureValue.valueChanged.connect(self.do_pressures_data) + self.sldVenousPressureValue.valueChanged.connect(self.do_pressures_data) + + self.spnArterialMin.valueChanged.connect(do_set_arterial_min) + self.spnArterialMax.valueChanged.connect(do_set_arterial_max) + + self.spnVenousMin.valueChanged.connect(do_set_venous_min) + self.spnVenousMax.valueChanged.connect(do_set_venous_max) + + self.spnArterialMin.setMinimum(arterial_pressure_minimum) + self.spnArterialMin.setMaximum(arterial_pressure_maximum) + self.spnArterialMin.setValue(arterial_pressure_lower_bound) + self.spnArterialMax.setMinimum(arterial_pressure_minimum) + self.spnArterialMax.setMaximum(arterial_pressure_maximum) + self.spnArterialMax.setValue(arterial_pressure_upper_bound) + + self.spnVenousMin.setMinimum(venous_pressure_minimum) + self.spnVenousMin.setMaximum(venous_pressure_maximum) + self.spnVenousMin.setValue(venous_pressure_lower_bound) + self.spnVenousMax.setMinimum(venous_pressure_minimum) + self.spnVenousMax.setMaximum(venous_pressure_maximum) + self.spnVenousMax.setValue(venous_pressure_upper_bound) + @Slot() def do_sb_accept(self): """ @@ -383,6 +492,18 @@ self.spnDialysateMax.value() ) + @Slot() + def do_pressures_data(self): + """ + sends the pressures values message with given value on the screen + :return: none + """ + denaliMessages.setPressureOcclusionData( + self.sldArterialPressureValue.value(), + self.sldVenousPressureValue.value(), + 0, 0, 0 + ) + def initialize(self): """ initializes the class by calling it's initializer methods to make objects ready @@ -393,6 +514,7 @@ self.setup_saline_data() self.setup_uf_adjustment() self.setup_treatment_states() + self.setup_pressures_limits() def main():