Check bugs and restyling

This commit is contained in:
SimonovaMI 2025-05-15 14:00:13 +03:00
parent 97c6be4e8d
commit 3ba20568c4
6 changed files with 2475 additions and 2175 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@ class Ui(QtWidgets.QMainWindow):
super(Ui, self).__init__()
uic.loadUi('design_viewer.ui', self)
self.setWindowTitle("Pacemaker viewer")
self.setWindowIcon(QtGui.QIcon("logo.ICO"))
self.setWindowIcon(QtGui.QIcon("source/logo.ICO"))
self.counter_com_port = [] # координата x для вывода графиков
@ -61,6 +61,8 @@ class Ui(QtWidgets.QMainWindow):
self.horizontalScrollBar.setVisible(False)
self.horizontalScrollBar.valueChanged.connect(self.on_scroll)
self.radioButton_work_mode_com_port.toggled.connect(self.check_work_mode_viewer)
self.Play.clicked.connect(self.on_play)
self.Pause.clicked.connect(self.on_pause)
self.OpenB.clicked.connect(self.on_open)
self.CloseB.clicked.connect(self.on_close)
self.Write_file.clicked.connect(self.write_file)
@ -70,12 +72,12 @@ class Ui(QtWidgets.QMainWindow):
self.Restart.clicked.connect(self.restart)
self.SD_card_Box.currentTextChanged.connect(self.set_SD_card)
self.Send_mode_Box.currentTextChanged.connect(self.set_send_mode)
self.ComL.addItems(self.update_list())
self.Port_ch.addItems(self.update_list())
self.horizontalScrollBar.valueChanged.connect(self.on_scroll)
self.RA_scale_BOX.currentTextChanged.connect(self.on_scale_change)
self.Low_V_spinBox.valueChanged.connect(self.set_fibr_cnt_max)
self.Low_V_spinBox_3.valueChanged.connect(self.set_tachy_2_cnt_max)
self.Low_V_spinBox_4.valueChanged.connect(self.set_tachy_1_cnt_max)
self.f_count_spinBox.valueChanged.connect(self.set_fibr_cnt_max)
self.t2_count_spinBox.valueChanged.connect(self.set_tachy_2_cnt_max)
self.t1_count_spinBox.valueChanged.connect(self.set_tachy_1_cnt_max)
self.RA_max_time_ms_BOX.editTextChanged.connect(self.set_RA_max_time_ms_BOX)
self.RA_min_sensitivity_BOX.editTextChanged.connect(self.set_RA_min_sensitivity_BOX)
@ -90,12 +92,13 @@ class Ui(QtWidgets.QMainWindow):
self.High_Tf_spinBox.valueChanged.connect(self.set_High_Tf_spinBox)
self.High_Tt2_spinBox.valueChanged.connect(self.set_High_Tt2_spinBox)
self.High_Tt1_spinBox.valueChanged.connect(self.set_High_Tt1_spinBox)
self.Low_V_spinBox.valueChanged.connect(self.set_Low_V_spinBox)
self.f_count_spinBox.valueChanged.connect(self.set_f_count_spinBox)
self.Work_Mode_pacemaker.editTextChanged.connect(self.set_Work_Mode_pacemaker)
self.hv_step_number_spinBox.valueChanged.connect(self.set_hv_step_number_spinBox)
self.min_energy_spinBox.valueChanged.connect(self.set_min_energy_spinBox)
self.max_energy_spinBox.valueChanged.connect(self.set_max_energy_spinBox)
self.cap_polarity_BOX.editTextChanged.connect(self.set_cap_polarity_BOX)
self.hv_blind_time_spinBox.valueChanged.connect(self.set_hv_blind_time_spinBox)
self.standby_timer_spinBox.valueChanged.connect(self.set_standby_timer_spinBox)
self.redet_num_spinBox.valueChanged.connect(self.set_redet_num_spinBox)
@ -109,7 +112,7 @@ class Ui(QtWidgets.QMainWindow):
self.serial.setBaudRate(115200)
self.serial.readyRead.connect(self.on_read)
self.send_mode = 0
self.send_mode = 1
# Создание таймера для отрисовки графиков
self.timer = QtCore.QTimer()
@ -168,7 +171,7 @@ class Ui(QtWidgets.QMainWindow):
self.High_Tf_spinBox.setValue(data_in.fibr_tres)
self.High_Tt2_spinBox.setValue(data_in.tachy_2_tres)
self.High_Tt1_spinBox.setValue(data_in.tachy_1_tres)
self.Low_V_spinBox.setValue(data_in.fibr_max_tres)
self.f_count_spinBox.setValue(data_in.fibr_max_tres)
self.hv_step_number_spinBox.setValue(data_in.hv_step_number)
self.min_energy_spinBox.setValue(data_in.min_energy)
self.max_energy_spinBox.setValue(data_in.max_energy)
@ -184,7 +187,10 @@ class Ui(QtWidgets.QMainWindow):
self.draw_data(data_IN_COM)
if MODE_FILE:
scale = self.get_scale()
data_IN_FILE.data_length = scale * my_data.DATA_RATE
points_count = scale * my_data.DATA_RATE
if points_count < data_IN_FILE.data_length:
data_IN_FILE.data_length = points_count
self.horizontalScrollBar.setValue(data_IN_FILE.i)
data_IN_FILE.parse_list(data_IN_FILE.chunk[data_IN_FILE.i:data_IN_FILE.i + 640])
data_IN_FILE.i += 640
self.graph_1.setXRange(self.counter_com_port[0], self.counter_com_port[0] + scale)
@ -197,11 +203,11 @@ class Ui(QtWidgets.QMainWindow):
def on_start(self):
"""
Старт обменя с com-портом
Старт обмена с com-портом
"""
global MODE_COM_PORT
data_IN_COM.clear_data()
self.serial.setPortName(self.ComL.currentText())
self.serial.setPortName(self.Port_ch.currentText())
self.serial.open(QIODevice.ReadWrite)
self.serial.flush()
self.serial.write(mes.encode())
@ -386,13 +392,32 @@ class Ui(QtWidgets.QMainWindow):
self.on_close()
file, _ = QFileDialog.getOpenFileName(self, 'Open File')
if file:
self.timer.start()
self.timer_LS.start()
data_IN_FILE.clear_data()
self.file_name = file
self.Fname_label.setText(self.file_name)
my_data.get_data_bin(self.file_name, data_IN_FILE)
self.counter_com_port = list(map(lambda x: x / my_data.DATA_RATE, range(0, data_IN_FILE.data_length)))
self.horizontalScrollBar.setMinimum(0)
self.horizontalScrollBar.setMaximum(len(data_IN_FILE.chunk))
MODE_FILE = True
def on_play(self):
"""
Запустить отрисовку
"""
self.timer.start()
self.timer_LS.start()
def on_pause(self):
"""
Остановить отрисовку
"""
self.timer.stop()
self.timer_LS.stop()
def draw_file(self):
scale = self.get_scale()
size = scale * my_data.DATA_RATE
@ -411,7 +436,9 @@ class Ui(QtWidgets.QMainWindow):
scale = self.get_scale()
if len(data_IN_FILE.counter) != 0:
position = self.horizontalScrollBar.value()
self.point = int((len(data_IN_FILE.counter) / my_data.DATA_RATE) * (position / 1000))
# self.point = int((len(data_IN_FILE.counter) / my_data.DATA_RATE) * (position / 1000))
# data_IN_FILE.i = self.point
data_IN_FILE.i = position
def on_scroll(self):
self.re_scale()
@ -467,9 +494,9 @@ class Ui(QtWidgets.QMainWindow):
self.CloseB.setVisible(False)
self.Play.setVisible(False)
self.Pause.setVisible(False)
self.Fname_label_com_port.setVisible(True)
self.label_com_port.setVisible(True)
self.Fname_w_label.setVisible(True)
self.ComL.setVisible(True)
self.Port_ch.setVisible(True)
self.Read.setVisible(True)
self.Stop.setVisible(True)
self.Write_file.setVisible(True)
@ -482,9 +509,9 @@ class Ui(QtWidgets.QMainWindow):
self.CloseB.setVisible(True)
self.Play.setVisible(True)
self.Pause.setVisible(True)
self.Fname_label_com_port.setVisible(False)
self.label_com_port.setVisible(False)
self.Fname_w_label.setVisible(False)
self.ComL.setVisible(False)
self.Port_ch.setVisible(False)
self.Read.setVisible(False)
self.Stop.setVisible(False)
self.Write_file.setVisible(False)
@ -572,9 +599,9 @@ class Ui(QtWidgets.QMainWindow):
param = self.High_Tt1_spinBox.value()
my_data.state_packet(self.send_mode, self.serial, 0x12, param, 2, int)
def set_Low_V_spinBox(self):
def set_f_count_spinBox(self):
"""Установка порога корзины фибрилляции"""
param = self.Low_V_spinBox.value()
param = self.f_count_spinBox.value()
my_data.state_packet(self.send_mode, self.serial, 0x13, param, 1, int)
def set_hv_step_number_spinBox(self):
@ -615,12 +642,31 @@ class Ui(QtWidgets.QMainWindow):
def set_fibr_cnt_max(self):
"""Визуализация корзины фибрилляции"""
# + отправить стимулятору
self.progressBar_f.setMaximum(self.Low_V_spinBox.value())
self.progressBar_f.setMaximum(self.f_count_spinBox.value())
def set_tachy_2_cnt_max(self):
"""Визуализация корзины тахикардии 2ст"""
self.progressBar_t2.setMaximum(self.Low_V_spinBox_3.value())
self.progressBar_t2.setMaximum(self.t2_count_spinBox.value())
def set_tachy_1_cnt_max(self):
"""Визуализация корзины тахикардии 1ст"""
self.progressBar_t1.setMaximum(self.Low_V_spinBox_4.value())
self.progressBar_t1.setMaximum(self.t1_count_spinBox.value())
def set_cap_polarity_BOX(self):
"""Выбор полярности"""
param = self.cap_polarity_BOX.currentIndex()
match param:
case 0:
self.picture_1.setVisible(True)
self.picture_2.setVisible(False)
self.picture_3.setVisible(False)
case 1:
self.picture_2.setVisible(True)
self.picture_1.setVisible(False)
self.picture_3.setVisible(False)
case 2:
self.picture_3.setVisible(True)
self.picture_1.setVisible(False)
self.picture_2.setVisible(False)

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
source/pol_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
source/pol_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
source/pol_3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB