Index: MainTreatmentData/interface.ui =================================================================== diff -u -ra8467291404cbcf74b2b79cbf463cc890e7791ee -r73941090b1a045d22b13cfc896c5c9aa691b5714 --- MainTreatmentData/interface.ui (.../interface.ui) (revision a8467291404cbcf74b2b79cbf463cc890e7791ee) +++ MainTreatmentData/interface.ui (.../interface.ui) (revision 73941090b1a045d22b13cfc896c5c9aa691b5714) @@ -7,7 +7,7 @@ 0 0 732 - 407 + 387 @@ -20,10 +20,163 @@ &3 Treatment/&1 Main treatment - - + + - + + + + 180 + 0 + + + + + 180 + 16777215 + + + + Cumulative Volume + + + + + + + 10000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + + + + 180 + 0 + + + + Target Volume + + + + + + + 10000 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 0 + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + 0 + 0 + + + + + 352 + 0 + + + + + 10 + + + + false + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + 61 : [0x3D00] : Saline Bolus + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Saline Bolus Req[0x5F00] + + + + + + + 0 @@ -36,50 +189,60 @@ 0 + + + 16777215 + 16777215 + + 10 color: rgb(238, 238, 236); -background-color: rgb(92, 53, 102); +background-color: rgb(92, 53, 102); + - 62 : [0x3E00] : Ultrafiltration + 59 : [0x3B00] : Treament Time Qt::AlignCenter - + - + 180 0 - Set Volume L + TX Duration - + - 1000 + 480 + + 15 + Qt::Horizontal - + 50 @@ -94,32 +257,32 @@ - + - + 180 0 - Target Rate L/Hr + Elapsed Time - + - 1000 + 480 Qt::Horizontal - + 50 @@ -134,137 +297,112 @@ - + + + Qt::Vertical + + + + 20 + 60 + + + + + + + + + + - - - - 180 - 0 - + + + + 10 + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + - Volume Delivered L + Main Treatment Data - - - - - - 200 + + Qt::AlignCenter - - Qt::Horizontal - - - - - 50 - 0 - - + - 0 + send - - - - - - - - 180 - 0 - - + - State + reset - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - + + + + - - - - - - 180 - 0 - - - - Max Delivery - - - - - - - 20.000000000000000 - - - 2.000000000000000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 180 + 0 + + + + + 180 + 16777215 + + + + Current Delivered Volume + + - + + + 10000 + - Qt::Vertical + Qt::Horizontal - + + + + + - 20 - 40 + 50 + 0 - + + 0 + + - - + + - + 0 @@ -294,102 +432,104 @@ - 59 : [0x3B00] : Treament Time + 79 : [0x4F00] : Set Point Data Qt::AlignCenter - + - + 180 0 - TX Duration + Blood Flow - + - 480 + 900 - - 15 - - - Qt::Horizontal - - - - - - 50 - 0 - - - - 0 - - - - + - + 180 0 - Elapsed Time + Dial Flow - + - 480 + 900 - - Qt::Horizontal - + + + + - + - 50 + 180 0 - 0 + Dial Temp + + + + 100.000000000000000 + + + + + + + Qt::Vertical + + + + 20 + 10 + + + + - - + + - + 0 @@ -407,48 +547,45 @@ 10 - - false - color: rgb(238, 238, 236); background-color: rgb(92, 53, 102); - 61 : [0x3D00] : Saline Bolus + 62 : [0x3E00] : Ultrafiltration Qt::AlignCenter - + - + 180 0 - Target Volume + Set Volume L - + - 10000 + 1000 Qt::Horizontal - + 50 @@ -463,38 +600,32 @@ - + - + 180 0 - - - 180 - 16777215 - - - Cumulative Volume + Target Rate L/Hr - + - 10000 + 1000 Qt::Horizontal - + 50 @@ -509,38 +640,32 @@ - + - + 180 0 - - - 180 - 16777215 - - - Current Delivered Volume + Volume Delivered L - + - 10000 + 200 Qt::Horizontal - + 50 @@ -555,357 +680,111 @@ - + - - - Saline Bolus Req[0x5F00] - - - - - - - false - - - QFrame::WinPanel - - - QFrame::Sunken - - - - - - - Qt::AlignCenter - - - - - - - - - - - - - - 10 - - - - color: rgb(238, 238, 236); -background-color: rgb(92, 53, 102); - - - - Main Treatment Data - - - Qt::AlignCenter - - - - - - - send - - - - - - - reset - - - - - - - - - - - - 0 - 0 - - - - - 352 - 0 - - - - - 16777215 - 16777215 - - - - - 10 - - - - color: rgb(238, 238, 236); -background-color: rgb(92, 53, 102); - - - - 101 : [0x6500] : Treament Vitals - - - Qt::AlignCenter - - - - - - - + 180 0 - Systolic + State - - - 60 - - - 250 - - - 120 - - + - - - - - - + + + Qt::Horizontal + + - 180 - 0 + 40 + 20 - - Diastolic - - + - - - - 40 - - - 200 - - - 80 - - - - + - + 180 0 - Heart Rate + Max Delivery - - - 40 - + - 180 + 20.000000000000000 - 100 + 2.000000000000000 - - - - - - + + + Qt::Horizontal + + - 180 - 0 + 40 + 20 - - Reason - - + - - - - 900 - - - - - - - - - - - 0 - 0 - + + + Qt::Vertical - + - 352 - 0 + 20 + 40 - - - 16777215 - 16777215 - - - - - 10 - - - - color: rgb(238, 238, 236); -background-color: rgb(92, 53, 102); - - - - 79 : [0x4F00] : Set Point Data - - - Qt::AlignCenter - - + - - - - - - - 180 - 0 - - - - Blood Flow - - - - - - - 900 - - - - - - - - - - - - 180 - 0 - - - - Dial Flow - - - - - - - 900 - - - - - - - - - - - - 180 - 0 - - - - Dial Temp - - - - - - - 100.000000000000000 - - - - - - - - - Qt::Vertical + + + + false - - - 20 - 40 - + + QFrame::WinPanel - + + QFrame::Sunken + + + - + + + Qt::AlignCenter + + @@ -918,12 +797,49 @@ UFVolDelSlider UFStatespinBox UFMaxDoubleSpinBox + DurationSlider + ElapsedSlider + BloodFlowSpinBox + DialFlowDpinBox + DialTempDoubleSpinBox tbSend tbReset + DurationSlider + valueChanged(int) + label_14 + setNum(int) + + + 666 + 82 + + + 721 + 83 + + + + + ElapsedSlider + valueChanged(int) + label_15 + setNum(int) + + + 666 + 107 + + + 721 + 108 + + + + TargetVolumeSlider valueChanged(int) label_8 Index: MainTreatmentData/loader.py =================================================================== diff -u -r2c35589a3da37c36c74e3ee4b4a57e387b03b463 -r73941090b1a045d22b13cfc896c5c9aa691b5714 --- MainTreatmentData/loader.py (.../loader.py) (revision 2c35589a3da37c36c74e3ee4b4a57e387b03b463) +++ MainTreatmentData/loader.py (.../loader.py) (revision 73941090b1a045d22b13cfc896c5c9aa691b5714) @@ -36,18 +36,13 @@ if self.can_interface is not None: channel_id = CAN.DenaliChannels.ui_to_td_ch_id - # soluton infusion - solution_infusion_message_id = MsgIds.MSG_ID_UI_SOLUTION_INFUSION_REQUEST.value + message_id = MsgIds.MSG_ID_UI_SOLUTION_INFUSION_REQUEST.value self.can_interface.register_receiving_publication_function(channel_id, - solution_infusion_message_id, + message_id, self.handle_solution_infusion_request) - self.saline_bolus_req.setText("Saline Bolus Req[{0}00]".format(f"0x{solution_infusion_message_id:02X}")) - # vitals request - vitals_request_message_id = MsgIds.MSG_ID_UI_BLOOD_PRESSURE_REQUEST.value - self.can_interface.register_receiving_publication_function(channel_id, - vitals_request_message_id, - self.handle_vitals_request) + self.saline_bolus_req.setText("Saline Bolus Req[{0}00]".format(f"0x{message_id:02X}")) + def _init_loader(self): """ finds and creates widgets @@ -82,10 +77,6 @@ self.lbBolusStart = self.find_widget(QtWidgets.QLabel , 'lbBolusStart' ) - self.sbSystolic = self.find_widget(QtWidgets.QSpinBox , 'SystolicSpinBox' ) - self.sbDiastolic = self.find_widget(QtWidgets.QSpinBox , 'DiastolicSpinBox' ) - self.sbHeartRate = self.find_widget(QtWidgets.QSpinBox , 'HeartRateSpinBox' ) - self.sbVitalsReason = self.find_widget(QtWidgets.QSpinBox , 'VitalsReasonSpinBox' ) def _init_connections(self): """ @@ -113,9 +104,6 @@ self.dial_flow_st_pt .valueChanged.connect(self.do_tx_set_point_data) self.dial_temp_st_pt .valueChanged.connect(self.do_tx_set_point_data) - self.sbSystolic .valueChanged.connect(self.do_vitals_data) - self.sbDiastolic .valueChanged.connect(self.do_vitals_data) - self.sbHeartRate .valueChanged.connect(self.do_vitals_data) def handle_solution_infusion_request(self, message, timestamp = 0.0): """ @@ -127,14 +115,6 @@ state,index = conversions.bytearray_to_integer( message, index) self.lbBolusStart .setText( str(state) ) - def handle_vitals_request(self, message, timestamp = 0.0): - """ - Called when the user requests to firmware from UI - @return: None - """ - reason = self.sbVitalsReason.value() - self.td_interface.td_vitals_adjustment_response(reason) - @Slot() def _init_widgets(self): """ @@ -240,24 +220,7 @@ dialysate_temp ) - @Slot() - def do_vitals_data(self): - """ - the slot for Vitals Data - :return: none - """ - systolic = self.sbSystolic .value() - diastolic = self.sbDiastolic .value() - heartRate = self.sbHeartRate .value() - - self.td_interface.td_vitals( - systolic , - diastolic , - heartRate - ) - - @Slot() def do_all_tx_data(self): """ the slot for treatment set point Data @@ -267,4 +230,3 @@ self.do_uf_data() self.do_tx_time_data() self.do_tx_set_point_data() - self.do_vitals_data() Index: Vitals/interface.ui =================================================================== diff -u --- Vitals/interface.ui (revision 0) +++ Vitals/interface.ui (revision 73941090b1a045d22b13cfc896c5c9aa691b5714) @@ -0,0 +1,194 @@ + + + ui_interface + + + + 0 + 0 + 439 + 193 + + + + + 100000 + 100000 + + + + &3 Treatment/&4 Vitals + + + + + + + + + + + 0 + 0 + + + + + 352 + 0 + + + + + 16777215 + 16777215 + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(92, 53, 102); + + + + 101 : [0x6500] : Treatment Vitals + + + Qt::AlignCenter + + + + + + + send + + + + + + + + + + + + 180 + 0 + + + + Systolic + + + + + + + 60 + + + 250 + + + 120 + + + + + + + + + + + + 180 + 0 + + + + Diastolic + + + + + + + 40 + + + 200 + + + 80 + + + + + + + + + + + + 180 + 0 + + + + Heart Rate + + + + + + + 40 + + + 180 + + + 100 + + + + + + + + + + + + 180 + 0 + + + + Reason + + + + + + + 900 + + + + + + + + + + + + Index: Vitals/loader.py =================================================================== diff -u --- Vitals/loader.py (revision 0) +++ Vitals/loader.py (revision 73941090b1a045d22b13cfc896c5c9aa691b5714) @@ -0,0 +1,107 @@ +""" + The Vitals ui loader +""" +# Python +import os +import can +import struct + +# Qt +from PySide2 import QtCore, QtWidgets +from PySide2.QtCore import Slot + +# parent +from engine.dynamicloader import DynamicLoader + +# plugin specific +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions + +from leahi_dialin.common.td_defs import TDOpModes +from leahi_dialin.common.td_defs import TDStandbyStates + +# hd Simulator +from leahi_dialin.ui.td_messaging import TD_Messaging + +class Loader(DynamicLoader): + """ + The Vitals ui loader + """ + + def __init__(self): + self.td_interface = TD_Messaging() + self.can_interface = self.td_interface.can_interface + super().__init__(os.path.dirname(__file__)) + + if self.can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + vitals_request_message_id = MsgIds.MSG_ID_UI_BLOOD_PRESSURE_REQUEST.value + self.can_interface.register_receiving_publication_function(channel_id, + vitals_request_message_id, + self.handle_vitals_request) + + def _init_loader(self): + """ + finds and creates widgets + :return: none + """ + self.tbSend = self.find_widget(QtWidgets.QToolButton , 'tbSend' ) + self.sbSystolic = self.find_widget(QtWidgets.QSpinBox , 'SystolicSpinBox' ) + self.sbDiastolic = self.find_widget(QtWidgets.QSpinBox , 'DiastolicSpinBox' ) + self.sbHeartRate = self.find_widget(QtWidgets.QSpinBox , 'HeartRateSpinBox' ) + self.sbVitalsReason = self.find_widget(QtWidgets.QSpinBox , 'VitalsReasonSpinBox' ) + + def _init_connections(self): + """ + initializes the widgets connections + :return: none + """ + self.tbSend .clicked .connect(self.do_send) + self.sbSystolic .valueChanged.connect(self.do_vitals_data) + self.sbDiastolic .valueChanged.connect(self.do_vitals_data) + self.sbHeartRate .valueChanged.connect(self.do_vitals_data) + + def _init_widgets(self): + """ + initializes the widgets' properties + :return: none + """ + + self.sbSystolic .setValue(120) + self.sbDiastolic .setValue(80) + self.sbHeartRate .setValue(100) + self.sbVitalsReason .setValue(0) + + @Slot() + def handle_vitals_request(self, message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + reason = self.sbVitalsReason.value() + self.td_interface.td_vitals_adjustment_response(reason) + + @Slot() + def do_vitals_data(self): + """ + the slot for Vitals Data + :return: none + """ + systolic = self.sbSystolic .value() + diastolic = self.sbDiastolic .value() + heartRate = self.sbHeartRate .value() + + self.td_interface.td_vitals( + systolic , + diastolic , + heartRate + ) + + @Slot() + def do_send(self): + """ + the slot for treatment set point Data + :return: none + """ + self.do_vitals_data()