Index: TD_TreatmentAdjustmentsIsolatedUF/loader.py =================================================================== diff -u -r295370ef7e3c3b451d471a5749d3a70dfcf68432 -rae1930d3e2a41d3862a9e77e4607aaf6b896665e --- TD_TreatmentAdjustmentsIsolatedUF/loader.py (.../loader.py) (revision 295370ef7e3c3b451d471a5749d3a70dfcf68432) +++ TD_TreatmentAdjustmentsIsolatedUF/loader.py (.../loader.py) (revision ae1930d3e2a41d3862a9e77e4607aaf6b896665e) @@ -39,7 +39,7 @@ self.can_interface.register_receiving_publication_function( CAN.DenaliChannels.ui_to_td_ch_id, MsgIds.MSG_ID_UI_ISOLATED_UF_VOLUME_GOAL_CHANGE_REQUEST.value, - self.handle_volume_goal_request) + self.handle_volume_request) self.can_interface.register_receiving_publication_function( CAN.DenaliChannels.ui_to_td_ch_id, MsgIds.MSG_ID_UI_ISOLATED_UF_CONFIRM_REQUEST.value, @@ -51,46 +51,46 @@ finds and creates widgets :return: none """ - self.tbDurationRspSend = self.find_widget(QtWidgets.QToolButton , 'tbDurationRspSend' ) - self.tbDurationRspReset = self.find_widget(QtWidgets.QToolButton , 'tbDurationRspReset' ) - self.lbDurationReq = self.find_widget(QtWidgets.QLabel , 'lbDurationReq' ) - self.sbDurationRspRejectReason = self.find_widget(QtWidgets.QSpinBox , 'sbDurationRspRejectReason' ) - self.slDurationRspVolumeGoalMax = self.find_widget(QtWidgets.QSlider , 'slDurationRspVolumeGoalMax' ) - self.lbDurationRspVolumeGoalMax = self.find_widget(QtWidgets.QLabel , 'lbDurationRspVolumeGoalMax' ) + self.tbDurationRspSend = self.find_widget(QtWidgets.QToolButton , 'tbDurationRspSend' ) + self.tbDurationRspReset = self.find_widget(QtWidgets.QToolButton , 'tbDurationRspReset' ) + self.lbDurationReq = self.find_widget(QtWidgets.QLabel , 'lbDurationReq' ) + self.sbDurationRspRejectReason = self.find_widget(QtWidgets.QSpinBox , 'sbDurationRspRejectReason' ) + self.slDurationRspVolumeMax = self.find_widget(QtWidgets.QSlider , 'slDurationRspVolumeMax' ) + self.lbDurationRspVolumeMax = self.find_widget(QtWidgets.QLabel , 'lbDurationRspVolumeMax' ) - self.tbVolumeGoalRspSend = self.find_widget(QtWidgets.QToolButton , 'tbVolumeGoalRspSend' ) - self.tbVolumeGoalRspCopy = self.find_widget(QtWidgets.QToolButton , 'tbVolumeGoalRspCopy' ) - self.tbVolumeGoalRspReset = self.find_widget(QtWidgets.QToolButton , 'tbVolumeGoalRspReset' ) - self.lbVolumeGoalReqParams = self.find_widget(QtWidgets.QLabel , 'lbVolumeGoalReqParams' ) - self.sbVolumeGoalRspRejectReason = self.find_widget(QtWidgets.QSpinBox , 'sbVolumeGoalRspRejectReason' ) - self.slVolumeGoalRspVolumeGoal = self.find_widget(QtWidgets.QSlider , 'slVolumeGoalRspVolumeGoal' ) - self.lbVolumeGoalRspVolumeGoal = self.find_widget(QtWidgets.QLabel , 'lbVolumeGoalRspVolumeGoal' ) - self.slVolumeGoalRspDuration = self.find_widget(QtWidgets.QSlider , 'slVolumeGoalRspDuration' ) - self.lbVolumeGoalRspDuration = self.find_widget(QtWidgets.QLabel , 'lbVolumeGoalRspDuration' ) - self.slVolumeGoalRspRate = self.find_widget(QtWidgets.QSlider , 'slVolumeGoalRspRate' ) - self.lbVolumeGoalRspRate = self.find_widget(QtWidgets.QLabel , 'lbVolumeGoalRspRate' ) + self.tbVolumeRspSend = self.find_widget(QtWidgets.QToolButton , 'tbVolumeRspSend' ) + self.tbVolumeRspCopy = self.find_widget(QtWidgets.QToolButton , 'tbVolumeRspCopy' ) + self.tbVolumeRspReset = self.find_widget(QtWidgets.QToolButton , 'tbVolumeRspReset' ) + self.lbVolumeReqParams = self.find_widget(QtWidgets.QLabel , 'lbVolumeReqParams' ) + self.sbVolumeRspRejectReason = self.find_widget(QtWidgets.QSpinBox , 'sbVolumeRspRejectReason' ) + self.slVolumeRspVolume = self.find_widget(QtWidgets.QSlider , 'slVolumeRspVolume' ) + self.lbVolumeRspVolume = self.find_widget(QtWidgets.QLabel , 'lbVolumeRspVolume' ) + self.slVolumeRspDuration = self.find_widget(QtWidgets.QSlider , 'slVolumeRspDuration' ) + self.lbVolumeRspDuration = self.find_widget(QtWidgets.QLabel , 'lbVolumeRspDuration' ) + self.slVolumeRspRate = self.find_widget(QtWidgets.QSlider , 'slVolumeRspRate' ) + self.lbVolumeRspRate = self.find_widget(QtWidgets.QLabel , 'lbVolumeRspRate' ) - self.tbConfirmRspSend = self.find_widget(QtWidgets.QToolButton , 'tbConfirmRspSend' ) - self.tbConfirmRspReset = self.find_widget(QtWidgets.QToolButton , 'tbConfirmRspReset' ) - self.lbConfirmReqTimestamp = self.find_widget(QtWidgets.QLabel , 'lbConfirmReqTimestamp' ) - self.sbConfirmRspRejectReason = self.find_widget(QtWidgets.QSpinBox , 'sbConfirmRspRejectReason' ) + self.tbConfirmRspSend = self.find_widget(QtWidgets.QToolButton , 'tbConfirmRspSend' ) + self.tbConfirmRspReset = self.find_widget(QtWidgets.QToolButton , 'tbConfirmRspReset' ) + self.lbConfirmReqTimestamp = self.find_widget(QtWidgets.QLabel , 'lbConfirmReqTimestamp' ) + self.sbConfirmRspRejectReason = self.find_widget(QtWidgets.QSpinBox , 'sbConfirmRspRejectReason' ) def _init_connections(self): """ initializes the widgets connections :return: none """ - self.tbDurationRspSend .clicked .connect(self.do_duration_response) - self.tbDurationRspReset .clicked .connect(self.init_duration_response) - self.slDurationRspVolumeGoalMax .valueChanged .connect(lambda value: self.lbDurationRspVolumeGoalMax.setText(f"{value}")) + self.tbDurationRspSend .clicked .connect(self.do_duration_response) + self.tbDurationRspReset .clicked .connect(self.init_duration_response) + self.slDurationRspVolumeMax .valueChanged .connect(lambda value: self.lbDurationRspVolumeMax.setText(f"{value}")) - self.tbVolumeGoalRspSend .clicked .connect(self.do_volume_goal_response) - self.tbVolumeGoalRspCopy .clicked .connect(self.copy_volume_goal_response) - self.tbVolumeGoalRspReset .clicked .connect(self.init_volume_goal_response) - self.slVolumeGoalRspVolumeGoal .valueChanged .connect(lambda value: self.lbVolumeGoalRspVolumeGoal.setText(f"{value}")) - self.slVolumeGoalRspDuration .valueChanged .connect(lambda value: self.lbVolumeGoalRspDuration.setText(f"{value}")) - self.slVolumeGoalRspRate .valueChanged .connect(lambda value: self.lbVolumeGoalRspRate.setText(f"{value}")) + self.tbVolumeRspSend .clicked .connect(self.do_volume_response) + self.tbVolumeRspCopy .clicked .connect(self.copy_volume_response) + self.tbVolumeRspReset .clicked .connect(self.init_volume_response) + self.slVolumeRspVolume .valueChanged .connect(lambda value: self.lbVolumeRspVolume.setText(f"{value}")) + self.slVolumeRspDuration .valueChanged .connect(lambda value: self.lbVolumeRspDuration.setText(f"{value}")) + self.slVolumeRspRate .valueChanged .connect(lambda value: self.lbVolumeRspRate.setText(f"{value}")) self.tbConfirmRspSend .clicked .connect(self.do_confirm_response) self.tbConfirmRspReset .clicked .connect(self.init_confirm_response) @@ -103,7 +103,7 @@ :return: none """ self.init_duration_response() - self.init_volume_goal_response() + self.init_volume_response() self.init_confirm_response() @@ -115,7 +115,7 @@ """ self.lbDurationReq .setText("-- --") self.sbDurationRspRejectReason .setValue(0) - self.slDurationRspVolumeGoalMax .setValue(0) + self.slDurationRspVolumeMax .setValue(0) @Slot() @@ -138,63 +138,63 @@ """ self.td_interface.td_isolated_uf_duration_change_response( vRejectionReason = self.sbDurationRspRejectReason.value(), - vVolumeGoalMax = self.slDurationRspVolumeGoalMax.value() + vVolumeMax = self.slDurationRspVolumeMax.value() ) @Slot() - def init_volume_goal_response(self): + def init_volume_response(self): """ slot for initializing isolated UF volume goal response :return: none """ - self.lbVolumeGoalReqParams .setText("-- --") - self.sbVolumeGoalRspRejectReason .setValue(0) - self.slVolumeGoalRspVolumeGoal .setValue(0) - self.slVolumeGoalRspDuration .setValue(0) - self.slVolumeGoalRspRate .setValue(0) + self.lbVolumeReqParams .setText("-- --") + self.sbVolumeRspRejectReason .setValue(0) + self.slVolumeRspVolume .setValue(0) + self.slVolumeRspDuration .setValue(0) + self.slVolumeRspRate .setValue(0) @Slot() - def handle_volume_goal_request(self, message, timestamp = 0.0): + def handle_volume_request(self, message, timestamp = 0.0): """ slot called when the user requests isolated UF volume goal change :return: none """ message = message['message'] index = MsgFieldPositions.START_POS_FIELD_1 self.reqDuration,index = conversions.bytearray_to_integer(message, index, False) - self.reqVolumeGoal,index = conversions.bytearray_to_integer(message, index, False) - self.lbVolumeGoalReqParams.setText(f"Duration (min) = {self.reqDuration}, Volume Goal (mL) = {self.reqVolumeGoal}") + self.reqVolume,index = conversions.bytearray_to_integer(message, index, False) + self.lbVolumeReqParams.setText(f"Duration (min) = {self.reqDuration}, Volume (mL) = {self.reqVolume}") @Slot() - def copy_volume_goal_response(self): + def copy_volume_response(self): """ slot for copying the isolated UF volume goal from the request to the response :return: none """ - self.slVolumeGoalRspVolumeGoal .setValue(self.reqVolumeGoal) - self.slVolumeGoalRspDuration .setValue(self.reqDuration) + self.slVolumeRspVolume .setValue(self.reqVolume) + self.slVolumeRspDuration .setValue(self.reqDuration) @Slot() - def do_volume_goal_response(self): + def do_volume_response(self): """ slot for sending isolated UF volume goal change response :return: none """ - payload = conversions.integer_to_bytearray(1 if self.sbVolumeGoalRspRejectReason.value() == 0 else 0) - payload += conversions.integer_to_bytearray(self.sbVolumeGoalRspRejectReason.value()) - payload += conversions.integer_to_bytearray(self.slVolumeGoalRspVolumeGoal.value()) - payload += conversions.integer_to_bytearray(self.slVolumeGoalRspDuration.value()) - payload += conversions.integer_to_bytearray(self.slVolumeGoalRspRate.value()) + payload = conversions.integer_to_bytearray(1 if self.sbVolumeRspRejectReason.value() == 0 else 0) + payload += conversions.integer_to_bytearray(self.sbVolumeRspRejectReason.value()) + payload += conversions.integer_to_bytearray(self.slVolumeRspVolume.value()) + payload += conversions.integer_to_bytearray(self.slVolumeRspDuration.value()) + payload += conversions.integer_to_bytearray(self.slVolumeRspRate.value()) - self.td_interface.td_isolated_uf_volume_goal_change_response( - vRejectionReason = self.sbVolumeGoalRspRejectReason.value(), - vVolumeGoal = self.slVolumeGoalRspVolumeGoal.value(), - vDuration = self.slVolumeGoalRspDuration.value(), - vRate = self.slVolumeGoalRspRate.value() + self.td_interface.td_isolated_uf_volume_change_response( + vRejectionReason = self.sbVolumeRspRejectReason.value(), + vVolume = self.slVolumeRspVolume.value(), + vDuration = self.slVolumeRspDuration.value(), + vRate = self.slVolumeRspRate.value() )