Index: Alarms/interface.ui =================================================================== diff -u --- Alarms/interface.ui (revision 0) +++ Alarms/interface.ui (revision 64d8a48a84b8b1bacd24876d1e49d77f8792fb72) @@ -0,0 +1,1080 @@ + + + ui_interface + + + + 0 + 0 + 472 + 652 + + + + &Alarms/&Alarm + + + + + + background-color: rgb(239, 41, 41); +color: rgb(238, 238, 236); + + + Alarms + + + Qt::AlignCenter + + + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(252, 175, 62); + + + Alarm Active List + + + Qt::AlignCenter + + + + + + + + + Accept + + + + + + + Reject + + + + + + + 999 + + + + + + + + 0 + 0 + + + + Reason + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + A0 + + + + + + + 999 + + + + + + + + + + + A1 + + + + + + + 999 + + + + + + + + + + + A2 + + + + + + + 999 + + + + + + + + + + + A3 + + + + + + + 999 + + + + + + + + + + + A4 + + + + + + + 999 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + A5 + + + + + + + 999 + + + + + + + + + + + A6 + + + + + + + 999 + + + + + + + + + + + A7 + + + + + + + 999 + + + + + + + + + + + A8 + + + + + + + 999 + + + + + + + + + + + A9 + + + + + + + 999 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(252, 175, 62); + + + Alarm Status + + + Qt::AlignCenter + + + + + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOn + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + true + + + true + + + true + + + + + + + Qt::Vertical + + + + + + + 65535 + + + + + + + 86400 + + + + + + + + 0 + 0 + + + + Top : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + spnTopID + + + + + + + 2 + + + QLayout::SetFixedSize + + + + + 0 + + + true + + + false + + + true + + + + + + + 1 + + + true + + + true + + + + + + + 2 + + + true + + + true + + + + + + + false + + + 3 + + + true + + + true + + + true + + + + + + + + + + 0 + 0 + + + + Esclates In (sec) : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + spnEscalatesIn + + + + + + + + 0 + 0 + + + + Priority : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + rdoPriorityNone + + + + + + + + 0 + 0 + + + + Mute Timeout (sec): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + spnMuteTimeout + + + + + + + Mute + + + Ctrl+Del + + + false + + + + + + + Send + + + Ctrl+Return + + + + + + + 86400 + + + + + + + + 0 + 0 + + + + QAbstractItemView::NoEditTriggers + + + + SYSTEM_FAULT + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + STOP + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + NO_CLEAR + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + NO_RESUME + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + NO_RINSEBACK + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + NO_END_TREATMENT + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + NO_NEW_TREATMENT + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + USER_MUST_ACK + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + ALARMS_TO_ESCALATE + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + ALARMS_SILENCED + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + LAMP_ON + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + UNUSED_1 + + + Unchecked + + + ItemIsUserCheckable + + + + + UNUSED_2 + + + Unchecked + + + ItemIsUserCheckable + + + + + UNUSED_3 + + + Unchecked + + + ItemIsUserCheckable + + + + + NO_MINIMIZE + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + TOP_CONDITION + + + Unchecked + + + ItemIsUserCheckable|ItemIsEnabled + + + + + + + + + + + + false + + + Clear + + + Shift+Del + + + + + + + Trigger + + + Shift+Return + + + + + + + false + + + Condition + + + Ctrl+Del + + + + + + + color: rgb(238, 238, 236); +background-color: rgb(252, 175, 62); + + + Alarm Trigger + + + Qt::AlignCenter + + + + + + + + + 1 + + + 65535 + + + + + + + + 0 + 0 + + + + Alarm ID : + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + spnAlarmID + + + + + + + + + + + + + + NONE + + + + + U32 + + + + + S32 + + + + + F32 + + + + + BOOL + + + + + + + + + NONE + + + + + U32 + + + + + S32 + + + + + F32 + + + + + BOOL + + + + + + + + + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAlwaysOn + + + QAbstractItemView::NoEditTriggers + + + false + + + false + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + true + + + true + + + true + + + + Time + + + + + Alarm ID + + + + + + + + + + + + + + btnAccept + btnReject + spnReason + spnP0 + spnP1 + spnP2 + spnP3 + spnP4 + spnP5 + spnP6 + spnP7 + spnP8 + spnP9 + btnSend + btnMute + spnTopID + rdoPriorityNone + rdoPriorityHigh + rdoPriorityMed + spnEscalatesIn + tblTriggeredIDs + lstFlags + spnMuteTimeout + tblStatusIDs + btnTrigger + btnClear + spnAlarmID + btnCondition + leDataField1 + leDataField2 + cbFieldDescriptor1 + cbFieldDescriptor2 + rdoPriorityLow + + + + + rdoPriorityNone + toggled(bool) + rdoPriorityNone + setDisabled(bool) + + + 168 + 141 + + + 174 + 138 + + + + + rdoPriorityLow + toggled(bool) + rdoPriorityLow + setDisabled(bool) + + + 190 + 136 + + + 200 + 144 + + + + + rdoPriorityMed + toggled(bool) + rdoPriorityMed + setDisabled(bool) + + + 217 + 139 + + + 226 + 138 + + + + + rdoPriorityHigh + toggled(bool) + rdoPriorityHigh + setDisabled(bool) + + + 244 + 134 + + + 253 + 137 + + + + + spnTopID + valueChanged(int) + btnSend + click() + + + 157 + 103 + + + 135 + 74 + + + + + Index: Alarms/loader.py =================================================================== diff -u --- Alarms/loader.py (revision 0) +++ Alarms/loader.py (revision 64d8a48a84b8b1bacd24876d1e49d77f8792fb72) @@ -0,0 +1,403 @@ +""" + The Alarms ui loader class container file +""" +# Python +import os +from datetime import datetime + +# Qt +from PySide2 import QtCore, QtWidgets +from PySide2.QtCore import Slot, QTimer, Qt + +# parent +from engine.dynamicloader import DynamicLoader + +# plugin specific +from leahi_dialin.common.alarm_priorities import AlarmPriority + +# dialin +from leahi_dialin.ui.td_messaging_alarms import TD_Messaging_Alarms + + +class Loader(DynamicLoader): + """ + The Alarms ui loader class + """ + + canMaximize = True + + priority = AlarmPriority.ALARM_HIGH + flags = 0 + + eColTime = 0 + eColID = 1 + eColMute = 2 + eColEscalate = 3 + eColFlags = 4 + eColMessage = 5 + eColCount = 6 + + eRowMute = 9 + + # column: (width, text) + fixedLabels = { + eColTime : ( 70, 'Time' ), + eColID : ( 45, 'Top ID' ), + eColMute : (100, 'Mute' ), + eColEscalate : ( 45, 'Escl' ), + eColFlags : (150, 'Flags' ), + eColMessage : (100, 'Message' ), + } + + colors = { + AlarmPriority.ALARM_NONE : Qt.green , + AlarmPriority.ALARM_LOW : Qt.yellow , + AlarmPriority.ALARM_MED : Qt.yellow , + AlarmPriority.ALARM_HIGH : Qt.red + } + styles = { + AlarmPriority.ALARM_NONE : 'rgb( 78, 154, 6)', + AlarmPriority.ALARM_LOW : 'rgb(237, 212, 0)', + AlarmPriority.ALARM_MED : 'rgb(237, 212, 0)', + AlarmPriority.ALARM_HIGH : 'rgb(239, 41, 41)' + } + + def __init__(self): + self.td_interface_alarms = TD_Messaging_Alarms() + super().__init__(os.path.dirname(__file__)) + + def _init_loader(self): + """ + finds and creates widgets + :return: none + """ + self.btnSend = self.find_widget(QtWidgets.QPushButton , 'btnSend' ) + self.btnMute = self.find_widget(QtWidgets.QPushButton , 'btnMute' ) + self.spnTopID = self.find_widget(QtWidgets.QSpinBox , 'spnTopID' ) + self.rdoPriorityNone = self.find_widget(QtWidgets.QToolButton , 'rdoPriorityNone' ) + self.rdoPriorityLow = self.find_widget(QtWidgets.QToolButton , 'rdoPriorityLow' ) + self.rdoPriorityMed = self.find_widget(QtWidgets.QToolButton , 'rdoPriorityMed' ) + self.rdoPriorityHigh = self.find_widget(QtWidgets.QToolButton , 'rdoPriorityHigh' ) + self.spnEscalatesIn = self.find_widget(QtWidgets.QSpinBox , 'spnEscalatesIn' ) + self.spnMuteTimeout = self.find_widget(QtWidgets.QSpinBox , 'spnMuteTimeout' ) + self.lstFlags = self.find_widget(QtWidgets.QListWidget , 'lstFlags' ) + self.tblStatusIDs = self.find_widget(QtWidgets.QTableWidget , 'tblStatusIDs' ) + + self.btnTrigger = self.find_widget(QtWidgets.QPushButton , 'btnTrigger' ) + self.btnClear = self.find_widget(QtWidgets.QPushButton , 'btnClear' ) + self.btnCondition = self.find_widget(QtWidgets.QPushButton , 'btnCondition' ) + self.spnAlarmID = self.find_widget(QtWidgets.QSpinBox , 'spnAlarmID' ) + self.tblTriggeredIDs = self.find_widget(QtWidgets.QTableWidget , 'tblTriggeredIDs' ) + + self.cbFieldDescriptor1 = self.find_widget(QtWidgets.QComboBox , 'cbFieldDescriptor1' ) + self.cbFieldDescriptor2 = self.find_widget(QtWidgets.QComboBox , 'cbFieldDescriptor2' ) + self.leDataField1 = self.find_widget(QtWidgets.QLineEdit , 'leDataField1' ) + self.leDataField2 = self.find_widget(QtWidgets.QLineEdit , 'leDataField2' ) + + self.btnAccept = self.find_widget(QtWidgets.QPushButton , 'btnAccept' ) + self.btnReject = self.find_widget(QtWidgets.QPushButton , 'btnReject' ) + self.spnReason = self.find_widget(QtWidgets.QSpinBox , 'spnReason' ) + self.spnP0 = self.find_widget(QtWidgets.QSpinBox , 'spnP0' ) + self.spnP1 = self.find_widget(QtWidgets.QSpinBox , 'spnP1' ) + self.spnP2 = self.find_widget(QtWidgets.QSpinBox , 'spnP2' ) + self.spnP3 = self.find_widget(QtWidgets.QSpinBox , 'spnP3' ) + self.spnP4 = self.find_widget(QtWidgets.QSpinBox , 'spnP4' ) + self.spnP5 = self.find_widget(QtWidgets.QSpinBox , 'spnP5' ) + self.spnP6 = self.find_widget(QtWidgets.QSpinBox , 'spnP6' ) + self.spnP7 = self.find_widget(QtWidgets.QSpinBox , 'spnP7' ) + self.spnP8 = self.find_widget(QtWidgets.QSpinBox , 'spnP8' ) + self.spnP9 = self.find_widget(QtWidgets.QSpinBox , 'spnP9' ) + + def _init_widgets(self): + """ + initializes the widgets' properties + :return: none + """ + self.timer = QTimer() + self.timer.start(1000) + + self.__populate_status_ids_columns() + self.rdoPriorityNone .setStyleSheet('background-color: {};'.format(self.styles[AlarmPriority.ALARM_NONE ])) + self.rdoPriorityLow .setStyleSheet('background-color: {};'.format(self.styles[AlarmPriority.ALARM_LOW ])) + self.rdoPriorityMed .setStyleSheet('background-color: {};'.format(self.styles[AlarmPriority.ALARM_MED ])) + self.rdoPriorityHigh .setStyleSheet('background-color: {};'.format(self.styles[AlarmPriority.ALARM_HIGH ])) + + self.tblTriggeredIDs .setColumnWidth(0, 75) + self.tblTriggeredIDs .setColumnWidth(1, 45) + + def _init_connections(self): + """ + initializes the widgets connections + :return: + """ + self.btnSend .clicked .connect(self.do_send ) + self.btnAccept .clicked .connect(self.do_active_list_accept ) + self.btnReject .clicked .connect(self.do_active_list_reject ) + self.btnMute .clicked .connect(self.do_mute ) # item clicked might be enough + self.btnTrigger .clicked .connect(self.do_trigger ) + self.btnClear .clicked .connect(self.do_clear ) + self.btnCondition .clicked .connect(self.do_clear_condition ) + self.timer .timeout .connect(self.do_timer_timeout ) + self.rdoPriorityNone .toggled .connect(self.do_set_priority_none ) + self.rdoPriorityLow .toggled .connect(self.do_set_priority_low ) + self.rdoPriorityMed .toggled .connect(self.do_set_priority_med ) + self.rdoPriorityHigh .toggled .connect(self.do_set_priority_high ) + self.tblTriggeredIDs .itemClicked .connect(self.on_trigger_ids_item_clicked ) + self.tblStatusIDs .itemClicked .connect(self.on_status_ids_item_clicked ) + + def set_flags(self): + """ + the slot for flags + :return: none + """ + highest = False + lst = self.lstFlags + for i in range(lst.count()): + if highest: + bit = pow(2, 15 - i) + else: + bit = pow(2, i) + + if lst.item(i).checkState() == Qt.Checked: + self.flags |= bit + else: + self.flags &= ~bit + + @Slot() + def do_timer_timeout(self) -> None: + """ + one second timer to send the alarm status at all the time like what FW does but in lower frequency + :return: None + """ + # self.do_send() + + @Slot() + def do_set_priority_none(self): + """ + the slot for priority buttons + :return: none + """ + self.priority = AlarmPriority.ALARM_NONE + + @Slot() + def do_set_priority_low(self): + """ + the slot for priority buttons + :return: none + """ + self.priority = AlarmPriority.ALARM_LOW + + @Slot() + def do_set_priority_med(self): + """ + the slot for priority buttons + :return: none + """ + self.priority = AlarmPriority.ALARM_MED + + @Slot() + def do_set_priority_high(self): + """ + the slot for priority buttons + :return: none + """ + self.priority = AlarmPriority.ALARM_HIGH + + @Slot() + def do_send(self): + """ + the slot for send button + :return: none + """ + alarm_id = self.spnTopID.value() + escalate = self.spnEscalatesIn.value() + mute_out = self.spnMuteTimeout.value() + if alarm_id >= 0: + self.set_flags() + self.td_interface_alarms.cmd_activate_alarm_id( + self.priority, + alarm_id, + escalate, + mute_out, + self.flags + ) + self.__append_status_ids_row(alarm_id) + + @Slot() + def do_trigger(self): + """ + the slot for trigger button + :return: none + """ + alarm_id = self.spnAlarmID.value() + field_descriptor_1 = self.cbFieldDescriptor1.currentIndex() + data_field_1 = self.leDataField1.text() + if data_field_1 == "": + data_field_1 = "0" + field_descriptor_2 = self.cbFieldDescriptor2.currentIndex() + data_field_2 = self.leDataField2.text() + if data_field_2 == "": + data_field_2 = "0" + + if alarm_id: + self.interface.alarm.cmd_set_alarm_triggered( + alarm_id, + field_descriptor_1, data_field_1, + field_descriptor_2, data_field_2, 101, 202, 1) + self.__append_triggered_row(alarm_id) + + @Slot() + def do_clear(self): + """ + the slot for clear button + :return: none + """ + [alarm_id, row] = self.alarm_id() + self.interface.alarm.cmd_set_alarm_cleared(alarm_id) + self.tblTriggeredIDs.removeRow(row) + + @Slot() + def do_clear_condition(self): + """ + the slot for condition button + :return: none + """ + [alarm_id, row] = self.alarm_id() + self.interface.alarm.cmd_set_alarm_cleared_condition(alarm_id) + self.tblTriggeredIDs.item(row, self.eColID).setBackground(self.colors[AlarmPriority.ALARM_NONE]) + self.tblTriggeredIDs.item(row, self.eColID).setSelected(False) + + @Slot() + def do_mute(self, value): + """ + the slot for mute button + :return: none + """ + print(self.lstFlags.item(self.eRowMute).checkState()) + if self.lstFlags.item(self.eRowMute).checkState() == Qt.CheckState.Unchecked: + self.lstFlags.item(self.eRowMute).setCheckState(Qt.CheckState.Checked) + else: + self.lstFlags.item(self.eRowMute).setCheckState(Qt.CheckState.Unchecked) + self.do_send() + + @Slot() + def do_active_list_accept(self): + """ + the slot for mute button + :return: none + """ + a0 = self.spnP0.value() + a1 = self.spnP1.value() + a2 = self.spnP2.value() + a3 = self.spnP3.value() + a4 = self.spnP4.value() + a5 = self.spnP5.value() + a6 = self.spnP6.value() + a7 = self.spnP7.value() + a8 = self.spnP8.value() + a9 = self.spnP9.value() + self.interface.alarm.cmd_send_active_list_response(True, 0, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) + + @Slot() + def do_active_list_reject(self): + """ + the slot for mute button + :return: none + """ + reason = self.spnReason.value() + self.interface.alarm.cmd_send_active_list_response(False, reason) + + @Slot() + def on_status_ids_item_clicked(self, item: QtWidgets.QTableWidgetItem): + """ + slot to handle on item clicked + :param item: the clicked item + :return: None + """ + selected = item.isSelected() + + @Slot() + def on_trigger_ids_item_clicked(self, item: QtWidgets.QTableWidgetItem): + """ + slot to handle on item clicked + :param item: the clicked item + :return: None + """ + selected = item.isSelected() + self.btnClear.setEnabled(selected) + self.btnCondition.setEnabled(selected) + + def __populate_status_ids_columns(self): + """ + adds alarm flags as columns in the Status alarms table + :return: None + """ + items = sorted(self.fixedLabels.items()) + self.tblStatusIDs.setColumnCount(self.eColCount) + self.tblStatusIDs.setHorizontalHeaderLabels([v[1] for k, v in items]) + for col, item in items: + self.tblStatusIDs.setColumnWidth(col, item[0]) + + def __append_status_ids_row(self, alarm_id): + """ + appends the Status alarm id into the Status list + :return: None + """ + inset_at_top = True + + now = datetime.now().strftime("%H:%M:%S") + + items = self.tblStatusIDs.findItems(str(alarm_id), Qt.MatchExactly) + if len(items): + item: QtWidgets.QTableWidgetItem = items[0] + row = item.row() + else: + row = 0 if inset_at_top else self.tblStatusIDs.rowCount() + self.tblStatusIDs.insertRow(row) + + model = self.tblStatusIDs.model() + model.setData(model.index(row, self.eColTime), now) + model.setData(model.index(row, self.eColID), alarm_id) + model.setData(model.index(row, self.eColMute), self.spnMuteTimeout.value()) + model.setData(model.index(row, self.eColEscalate), self.spnEscalatesIn.value()) + self.tblStatusIDs.item(row, self.eColMute).setCheckState(Qt.Unchecked) + model.setData(model.index(row, self.eColMessage), "N/A") + model.setData(model.index(row, self.eColFlags), '{:016b}'.format(self.flags, 'b')) + self.tblStatusIDs.item(row, self.eColID).setBackground(self.colors[self.priority]) + + def __append_triggered_row(self, alarm_id): + """ + appends the triggered alarm id into the triggered list + :return: None + """ + inset_at_top = True + + now = datetime.now().strftime("%H:%M:%S") + + items = self.tblTriggeredIDs.findItems(str(alarm_id), Qt.MatchExactly) + if len(items): + item: QtWidgets.QTableWidgetItem = items[0] + row = item.row() + else: + row = 0 if inset_at_top else self.tblTriggeredIDs.rowCount() + self.tblTriggeredIDs.insertRow(row) + + model = self.tblTriggeredIDs.model() + model.setData(model.index(row, self.eColTime), now) + model.setData(model.index(row, self.eColID), alarm_id) + self.tblTriggeredIDs.item(row, self.eColID).setBackground(self.colors[AlarmPriority.ALARM_HIGH]) + + def alarm_id(self): + """ + gets the alarm id from the list of the triggered id list + :return: + """ + row = 0 + alarm_id = 0 + items = self.tblTriggeredIDs.selectedItems() + if len(items): + item: QtWidgets.QTableWidgetItem = items[0] + row = item.row() + model = self.tblTriggeredIDs.model() + alarm_id = model.data(model.index(row, self.eColID)) + return [alarm_id, row] Index: GeneralResponseMessage/interface.ui =================================================================== diff -u --- GeneralResponseMessage/interface.ui (revision 0) +++ GeneralResponseMessage/interface.ui (revision 64d8a48a84b8b1bacd24876d1e49d77f8792fb72) @@ -0,0 +1,2340 @@ + + + ui_interface + + + + 0 + 0 + 1201 + 441 + + + + &9 General/&0 Response Message + + + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(46, 52, 54); + + + Response Message + + + Qt::AlignCenter + + + + + + + + + + + + 100 + 16777215 + + + + TD + + + true + + + + + + + + 100 + 16777215 + + + + DD + + + + + + + + 100 + 16777215 + + + + Ch: + + + + + + + + 100 + 16777215 + + + + 999999999 + + + + + + + + 100 + 16777215 + + + + Data + + + + + + + + + + + + 100 + 16777215 + + + + MsgID + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 100 + 16777215 + + + + 999999999 + + + + + + + + 100 + 16777215 + + + + Decimal + + + + + + + + + + 100 + 16777215 + + + + Accept + + + + + + + + 100 + 16777215 + + + + Reject + + + + + + + + 100 + 16777215 + + + + 999999999 + + + + + + + + 100 + 16777215 + + + + Reason + + + + + + + + + + 100 + 16777215 + + + + Ack + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 100 + 16777215 + + + + 999999999 + + + + + + + + 100 + 16777215 + + + + Sequence + + + + + + + + 100 + 16777215 + + + + Send + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 2 + + + 0 + + + + + + 100 + 16777215 + + + + P20 + + + + + + + + 100 + 16777215 + + + + P21 + + + + + + + + 100 + 16777215 + + + + P22 + + + + + + + + 100 + 16777215 + + + + P23 + + + + + + + + 100 + 16777215 + + + + P24 + + + + + + + + 100 + 16777215 + + + + P25 + + + + + + + + 100 + 16777215 + + + + P26 + + + + + + + + 100 + 16777215 + + + + P27 + + + + + + + + 100 + 16777215 + + + + P28 + + + + + + + + 100 + 16777215 + + + + P29 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + F20 + + + + + + + + 100 + 16777215 + + + + F21 + + + + + + + + 100 + 16777215 + + + + F22 + + + + + + + + 100 + 16777215 + + + + F23 + + + + + + + + 100 + 16777215 + + + + F24 + + + + + + + + 100 + 16777215 + + + + F25 + + + + + + + + 100 + 16777215 + + + + F26 + + + + + + + + 100 + 16777215 + + + + F27 + + + + + + + + 100 + 16777215 + + + + F28 + + + + + + + + 100 + 16777215 + + + + F29 + + + + + + + + + 2 + + + 0 + + + + + + 100 + 16777215 + + + + F7 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + P2 + + + + + + + + 100 + 16777215 + + + + F9 + + + + + + + + 100 + 16777215 + + + + P0 + + + + + + + + 100 + 16777215 + + + + F8 + + + + + + + + 100 + 16777215 + + + + P3 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + P9 + + + + + + + + 100 + 16777215 + + + + P5 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + F6 + + + + + + + + 100 + 16777215 + + + + P4 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + P6 + + + + + + + + 100 + 16777215 + + + + F4 + + + + + + + + 100 + 16777215 + + + + F2 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + F0 + + + + + + + + 100 + 16777215 + + + + F5 + + + + + + + + 100 + 16777215 + + + + P8 + + + + + + + + 100 + 16777215 + + + + F3 + + + + + + + + 100 + 16777215 + + + + P7 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + P1 + + + + + + + + 100 + 16777215 + + + + F1 + + + + + + + + + 2 + + + 0 + + + + + + 100 + 16777215 + + + + P10 + + + + + + + + 100 + 16777215 + + + + P11 + + + + + + + + 100 + 16777215 + + + + P12 + + + + + + + + 100 + 16777215 + + + + P13 + + + + + + + + 100 + 16777215 + + + + P14 + + + + + + + + 100 + 16777215 + + + + P15 + + + + + + + + 100 + 16777215 + + + + P16 + + + + + + + + 100 + 16777215 + + + + P17 + + + + + + + + 100 + 16777215 + + + + P18 + + + + + + + + 100 + 16777215 + + + + P19 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + F10 + + + + + + + + 100 + 16777215 + + + + F11 + + + + + + + + 100 + 16777215 + + + + F12 + + + + + + + + 100 + 16777215 + + + + F13 + + + + + + + + 100 + 16777215 + + + + F14 + + + + + + + + 100 + 16777215 + + + + F15 + + + + + + + + 100 + 16777215 + + + + F16 + + + + + + + + 100 + 16777215 + + + + F17 + + + + + + + + 100 + 16777215 + + + + F18 + + + + + + + + 100 + 16777215 + + + + F19 + + + + + + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color: rgb(46, 52, 54); + + + General Response Message + + + Qt::AlignCenter + + + + + + + 2 + + + 0 + + + + + + 100 + 16777215 + + + + P30 + + + + + + + + 100 + 16777215 + + + + P31 + + + + + + + + 100 + 16777215 + + + + P32 + + + + + + + + 100 + 16777215 + + + + P33 + + + + + + + + 100 + 16777215 + + + + P34 + + + + + + + + 100 + 16777215 + + + + P35 + + + + + + + + 100 + 16777215 + + + + P36 + + + + + + + + 100 + 16777215 + + + + P37 + + + + + + + + 100 + 16777215 + + + + P38 + + + + + + + + 100 + 16777215 + + + + P39 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + 3 + + + -2147483647.000000000000000 + + + 2147483647.000000000000000 + + + + + + + + 100 + 16777215 + + + + F30 + + + + + + + + 100 + 16777215 + + + + F31 + + + + + + + + 100 + 16777215 + + + + F32 + + + + + + + + 100 + 16777215 + + + + F33 + + + + + + + + 100 + 16777215 + + + + F34 + + + + + + + + 100 + 16777215 + + + + F35 + + + + + + + + 100 + 16777215 + + + + F36 + + + + + + + + 100 + 16777215 + + + + F37 + + + + + + + + 100 + 16777215 + + + + F38 + + + + + + + + 100 + 16777215 + + + + F39 + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 100 + 16777215 + + + + + + + + + + + rbTD + rbDD + chkP0 + spnP0 + chkP1 + spnP1 + chkP2 + spnP2 + chkP3 + spnP3 + chkP4 + spnP4 + chkP5 + spnP5 + chkP6 + spnP6 + chkP7 + spnP7 + chkP8 + spnP8 + chkP9 + spnP9 + + + + + chkP9 + toggled(bool) + chkP8 + setChecked(bool) + + + 1397 + 135 + + + 1258 + 135 + + + + + chkP8 + toggled(bool) + chkP7 + setChecked(bool) + + + 1258 + 135 + + + 1119 + 135 + + + + + chkP7 + toggled(bool) + chkP6 + setChecked(bool) + + + 1119 + 135 + + + 980 + 135 + + + + + chkP6 + toggled(bool) + chkP5 + setChecked(bool) + + + 980 + 135 + + + 841 + 135 + + + + + chkP5 + toggled(bool) + chkP4 + setChecked(bool) + + + 841 + 135 + + + 702 + 135 + + + + + chkP4 + toggled(bool) + chkP3 + setChecked(bool) + + + 702 + 135 + + + 563 + 135 + + + + + chkP3 + toggled(bool) + chkP2 + setChecked(bool) + + + 563 + 135 + + + 424 + 135 + + + + + chkP2 + toggled(bool) + chkP1 + setChecked(bool) + + + 424 + 135 + + + 278 + 135 + + + + + chkP1 + toggled(bool) + chkP0 + setChecked(bool) + + + 264 + 135 + + + 58 + 135 + + + + + Index: GeneralResponseMessage/loader.py =================================================================== diff -u --- GeneralResponseMessage/loader.py (revision 0) +++ GeneralResponseMessage/loader.py (revision 64d8a48a84b8b1bacd24876d1e49d77f8792fb72) @@ -0,0 +1,584 @@ +""" +The ui loader class +""" +# Python +import os + +# Qt +from PySide2 import QtWidgets +from PySide2.QtCore import Slot + +# parent +from engine.dynamicloader import DynamicLoader + +# plugin specific + +# dialin +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.utils import conversions +from leahi_dialin.protocols import CAN + + +class Loader(DynamicLoader): + """ + The ui loader class + """ + + 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.rbTD = self.find_widget(QtWidgets.QRadioButton , 'rbTD' ) + self.rbDD = self.find_widget(QtWidgets.QRadioButton , 'rbDD' ) + self.rbCH = self.find_widget(QtWidgets.QRadioButton , 'rbCH' ) + self.spnChannelID = self.find_widget(QtWidgets.QSpinBox , 'spnChannelID') + + self.chkData = self.find_widget(QtWidgets.QCheckBox , 'chkData' ) + + self.spnMessageID = self.find_widget(QtWidgets.QSpinBox , 'spnMessageID') + + self.btnAccept = self.find_widget(QtWidgets.QPushButton , 'btnAccept' ) + self.btnReject = self.find_widget(QtWidgets.QPushButton , 'btnReject' ) + self.lblAction = self.find_widget(QtWidgets.QLabel , 'lblAction' ) + self.spnReason = self.find_widget(QtWidgets.QSpinBox , 'spnReason' ) + + self.btnAcknow = self.find_widget(QtWidgets.QPushButton , 'btnAcknow' ) + self.spnSequence = self.find_widget(QtWidgets.QSpinBox , 'spnSequence' ) + + self.spnP0 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP0' ) + self.spnP1 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP1' ) + self.spnP2 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP2' ) + self.spnP3 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP3' ) + self.spnP4 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP4' ) + self.spnP5 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP5' ) + self.spnP6 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP6' ) + self.spnP7 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP7' ) + self.spnP8 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP8' ) + self.spnP9 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP9' ) + self.spnP10 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP10' ) + self.spnP11 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP11' ) + self.spnP12 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP12' ) + self.spnP13 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP13' ) + self.spnP14 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP14' ) + self.spnP15 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP15' ) + self.spnP16 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP16' ) + self.spnP17 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP17' ) + self.spnP18 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP18' ) + self.spnP19 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP19' ) + self.spnP20 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP20' ) + self.spnP21 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP21' ) + self.spnP22 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP22' ) + self.spnP23 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP23' ) + self.spnP24 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP24' ) + self.spnP25 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP25' ) + self.spnP26 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP26' ) + self.spnP27 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP27' ) + self.spnP28 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP28' ) + self.spnP29 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP29' ) + self.spnP30 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP30' ) + self.spnP31 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP31' ) + self.spnP32 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP32' ) + self.spnP33 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP33' ) + self.spnP34 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP34' ) + self.spnP35 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP35' ) + self.spnP36 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP36' ) + self.spnP37 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP37' ) + self.spnP38 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP38' ) + self.spnP39 = self.find_widget(QtWidgets.QDoubleSpinBox , 'spnP39' ) + + self.chkP0 = self.find_widget(QtWidgets.QCheckBox , 'chkP0' ) + self.chkP1 = self.find_widget(QtWidgets.QCheckBox , 'chkP1' ) + self.chkP2 = self.find_widget(QtWidgets.QCheckBox , 'chkP2' ) + self.chkP3 = self.find_widget(QtWidgets.QCheckBox , 'chkP3' ) + self.chkP4 = self.find_widget(QtWidgets.QCheckBox , 'chkP4' ) + self.chkP5 = self.find_widget(QtWidgets.QCheckBox , 'chkP5' ) + self.chkP6 = self.find_widget(QtWidgets.QCheckBox , 'chkP6' ) + self.chkP7 = self.find_widget(QtWidgets.QCheckBox , 'chkP7' ) + self.chkP8 = self.find_widget(QtWidgets.QCheckBox , 'chkP8' ) + self.chkP9 = self.find_widget(QtWidgets.QCheckBox , 'chkP9' ) + self.chkP10 = self.find_widget(QtWidgets.QCheckBox , 'chkP10' ) + self.chkP11 = self.find_widget(QtWidgets.QCheckBox , 'chkP11' ) + self.chkP12 = self.find_widget(QtWidgets.QCheckBox , 'chkP12' ) + self.chkP13 = self.find_widget(QtWidgets.QCheckBox , 'chkP13' ) + self.chkP14 = self.find_widget(QtWidgets.QCheckBox , 'chkP14' ) + self.chkP15 = self.find_widget(QtWidgets.QCheckBox , 'chkP15' ) + self.chkP16 = self.find_widget(QtWidgets.QCheckBox , 'chkP16' ) + self.chkP17 = self.find_widget(QtWidgets.QCheckBox , 'chkP17' ) + self.chkP18 = self.find_widget(QtWidgets.QCheckBox , 'chkP18' ) + self.chkP19 = self.find_widget(QtWidgets.QCheckBox , 'chkP19' ) + self.chkP20 = self.find_widget(QtWidgets.QCheckBox , 'chkP20' ) + self.chkP21 = self.find_widget(QtWidgets.QCheckBox , 'chkP21' ) + self.chkP22 = self.find_widget(QtWidgets.QCheckBox , 'chkP22' ) + self.chkP23 = self.find_widget(QtWidgets.QCheckBox , 'chkP23' ) + self.chkP24 = self.find_widget(QtWidgets.QCheckBox , 'chkP24' ) + self.chkP25 = self.find_widget(QtWidgets.QCheckBox , 'chkP25' ) + self.chkP26 = self.find_widget(QtWidgets.QCheckBox , 'chkP26' ) + self.chkP27 = self.find_widget(QtWidgets.QCheckBox , 'chkP27' ) + self.chkP28 = self.find_widget(QtWidgets.QCheckBox , 'chkP28' ) + self.chkP29 = self.find_widget(QtWidgets.QCheckBox , 'chkP29' ) + self.chkP30 = self.find_widget(QtWidgets.QCheckBox , 'chkP30' ) + self.chkP31 = self.find_widget(QtWidgets.QCheckBox , 'chkP31' ) + self.chkP32 = self.find_widget(QtWidgets.QCheckBox , 'chkP32' ) + self.chkP33 = self.find_widget(QtWidgets.QCheckBox , 'chkP33' ) + self.chkP34 = self.find_widget(QtWidgets.QCheckBox , 'chkP34' ) + self.chkP35 = self.find_widget(QtWidgets.QCheckBox , 'chkP35' ) + self.chkP36 = self.find_widget(QtWidgets.QCheckBox , 'chkP36' ) + self.chkP37 = self.find_widget(QtWidgets.QCheckBox , 'chkP37' ) + self.chkP38 = self.find_widget(QtWidgets.QCheckBox , 'chkP38' ) + self.chkP39 = self.find_widget(QtWidgets.QCheckBox , 'chkP39' ) + + self.chkF0 = self.find_widget(QtWidgets.QCheckBox , 'chkF0' ) + self.chkF1 = self.find_widget(QtWidgets.QCheckBox , 'chkF1' ) + self.chkF2 = self.find_widget(QtWidgets.QCheckBox , 'chkF2' ) + self.chkF3 = self.find_widget(QtWidgets.QCheckBox , 'chkF3' ) + self.chkF4 = self.find_widget(QtWidgets.QCheckBox , 'chkF4' ) + self.chkF5 = self.find_widget(QtWidgets.QCheckBox , 'chkF5' ) + self.chkF6 = self.find_widget(QtWidgets.QCheckBox , 'chkF6' ) + self.chkF7 = self.find_widget(QtWidgets.QCheckBox , 'chkF7' ) + self.chkF8 = self.find_widget(QtWidgets.QCheckBox , 'chkF8' ) + self.chkF9 = self.find_widget(QtWidgets.QCheckBox , 'chkF9' ) + self.chkF10 = self.find_widget(QtWidgets.QCheckBox , 'chkF10' ) + self.chkF11 = self.find_widget(QtWidgets.QCheckBox , 'chkF11' ) + self.chkF12 = self.find_widget(QtWidgets.QCheckBox , 'chkF12' ) + self.chkF13 = self.find_widget(QtWidgets.QCheckBox , 'chkF13' ) + self.chkF14 = self.find_widget(QtWidgets.QCheckBox , 'chkF14' ) + self.chkF15 = self.find_widget(QtWidgets.QCheckBox , 'chkF15' ) + self.chkF16 = self.find_widget(QtWidgets.QCheckBox , 'chkF16' ) + self.chkF17 = self.find_widget(QtWidgets.QCheckBox , 'chkF17' ) + self.chkF18 = self.find_widget(QtWidgets.QCheckBox , 'chkF18' ) + self.chkF19 = self.find_widget(QtWidgets.QCheckBox , 'chkF19' ) + self.chkF20 = self.find_widget(QtWidgets.QCheckBox , 'chkF20' ) + self.chkF21 = self.find_widget(QtWidgets.QCheckBox , 'chkF21' ) + self.chkF22 = self.find_widget(QtWidgets.QCheckBox , 'chkF22' ) + self.chkF23 = self.find_widget(QtWidgets.QCheckBox , 'chkF23' ) + self.chkF24 = self.find_widget(QtWidgets.QCheckBox , 'chkF24' ) + self.chkF25 = self.find_widget(QtWidgets.QCheckBox , 'chkF25' ) + self.chkF26 = self.find_widget(QtWidgets.QCheckBox , 'chkF26' ) + self.chkF27 = self.find_widget(QtWidgets.QCheckBox , 'chkF27' ) + self.chkF28 = self.find_widget(QtWidgets.QCheckBox , 'chkF28' ) + self.chkF29 = self.find_widget(QtWidgets.QCheckBox , 'chkF29' ) + self.chkF30 = self.find_widget(QtWidgets.QCheckBox , 'chkF30' ) + self.chkF31 = self.find_widget(QtWidgets.QCheckBox , 'chkF31' ) + self.chkF32 = self.find_widget(QtWidgets.QCheckBox , 'chkF32' ) + self.chkF33 = self.find_widget(QtWidgets.QCheckBox , 'chkF33' ) + self.chkF34 = self.find_widget(QtWidgets.QCheckBox , 'chkF34' ) + self.chkF35 = self.find_widget(QtWidgets.QCheckBox , 'chkF35' ) + self.chkF36 = self.find_widget(QtWidgets.QCheckBox , 'chkF36' ) + self.chkF37 = self.find_widget(QtWidgets.QCheckBox , 'chkF37' ) + self.chkF38 = self.find_widget(QtWidgets.QCheckBox , 'chkF38' ) + self.chkF39 = self.find_widget(QtWidgets.QCheckBox , 'chkF39' ) + + def _init_widgets(self): + """ + initializes the widgets' properties + :return: none + """ + pass + + def _init_connections(self): + """ + initializes the widgets connections + :return: + """ + self.btnAccept .clicked .connect(self.do_accept) + self.btnReject .clicked .connect(self.do_reject) + self.btnAcknow .clicked .connect(self.do_acknow) + self.chkF0 .stateChanged .connect(self.__check_floating_format_0 ) + self.chkF1 .stateChanged .connect(self.__check_floating_format_1 ) + self.chkF2 .stateChanged .connect(self.__check_floating_format_2 ) + self.chkF3 .stateChanged .connect(self.__check_floating_format_3 ) + self.chkF4 .stateChanged .connect(self.__check_floating_format_4 ) + self.chkF5 .stateChanged .connect(self.__check_floating_format_5 ) + self.chkF6 .stateChanged .connect(self.__check_floating_format_6 ) + self.chkF7 .stateChanged .connect(self.__check_floating_format_7 ) + self.chkF8 .stateChanged .connect(self.__check_floating_format_8 ) + self.chkF9 .stateChanged .connect(self.__check_floating_format_9 ) + self.chkF10 .stateChanged .connect(self.__check_floating_format_10) + self.chkF11 .stateChanged .connect(self.__check_floating_format_11) + self.chkF12 .stateChanged .connect(self.__check_floating_format_12) + self.chkF13 .stateChanged .connect(self.__check_floating_format_13) + self.chkF14 .stateChanged .connect(self.__check_floating_format_14) + self.chkF15 .stateChanged .connect(self.__check_floating_format_15) + self.chkF16 .stateChanged .connect(self.__check_floating_format_16) + self.chkF17 .stateChanged .connect(self.__check_floating_format_17) + self.chkF18 .stateChanged .connect(self.__check_floating_format_18) + self.chkF19 .stateChanged .connect(self.__check_floating_format_19) + self.chkF20 .stateChanged .connect(self.__check_floating_format_20) + self.chkF21 .stateChanged .connect(self.__check_floating_format_21) + self.chkF22 .stateChanged .connect(self.__check_floating_format_22) + self.chkF23 .stateChanged .connect(self.__check_floating_format_23) + self.chkF24 .stateChanged .connect(self.__check_floating_format_24) + self.chkF25 .stateChanged .connect(self.__check_floating_format_25) + self.chkF26 .stateChanged .connect(self.__check_floating_format_26) + self.chkF27 .stateChanged .connect(self.__check_floating_format_27) + self.chkF28 .stateChanged .connect(self.__check_floating_format_28) + self.chkF29 .stateChanged .connect(self.__check_floating_format_29) + self.chkF30 .stateChanged .connect(self.__check_floating_format_30) + self.chkF31 .stateChanged .connect(self.__check_floating_format_31) + self.chkF32 .stateChanged .connect(self.__check_floating_format_32) + self.chkF33 .stateChanged .connect(self.__check_floating_format_33) + self.chkF34 .stateChanged .connect(self.__check_floating_format_34) + self.chkF35 .stateChanged .connect(self.__check_floating_format_35) + self.chkF36 .stateChanged .connect(self.__check_floating_format_36) + self.chkF37 .stateChanged .connect(self.__check_floating_format_37) + self.chkF38 .stateChanged .connect(self.__check_floating_format_38) + self.chkF39 .stateChanged .connect(self.__check_floating_format_39) + + @staticmethod + def __set_spinbox_decimals(chk: QtWidgets.QCheckBox, spn: QtWidgets.QDoubleSpinBox): + if chk.checkState() == 0: + spn.setDecimals(0) + else: + spn.setDecimals(3) + + def __check_floating_format_0 (self): Loader.__set_spinbox_decimals(self.chkP0 , self.spnP0 ) + def __check_floating_format_1 (self): Loader.__set_spinbox_decimals(self.chkP1 , self.spnP1 ) + def __check_floating_format_2 (self): Loader.__set_spinbox_decimals(self.chkP2 , self.spnP2 ) + def __check_floating_format_3 (self): Loader.__set_spinbox_decimals(self.chkP3 , self.spnP3 ) + def __check_floating_format_4 (self): Loader.__set_spinbox_decimals(self.chkP4 , self.spnP4 ) + def __check_floating_format_5 (self): Loader.__set_spinbox_decimals(self.chkP5 , self.spnP5 ) + def __check_floating_format_6 (self): Loader.__set_spinbox_decimals(self.chkP6 , self.spnP6 ) + def __check_floating_format_7 (self): Loader.__set_spinbox_decimals(self.chkP7 , self.spnP7 ) + def __check_floating_format_8 (self): Loader.__set_spinbox_decimals(self.chkP8 , self.spnP8 ) + def __check_floating_format_9 (self): Loader.__set_spinbox_decimals(self.chkP9 , self.spnP9 ) + def __check_floating_format_10(self): Loader.__set_spinbox_decimals(self.chkP10, self.spnP10) + def __check_floating_format_11(self): Loader.__set_spinbox_decimals(self.chkP11, self.spnP11) + def __check_floating_format_12(self): Loader.__set_spinbox_decimals(self.chkP12, self.spnP12) + def __check_floating_format_13(self): Loader.__set_spinbox_decimals(self.chkP13, self.spnP13) + def __check_floating_format_14(self): Loader.__set_spinbox_decimals(self.chkP14, self.spnP14) + def __check_floating_format_15(self): Loader.__set_spinbox_decimals(self.chkP15, self.spnP15) + def __check_floating_format_16(self): Loader.__set_spinbox_decimals(self.chkP16, self.spnP16) + def __check_floating_format_17(self): Loader.__set_spinbox_decimals(self.chkP17, self.spnP17) + def __check_floating_format_18(self): Loader.__set_spinbox_decimals(self.chkP18, self.spnP18) + def __check_floating_format_19(self): Loader.__set_spinbox_decimals(self.chkP19, self.spnP19) + def __check_floating_format_20(self): Loader.__set_spinbox_decimals(self.chkP20, self.spnP20) + def __check_floating_format_21(self): Loader.__set_spinbox_decimals(self.chkP21, self.spnP21) + def __check_floating_format_22(self): Loader.__set_spinbox_decimals(self.chkP22, self.spnP22) + def __check_floating_format_23(self): Loader.__set_spinbox_decimals(self.chkP23, self.spnP23) + def __check_floating_format_24(self): Loader.__set_spinbox_decimals(self.chkP24, self.spnP24) + def __check_floating_format_25(self): Loader.__set_spinbox_decimals(self.chkP25, self.spnP25) + def __check_floating_format_26(self): Loader.__set_spinbox_decimals(self.chkP26, self.spnP26) + def __check_floating_format_27(self): Loader.__set_spinbox_decimals(self.chkP27, self.spnP27) + def __check_floating_format_28(self): Loader.__set_spinbox_decimals(self.chkP28, self.spnP28) + def __check_floating_format_29(self): Loader.__set_spinbox_decimals(self.chkP29, self.spnP29) + def __check_floating_format_30(self): Loader.__set_spinbox_decimals(self.chkP30, self.spnP30) + def __check_floating_format_31(self): Loader.__set_spinbox_decimals(self.chkP31, self.spnP31) + def __check_floating_format_32(self): Loader.__set_spinbox_decimals(self.chkP32, self.spnP32) + def __check_floating_format_33(self): Loader.__set_spinbox_decimals(self.chkP33, self.spnP33) + def __check_floating_format_34(self): Loader.__set_spinbox_decimals(self.chkP34, self.spnP34) + def __check_floating_format_35(self): Loader.__set_spinbox_decimals(self.chkP35, self.spnP35) + def __check_floating_format_36(self): Loader.__set_spinbox_decimals(self.chkP36, self.spnP36) + def __check_floating_format_37(self): Loader.__set_spinbox_decimals(self.chkP37, self.spnP37) + def __check_floating_format_38(self): Loader.__set_spinbox_decimals(self.chkP38, self.spnP38) + def __check_floating_format_39(self): Loader.__set_spinbox_decimals(self.chkP39, self.spnP39) + + def _make_parameters_payload(self): + self.parameters_payload_len = 0 + self.parameters_payload = 0x00 + if self.chkP0.isChecked(): + if self.chkF0.isChecked(): + self.parameters_payload = conversions.float_to_bytearray(self.spnP0.value()) + else: + self.parameters_payload = conversions.integer_to_bytearray(int(self.spnP0.value())) + self.parameters_payload_len = 1 + if self.chkP1.isChecked(): + if self.chkF1.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP1.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP1.value())) + self.parameters_payload_len = 2 + if self.chkP2.isChecked(): + if self.chkF2.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP2.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP2.value())) + self.parameters_payload_len = 3 + if self.chkP3.isChecked(): + if self.chkF3.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP3.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP3.value())) + self.parameters_payload_len = 4 + if self.chkP4.isChecked(): + if self.chkF4.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP4.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP4.value())) + self.parameters_payload_len = 5 + if self.chkP5.isChecked(): + if self.chkF5.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP5.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP5.value())) + self.parameters_payload_len = 6 + if self.chkP6.isChecked(): + if self.chkF6.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP6.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP6.value())) + self.parameters_payload_len = 7 + if self.chkP7.isChecked(): + if self.chkF7.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP7.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP7.value())) + self.parameters_payload_len = 8 + if self.chkP8.isChecked(): + if self.chkF8.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP8.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP8.value())) + self.parameters_payload_len = 9 + if self.chkP9.isChecked(): + if self.chkF9.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP9.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP9.value())) + self.parameters_payload_len = 10 + if self.chkP10.isChecked(): + if self.chkF10.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP10.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP10.value())) + self.parameters_payload_len = 11 + if self.chkP11.isChecked(): + if self.chkF11.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP11.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP11.value())) + self.parameters_payload_len = 12 + if self.chkP12.isChecked(): + if self.chkF12.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP12.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP12.value())) + self.parameters_payload_len = 13 + if self.chkP13.isChecked(): + if self.chkF13.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP13.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP13.value())) + self.parameters_payload_len = 14 + if self.chkP14.isChecked(): + if self.chkF14.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP14.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP14.value())) + self.parameters_payload_len = 15 + if self.chkP15.isChecked(): + if self.chkF15.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP15.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP15.value())) + self.parameters_payload_len = 16 + if self.chkP16.isChecked(): + if self.chkF16.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP16.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP16.value())) + self.parameters_payload_len = 17 + if self.chkP17.isChecked(): + if self.chkF17.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP17.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP17.value())) + self.parameters_payload_len = 18 + if self.chkP18.isChecked(): + if self.chkF18.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP18.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP18.value())) + self.parameters_payload_len = 19 + if self.chkP19.isChecked(): + if self.chkF19.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP19.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP19.value())) + self.parameters_payload_len = 20 + if self.chkP20.isChecked(): + if self.chkF20.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP20.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP20.value())) + self.parameters_payload_len = 21 + if self.chkP21.isChecked(): + if self.chkF21.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP21.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP21.value())) + self.parameters_payload_len = 22 + if self.chkP22.isChecked(): + if self.chkF22.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP22.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP22.value())) + self.parameters_payload_len = 23 + if self.chkP23.isChecked(): + if self.chkF23.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP23.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP23.value())) + self.parameters_payload_len = 24 + if self.chkP24.isChecked(): + if self.chkF24.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP24.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP24.value())) + self.parameters_payload_len = 25 + if self.chkP25.isChecked(): + if self.chkF25.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP25.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP25.value())) + self.parameters_payload_len = 26 + if self.chkP26.isChecked(): + if self.chkF26.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP26.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP26.value())) + self.parameters_payload_len = 27 + if self.chkP27.isChecked(): + if self.chkF27.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP27.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP27.value())) + self.parameters_payload_len = 28 + if self.chkP28.isChecked(): + if self.chkF28.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP28.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP28.value())) + self.parameters_payload_len = 29 + if self.chkP29.isChecked(): + if self.chkF29.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP29.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP29.value())) + self.parameters_payload_len = 30 + if self.chkP30.isChecked(): + if self.chkF30.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP30.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP30.value())) + self.parameters_payload_len = 31 + if self.chkP31.isChecked(): + if self.chkF31.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP31.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP31.value())) + self.parameters_payload_len = 32 + if self.chkP32.isChecked(): + if self.chkF32.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP32.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP32.value())) + self.parameters_payload_len = 33 + if self.chkP33.isChecked(): + if self.chkF33.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP33.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP33.value())) + self.parameters_payload_len = 34 + if self.chkP34.isChecked(): + if self.chkF34.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP34.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP34.value())) + self.parameters_payload_len = 35 + if self.chkP35.isChecked(): + if self.chkF35.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP35.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP35.value())) + self.parameters_payload_len = 36 + if self.chkP36.isChecked(): + if self.chkF36.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP36.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP36.value())) + self.parameters_payload_len = 37 + if self.chkP37.isChecked(): + if self.chkF37.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP37.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP37.value())) + self.parameters_payload_len = 38 + if self.chkP38.isChecked(): + if self.chkF38.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP38.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP38.value())) + self.parameters_payload_len = 39 + if self.chkP39.isChecked(): + if self.chkF39.isChecked(): + self.parameters_payload += conversions.float_to_bytearray(self.spnP39.value()) + else: + self.parameters_payload += conversions.integer_to_bytearray(int(self.spnP39.value())) + self.parameters_payload_len = 40 + + + def do_send(self, accpeted: bool): + """ + the slot for reject button + :return: none + """ + channel_id = self.spnChannelID.value() + message_id = self.spnMessageID.value() + reason = self.spnReason.value() + self._make_parameters_payload() + + if self.rbTD.isChecked(): + if channel_id == 0: channel_id=CAN.DenaliChannels.td_to_ui_ch_id + else: + if channel_id == 0: channel_id=CAN.DenaliChannels.dd_sync_broadcast_ch_id + + self.td_interface.cmd_send_general_response( + message_id, + accpeted, + reason, + self.chkData.isChecked(), + self.parameters_payload_len > 0, + self.parameters_payload, + channel_id + ) + + if accpeted: + self.lblAction.setText('Accepted ') + else: + self.lblAction.setText('Rejected ' + "{}".format(reason)) + + + + @Slot() + def do_accept(self): + """ + the slot for accept button + :return: none + """ + self.do_send(True) + + @Slot() + def do_reject(self): + """ + the slot for reject button + :return: none + """ + self.do_send(False) + + @Slot() + def do_acknow(self): + """ + sends the message acknowledge by the sequence number spnSequence + :return: None + """ + seq = self.spnSequence.value() + if self.rbTD.isChecked(): + self.interface.hd.cmd_send_hd_ack(seq) + else: + self.interface.dg.cmd_send_dg_ack(seq) Index: TD_OpMode/loader.py =================================================================== diff -u -rc81cc70c3e01faf81396c4c891509471eb4fffb5 -r64d8a48a84b8b1bacd24876d1e49d77f8792fb72 --- TD_OpMode/loader.py (.../loader.py) (revision c81cc70c3e01faf81396c4c891509471eb4fffb5) +++ TD_OpMode/loader.py (.../loader.py) (revision 64d8a48a84b8b1bacd24876d1e49d77f8792fb72) @@ -15,7 +15,7 @@ from leahi_dialin.common.td_defs import TDOpModes from leahi_dialin.common.td_defs import TDStandbyStates -# hd Simulator +# dialin from leahi_dialin.ui.td_messaging import TD_Messaging Index: TreatmentParameters/interface.ui =================================================================== diff -u --- TreatmentParameters/interface.ui (revision 0) +++ TreatmentParameters/interface.ui (revision 64d8a48a84b8b1bacd24876d1e49d77f8792fb72) @@ -0,0 +1,676 @@ + + + ui_interface + + + + 0 + 0 + 756 + 397 + + + + &2 Pre-Treatment/&1 Create Rx + + + + + + + + Standby + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Create + + + + + + + Reason + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 100 + 16777215 + + + + Validate + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Confirm + + + + + + + + + + + + + Blood Flow Rate + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Dialysate Flow Rate + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Treatment Duration + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Saline Bolus Volume + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Heparin Stop Time + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Heparin Type + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Acid Concentrate + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Bicarbonate Concentrate + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Dialyzer Type + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Blood Pressure Measure Interval + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + + + + + Rinseback Flow Rate + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Rinseback Volume + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Arterial Pressure Limit Window + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Venous Pressure Limit Window + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Venous Pressure Limit Asymtrc + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Trancemembrance Pressure Limit Window + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Dialysate Temp + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Heparin Dispensing Rate + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + Heparin Bolus Volume + + + + + + + + 100 + 16777215 + + + + -2147483647 + + + 2147483647 + + + 3 + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 10 + + + + color: rgb(238, 238, 236); +background-color:rgb(173, 127, 168) + + + Treatment Parameters - Create Rx + + + Qt::AlignCenter + + + + + + + btnValidate + + + + Index: TreatmentParameters/loader.py =================================================================== diff -u --- TreatmentParameters/loader.py (revision 0) +++ TreatmentParameters/loader.py (revision 64d8a48a84b8b1bacd24876d1e49d77f8792fb72) @@ -0,0 +1,189 @@ +""" +The ui loader class +""" +# Python +import os + +# Qt +from PySide2 import QtWidgets +from PySide2.QtCore import Slot + +# parent +from engine.dynamicloader import DynamicLoader + +# plugin specific + +# dialin +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.td_defs import TDOpModes +from leahi_dialin.common.td_defs import TDStandbyStates +from leahi_dialin.utils import conversions +from leahi_dialin.protocols import CAN + + +class Loader(DynamicLoader): + """ + The ui loader class + """ + + 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.btnStandby = self.find_widget(QtWidgets.QPushButton, 'btnStandby' ) + self.btnCreate = self.find_widget(QtWidgets.QPushButton, 'btnCreate' ) + self.btnCreateReset = self.find_widget(QtWidgets.QToolButton, 'btnCreateReset' ) + self.btnValidate = self.find_widget(QtWidgets.QPushButton, 'btnValidate' ) + self.btnValidateReset = self.find_widget(QtWidgets.QToolButton, 'btnValidateReset' ) + self.btnConfirm = self.find_widget(QtWidgets.QPushButton, 'btnConfirm' ) + + self.spnCreateRxRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnCreateRxRejectReason' ) + + self.spnBloodFlowRateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnBloodFlowRateRejectReason' ) + self.spnDialysateFlowRateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnDialysateFlowRateRejectReason' ) + self.spnTreatmentDurationRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnTreatmentDurationRejectReason' ) + self.spnSalineBolusVolumeRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnSalineBolusVolumeRejectReason' ) + self.spnHeparinStopTimeRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnHeparinStopTimeRejectReason' ) + self.spnHeparinTypeRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnHeparinTypeRejectReason' ) + self.spnAcidConcentrateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnAcidConcentrateRejectReason' ) + self.spnBicarbonateConcentrateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnBicarbonateConcentrateRejectReason' ) + self.spnDialyzerTypeRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnDialyzerTypeRejectReason' ) + self.spnBloodPressureMeasureIntervalRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnBloodPressureMeasureIntervalRejectReason' ) + self.spnRinsebackFlowRateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnRinsebackFlowRateRejectReason' ) + self.spnRinsebackVolumeRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnRinsebackVolumeRejectReason' ) + self.spnArterialPressureLimitWindowRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnArterialPressureLimitWindowRejectReason' ) + self.spnVenousPressureLimitWindowRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnVenousPressureLimitWindowRejectReason' ) + self.spnVenousPressureLimitAsymtrcRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnVenousPressureLimitAsymtrcRejectReason' ) + self.spnTrancembrncPressureLimitWindowRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnTrancembrncPressureLimitWindowRejectReason' ) + self.spnDialysateTempRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnDialysateTempRejectReason' ) + self.spnHeparinDispensingRateRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnHeparinDispensingRateRejectReason' ) + self.spnHeparinBolusVolumeRejectReason = self.find_widget(QtWidgets.QSpinBox , 'spnHeparinBolusVolumeRejectReason' ) + + + def _init_widgets(self): + """ + initializes the widgets' properties + :return: none + """ + pass + + def _init_connections(self): + """ + initializes the widgets connections + :return: + """ + self.btnStandby .clicked.connect(self.do_standby ) + self.btnCreate .clicked.connect(self.do_create ) + self.btnCreateReset .clicked.connect(self.do_createReset ) + self.btnValidate .clicked.connect(self.do_validate ) + self.btnValidateReset .clicked.connect(self.do_validateReset ) + self.btnConfirm .clicked.connect(self.do_confirm ) + + @Slot() + def do_standby(self): + self.td_interface.td_operation_mode( + TDOpModes.MODE_STAN.value, + TDStandbyStates.STANDBY_WAIT_FOR_TREATMENT_STATE.value + ) + + @Slot() + def do_create(self): + if self.spnCreateRxRejectReason.value() == 0 : + self.td_interface.td_Treatment_Parameters_CreateRx (0) + self.td_interface.td_operation_mode( + TDOpModes.MODE_TPAR.value, + TDStandbyStates.STANDBY_WAIT_FOR_TREATMENT_STATE.value + ) + else: + self.td_interface.td_Treatment_Parameters_CreateRx (self.spnCreateRxRejectReason.value()) + + @Slot() + def do_createReset(self): + self.spnCreateRxRejectReason.setValue(0) + + @Slot() + def do_confirm(self): + self.td_interface.td_operation_mode( + TDOpModes.MODE_PRET.value, + TDStandbyStates.STANDBY_WAIT_FOR_TREATMENT_STATE.value + ) + + @Slot() + def do_validate(self): + """ + send the validation response message + :return: none + """ + accepted = ( + self.spnBloodFlowRateRejectReason .value() + + self.spnDialysateFlowRateRejectReason .value() + + self.spnTreatmentDurationRejectReason .value() + + self.spnSalineBolusVolumeRejectReason .value() + + self.spnHeparinStopTimeRejectReason .value() + + self.spnHeparinTypeRejectReason .value() + + self.spnAcidConcentrateRejectReason .value() + + self.spnBicarbonateConcentrateRejectReason .value() + + self.spnDialyzerTypeRejectReason .value() + + self.spnBloodPressureMeasureIntervalRejectReason .value() + + self.spnRinsebackFlowRateRejectReason .value() + + self.spnRinsebackVolumeRejectReason .value() + + self.spnArterialPressureLimitWindowRejectReason .value() + + self.spnVenousPressureLimitWindowRejectReason .value() + + self.spnVenousPressureLimitAsymtrcRejectReason .value() + + self.spnTrancembrncPressureLimitWindowRejectReason .value() + + self.spnDialysateTempRejectReason .value() + + self.spnHeparinDispensingRateRejectReason .value() + + self.spnHeparinBolusVolumeRejectReason .value() + ) == 0 + + self.td_interface.td_Treatment_Parameters_Validation( + 1 if accepted else 0, + self.spnBloodFlowRateRejectReason .value(), + self.spnDialysateFlowRateRejectReason .value(), + self.spnTreatmentDurationRejectReason .value(), + self.spnSalineBolusVolumeRejectReason .value(), + self.spnHeparinStopTimeRejectReason .value(), + self.spnHeparinTypeRejectReason .value(), + self.spnAcidConcentrateRejectReason .value(), + self.spnBicarbonateConcentrateRejectReason .value(), + self.spnDialyzerTypeRejectReason .value(), + self.spnBloodPressureMeasureIntervalRejectReason .value(), + self.spnRinsebackFlowRateRejectReason .value(), + self.spnRinsebackVolumeRejectReason .value(), + self.spnArterialPressureLimitWindowRejectReason .value(), + self.spnVenousPressureLimitWindowRejectReason .value(), + self.spnVenousPressureLimitAsymtrcRejectReason .value(), + self.spnTrancembrncPressureLimitWindowRejectReason .value(), + self.spnDialysateTempRejectReason .value(), + self.spnHeparinDispensingRateRejectReason .value(), + self.spnHeparinBolusVolumeRejectReason .value() + ) + + + @Slot() + def do_validateReset(self): + self.spnBloodFlowRateRejectReason .setValue(0) + self.spnDialysateFlowRateRejectReason .setValue(0) + self.spnTreatmentDurationRejectReason .setValue(0) + self.spnSalineBolusVolumeRejectReason .setValue(0) + self.spnHeparinStopTimeRejectReason .setValue(0) + self.spnHeparinTypeRejectReason .setValue(0) + self.spnAcidConcentrateRejectReason .setValue(0) + self.spnBicarbonateConcentrateRejectReason .setValue(0) + self.spnDialyzerTypeRejectReason .setValue(0) + self.spnBloodPressureMeasureIntervalRejectReason .setValue(0) + self.spnRinsebackFlowRateRejectReason .setValue(0) + self.spnRinsebackVolumeRejectReason .setValue(0) + self.spnArterialPressureLimitWindowRejectReason .setValue(0) + self.spnVenousPressureLimitWindowRejectReason .setValue(0) + self.spnVenousPressureLimitAsymtrcRejectReason .setValue(0) + self.spnTrancembrncPressureLimitWindowRejectReason .setValue(0) + self.spnDialysateTempRejectReason .setValue(0) + self.spnHeparinDispensingRateRejectReason .setValue(0) + self.spnHeparinBolusVolumeRejectReason .setValue(0) \ No newline at end of file