控制按钮状态

This commit is contained in:
halliday2023 2024-02-12 22:28:36 +08:00
parent e78d291936
commit 57e34b35b9
1 changed files with 9 additions and 3 deletions

View File

@ -51,6 +51,8 @@ class Window(formType, baseType):
self.start_thread()
else:
self.start_run_db()
# 按钮置灰
self.startButton.setEnabled(not self.startButton.isEnabled())
@Slot()
@ -61,6 +63,8 @@ class Window(formType, baseType):
self.stop_run_file()
else:
self.stop_run_db()
# 按钮恢复
self.startButton.setEnabled(not self.startButton.isEnabled())
@Slot()
def conntest(self):
@ -104,9 +108,11 @@ class Window(formType, baseType):
def stop_run_file(self):
# 终止线程的事件循环
global_var.set_value('start_flag',False)
self.thread.quit() # 终止线程的事件循环
self.thread_running = False # 标记线程停止
self.thread.quit()
# 标记线程停止
self.thread_running = global_var.get_value('start_flag')