From bfcb65f56afe4413bf273bb3c75e0b395e72e20a Mon Sep 17 00:00:00 2001 From: KenanZhu <3471685733@qq.com> Date: Wed, 31 Dec 2025 10:15:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(gui.ALMainWindow):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=86=20setControlButtons=20=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=8C=89=E9=92=AE=E7=8A=B6=E6=80=81=E7=9A=84?= =?UTF-8?q?=E6=84=8F=E5=A4=96=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui/ALMainWindow.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/ALMainWindow.py b/src/gui/ALMainWindow.py index 0b11dce..3e90d5c 100644 --- a/src/gui/ALMainWindow.py +++ b/src/gui/ALMainWindow.py @@ -260,9 +260,13 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow): start_button_enabled: bool ): - self.ConfigButton.setEnabled(config_button_enabled) - self.StopButton.setEnabled(stop_button_enabled) - self.StartButton.setEnabled(start_button_enabled) + # if the enable is None, then keep the original state + if config_button_enabled is not None: + self.ConfigButton.setEnabled(config_button_enabled) + if stop_button_enabled is not None: + self.StopButton.setEnabled(stop_button_enabled) + if start_button_enabled is not None: + self.StartButton.setEnabled(start_button_enabled) @Slot() def showMsg( @@ -310,7 +314,7 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow): self.__alConfigWidget.configWidgetCloseSingal.disconnect(self.onConfigWidgetClosed) self.__alConfigWidget.deleteLater() self.__alConfigWidget = None - self.setControlButtons(True, False, True) + self.setControlButtons(True, None, None) self.__config_paths = config_paths @Slot(dict) @@ -332,7 +336,7 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow): self.__current_timer_task_thread.finishedSignal_TimerWorker.disconnect(self.onTimerTaskFinished) self.__current_timer_task_thread.deleteLater() self.__current_timer_task_thread = None - self.setControlButtons(True, False, True) + self.setControlButtons(None, False, True) self.__is_running_timer_task = False self.__timer_task_timer.start(500) timer_task["executed"] = True @@ -381,7 +385,7 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow): self ): - self.setControlButtons(True, True, False) + self.setControlButtons(None, True, False) if self.__auto_lib_thread is None: self.__auto_lib_thread = AutoLibWorker( self.__input_queue, @@ -405,7 +409,7 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow): self.__auto_lib_thread.finishedWithErrorSignal.disconnect(self.onStopButtonClicked) self.__auto_lib_thread.deleteLater() self.__auto_lib_thread = None - self.setControlButtons(True, False, True) + self.setControlButtons(None, False, True) @Slot() def onSendButtonClicked(