重构测试执行部分+去除转发器
This commit is contained in:
@@ -10,15 +10,13 @@ from tkinter import messagebox
|
||||
|
||||
from utils.caSerail import CASerail
|
||||
|
||||
def get_available_ucd_ports(app):
|
||||
def get_available_ucd_ports(self):
|
||||
"""获取可用的UCD端口列表"""
|
||||
self = app
|
||||
return self.ucd.search_device()
|
||||
|
||||
|
||||
def get_available_com_ports(app):
|
||||
def get_available_com_ports(self):
|
||||
"""获取可用的COM端口列表"""
|
||||
self = app
|
||||
try:
|
||||
import serial.tools.list_ports
|
||||
|
||||
@@ -29,9 +27,8 @@ def get_available_com_ports(app):
|
||||
return []
|
||||
|
||||
|
||||
def refresh_com_ports(app):
|
||||
def refresh_com_ports(self):
|
||||
"""刷新COM端口列表"""
|
||||
self = app
|
||||
available_ports = self.get_available_com_ports()
|
||||
available_list = self.get_available_ucd_ports()
|
||||
|
||||
@@ -60,9 +57,8 @@ def refresh_com_ports(app):
|
||||
self.update_config()
|
||||
|
||||
|
||||
def check_com_connections(app):
|
||||
def check_com_connections(self):
|
||||
"""检测COM端口连接状态"""
|
||||
self = app
|
||||
# 禁用连接按钮,防止重复点击
|
||||
self.check_button.configure(state="disabled")
|
||||
self.refresh_button.configure(state="disabled")
|
||||
@@ -105,18 +101,16 @@ def check_com_connections(app):
|
||||
threading.Thread(target=check_connections, daemon=True).start()
|
||||
|
||||
|
||||
def update_connection_indicator(app, indicator, connected):
|
||||
def update_connection_indicator(self, indicator, connected):
|
||||
"""更新连接状态指示器颜色"""
|
||||
self = app
|
||||
if connected:
|
||||
indicator.config(bg="green")
|
||||
else:
|
||||
indicator.config(bg="red")
|
||||
|
||||
|
||||
def check_port_connection(app, is_ucd=True):
|
||||
def check_port_connection(self, is_ucd=True):
|
||||
"""检测指定端口是否可以连接"""
|
||||
self = app
|
||||
try:
|
||||
if is_ucd:
|
||||
if self.ucd.status:
|
||||
@@ -166,16 +160,14 @@ def check_port_connection(app, is_ucd=True):
|
||||
return False
|
||||
|
||||
|
||||
def enable_com_widgets(app):
|
||||
def enable_com_widgets(self):
|
||||
"""重新启用所有控件"""
|
||||
self = app
|
||||
self.check_button.configure(state="normal")
|
||||
self.refresh_button.configure(state="normal")
|
||||
|
||||
|
||||
def disconnect_com_connections(app):
|
||||
def disconnect_com_connections(self):
|
||||
"""断开所有串口连接"""
|
||||
self = app
|
||||
try:
|
||||
# 断开TV连接
|
||||
if self.ucd.status:
|
||||
|
||||
Reference in New Issue
Block a user