[bugfix] 修复channel按钮无法切换filters异常

This commit is contained in:
Sam 2025-02-25 20:10:53 +08:00
parent a648da50a5
commit 10bc056c39
9 changed files with 14 additions and 10 deletions

2
app.py
View File

@ -238,7 +238,7 @@ class MainWindow(QWidget):
item = self.widget_main.ui.verticalLayout_Filter.takeAt(0)
if item.widget():
item.widget().hide()
print(f"on_channel_btn_clicked: {channel_id}")
# Add the selected channel's filter widget to the layout
filter_widget = self.widget_filter_list[channel_id]
self.widget_main.ui.verticalLayout_Filter.addWidget(filter_widget)

View File

@ -2387,10 +2387,10 @@ class Ui_Widget(object):
self.gridLayout_4.setObjectName(u"gridLayout_4")
self.gridLayout_4.setVerticalSpacing(4)
self.gridLayout_4.setContentsMargins(-1, 14, -1, 4)
self.pushButton_7pushButton_Channel_CH4 = QPushButton(self.groupBox_CH4)
self.pushButton_7pushButton_Channel_CH4.setObjectName(u"pushButton_7pushButton_Channel_CH4")
self.pushButton_Channel_CH4 = QPushButton(self.groupBox_CH4)
self.pushButton_Channel_CH4.setObjectName(u"pushButton_Channel_CH4")
self.gridLayout_4.addWidget(self.pushButton_7pushButton_Channel_CH4, 0, 0, 1, 2)
self.gridLayout_4.addWidget(self.pushButton_Channel_CH4, 0, 0, 1, 2)
self.pushButton_8 = QPushButton(self.groupBox_CH4)
self.pushButton_8.setObjectName(u"pushButton_8")
@ -2929,7 +2929,7 @@ class Ui_Widget(object):
self.pushButton_6.setText(QCoreApplication.translate("Widget", u"SOLO", None))
self.checkBox_3.setText(QCoreApplication.translate("Widget", u"Mute", None))
self.groupBox_CH4.setTitle(QCoreApplication.translate("Widget", u"CH4", None))
self.pushButton_7pushButton_Channel_CH4.setText(QCoreApplication.translate("Widget", u"Channel 4", None))
self.pushButton_Channel_CH4.setText(QCoreApplication.translate("Widget", u"Channel 4", None))
self.pushButton_8.setText(QCoreApplication.translate("Widget", u"SOLO", None))
self.checkBox_4.setText(QCoreApplication.translate("Widget", u"Mute", None))
self.groupBox_CH5.setTitle(QCoreApplication.translate("Widget", u"CH5", None))

View File

@ -2380,7 +2380,7 @@ PlotWidget {
<number>4</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_7pushButton_Channel_CH4">
<widget class="QPushButton" name="pushButton_Channel_CH4">
<property name="text">
<string>Channel 4</string>
</property>

View File

@ -22,7 +22,7 @@ class Widget_Channel(QWidget):
self.channel_counts = 24
# 设置连接
# self.setup_connections()
self.setup_connections()
self.visible_channels = 24 # 默认显示24个通道
self.update_channel_visibility()
@ -52,7 +52,11 @@ class Widget_Channel(QWidget):
# 调整布局
self.adjustSize()
# def setup_connections(self):
def setup_connections(self):
for i in range(self.channel_counts):
channel_btn = getattr(self.ui, f'pushButton_Channel_CH{i+1}')
if channel_btn:
channel_btn.clicked.connect(lambda checked, index=i: self.channel_btn_clicked.emit(index))
# Connect channel buttons using a loop
# for i in range(self.channel_counts):
# Connect Channel buttons

View File

@ -2373,7 +2373,7 @@ class Ui_Main_Widget(object):
self.horizontalLayout_3.addLayout(self.verticalLayout_Filter)
self.horizontalLayout_3.setStretch(0, 2)
self.horizontalLayout_3.setStretch(0, 3)
self.horizontalLayout_3.setStretch(1, 5)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)

View File

@ -2309,7 +2309,7 @@ PlotWidget {
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="2,5">
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="3,5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_Log"/>
</item>