优化界面 完善逻辑
This commit is contained in:
parent
a9a6db23fd
commit
676eb49679
43
aio.py
43
aio.py
@ -187,15 +187,30 @@ class MainWindow(main_window.Ui_MainWindow):
|
|||||||
self.run_program_thread(do_current.DoCurrentTest(self.le_unit_path.text(), self.cb_unit_tool.currentText()), 5, prog_done, None)
|
self.run_program_thread(do_current.DoCurrentTest(self.le_unit_path.text(), self.cb_unit_tool.currentText()), 5, prog_done, None)
|
||||||
elif self.tw_funcs.currentIndex() == 2: # tab: 耐久采集 | func: 场景数据持久化
|
elif self.tw_funcs.currentIndex() == 2: # tab: 耐久采集 | func: 场景数据持久化
|
||||||
self.run_program_thread(factory_test.DoFactoryTest(self.le_durable_path.text(), self.le_durable_interval.text(), self.get_checkbox_states()), 6, prog_done, None)
|
self.run_program_thread(factory_test.DoFactoryTest(self.le_durable_path.text(), self.le_durable_interval.text(), self.get_checkbox_states()), 6, prog_done, None)
|
||||||
|
else:
|
||||||
|
QMessageBox.warning(self, "运行错误", "当前无可运行的功能!")
|
||||||
|
|
||||||
def prog_stop(self):
|
def prog_stop(self):
|
||||||
if sum(clibs.running) == 0:
|
if sum(clibs.running) == 0:
|
||||||
return
|
return
|
||||||
|
if clibs.stop_flag:
|
||||||
|
QMessageBox.warning(self, "停止运行", "当前程序正在停止中,请勿重复执行!")
|
||||||
|
return
|
||||||
|
|
||||||
idx = clibs.running.index(1)
|
idx = clibs.running.index(1)
|
||||||
clibs.running[idx] = 0
|
if idx in [0, 1, 2, 3]:
|
||||||
clibs.logger("INFO", "aio", f"{clibs.functions[idx]}程序已经停止,涉及Excel文件读写时可能会损坏该文件!", "red")
|
QMessageBox.warning(self, "停止运行", "数据处理功能不支持中途停止,可直接关闭窗口以强制终止程序的执行,但有文件损坏的风险!")
|
||||||
# QMessageBox.warning(self, "停止运行", "运行过程中不建议停止运行,可能会损坏文件,如果确实需要停止运行,可以直接关闭窗口!")
|
return
|
||||||
|
if idx in [4, 5, 6]:
|
||||||
|
try:
|
||||||
|
clibs.c_hr.execution("diagnosis.open", open=False, display_open=False)
|
||||||
|
clibs.c_hr.execution("diagnosis.set_params", display_pdo_params=[])
|
||||||
|
clibs.c_md.r_soft_estop(0)
|
||||||
|
except:
|
||||||
|
...
|
||||||
|
|
||||||
|
clibs.running[idx], clibs.stop_flag = 0, True
|
||||||
|
clibs.logger("INFO", "aio", f"{clibs.functions[idx]}程序正在停止中,需要一些时间清理后台数据,等待程序运行状态为 IDLE 时可重新运行其他程序!", "red")
|
||||||
|
|
||||||
def prog_reset(self):
|
def prog_reset(self):
|
||||||
self.tw_docs.setCurrentIndex(0)
|
self.tw_docs.setCurrentIndex(0)
|
||||||
@ -946,7 +961,7 @@ class MainWindow(main_window.Ui_MainWindow):
|
|||||||
self.btn_ec_conn.setText("连接")
|
self.btn_ec_conn.setText("连接")
|
||||||
self.ec_state.setText(f'<img src="{clibs.PREFIX}/media/red.png" width="10" height="10" /><font face="consolas" size="4"><b>EC </b></font>')
|
self.ec_state.setText(f'<img src="{clibs.PREFIX}/media/red.png" width="10" height="10" /><font face="consolas" size="4"><b>EC </b></font>')
|
||||||
# ============= Program running status =============
|
# ============= Program running status =============
|
||||||
if sum(clibs.running) == 1:
|
if sum(clibs.running) == 1 or clibs.stop_flag:
|
||||||
self.run_state.setText(f'<img src="{clibs.PREFIX}/media/red.png" width="10" height="10" /><font face="consolas" size="4"><b>BUSY</b></font>')
|
self.run_state.setText(f'<img src="{clibs.PREFIX}/media/red.png" width="10" height="10" /><font face="consolas" size="4"><b>BUSY</b></font>')
|
||||||
else:
|
else:
|
||||||
self.run_state.setText(f'<img src="{clibs.PREFIX}/media/green.png" width="10" height="10" /><font face="consolas" size="4"><b>IDLE</b></font>')
|
self.run_state.setText(f'<img src="{clibs.PREFIX}/media/green.png" width="10" height="10" /><font face="consolas" size="4"><b>IDLE</b></font>')
|
||||||
@ -954,6 +969,7 @@ class MainWindow(main_window.Ui_MainWindow):
|
|||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
idx = -1 if clibs.running.count(1) == 0 else clibs.running.index(1)
|
idx = -1 if clibs.running.count(1) == 0 else clibs.running.index(1)
|
||||||
info_text = "当前无程序正在运行,可放心退出!" if idx == -1 else f"当前正在运行{clibs.functions[idx]},确认退出?"
|
info_text = "当前无程序正在运行,可放心退出!" if idx == -1 else f"当前正在运行{clibs.functions[idx]},确认退出?"
|
||||||
|
info_text = "当前有程序正在停止中,确认退出?" if clibs.stop_flag else info_text
|
||||||
reply = QMessageBox.question(self, "退出", info_text)
|
reply = QMessageBox.question(self, "退出", info_text)
|
||||||
if reply == QMessageBox.Yes:
|
if reply == QMessageBox.Yes:
|
||||||
os.chdir(clibs.log_path)
|
os.chdir(clibs.log_path)
|
||||||
@ -1001,7 +1017,7 @@ class MainWindow(main_window.Ui_MainWindow):
|
|||||||
if local_vers == server_vers:
|
if local_vers == server_vers:
|
||||||
self.update_label.setText(f'<img src="{clibs.PREFIX}/media/updated.png" width="14" height="14" style="vertical-align: middle;" /><span style="vertical-align: middle; font-size: 14px; font-weight: bold; color: #0D8A3D;"> Current is the latest version!</span>')
|
self.update_label.setText(f'<img src="{clibs.PREFIX}/media/updated.png" width="14" height="14" style="vertical-align: middle;" /><span style="vertical-align: middle; font-size: 14px; font-weight: bold; color: #0D8A3D;"> Current is the latest version!</span>')
|
||||||
elif local_vers > server_vers:
|
elif local_vers > server_vers:
|
||||||
pass
|
self.update_label.setText(f'<img src="{clibs.PREFIX}/media/updated.png" width="14" height="14" style="vertical-align: middle;" /><span style="vertical-align: middle; font-size: 14px; font-weight: bold; color: #0D8A3D;"> Current is the latest version!</span>')
|
||||||
elif local_vers < server_vers:
|
elif local_vers < server_vers:
|
||||||
self.update_label.setText(f'''<a href="https://www.rustle.cc/aio.zip" style="text-decoration: none;"><img src="{clibs.PREFIX}/media/upgrade.png" width="14" height="14" style="vertical-align: middle;" /><span style="vertical-align: middle; font-size: 14px; font-weight: bold; color: #D81E06;"> v{server_vers.split('@')[0]} has been released, update ASAP!</span></a>''')
|
self.update_label.setText(f'''<a href="https://www.rustle.cc/aio.zip" style="text-decoration: none;"><img src="{clibs.PREFIX}/media/upgrade.png" width="14" height="14" style="vertical-align: middle;" /><span style="vertical-align: middle; font-size: 14px; font-weight: bold; color: #D81E06;"> v{server_vers.split('@')[0]} has been released, update ASAP!</span></a>''')
|
||||||
|
|
||||||
@ -1087,16 +1103,17 @@ class SplashScreen(QApplication):
|
|||||||
self.splash.show()
|
self.splash.show()
|
||||||
self.splash.showMessage("正在加载资源.....", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignHCenter, Qt.GlobalColor.white)
|
self.splash.showMessage("正在加载资源.....", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignHCenter, Qt.GlobalColor.white)
|
||||||
|
|
||||||
# self.t = QThread(self)
|
# with validation of server version
|
||||||
# self.run = InitWork()
|
self.t = QThread(self)
|
||||||
# self.run.moveToThread(self.t)
|
self.run = InitWork()
|
||||||
# self.run.completed.connect(self.prog_done)
|
self.run.moveToThread(self.t)
|
||||||
# self.action.connect(self.run.program)
|
self.run.completed.connect(self.prog_done)
|
||||||
# self.t.start()
|
self.action.connect(self.run.program)
|
||||||
# self.action.emit(1)
|
self.t.start()
|
||||||
|
self.action.emit(1)
|
||||||
|
|
||||||
# without validation of server version
|
# without validation of server version
|
||||||
self.prog_done("true")
|
# self.prog_done("true")
|
||||||
|
|
||||||
def prog_done(self, result):
|
def prog_done(self, result):
|
||||||
if result == "false" or result == "":
|
if result == "false" or result == "":
|
||||||
|
@ -6,8 +6,8 @@ VSVersionInfo(
|
|||||||
ffi=FixedFileInfo(
|
ffi=FixedFileInfo(
|
||||||
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
||||||
# Set not needed items to zero 0.
|
# Set not needed items to zero 0.
|
||||||
filevers=(0, 4, 0, 0),
|
filevers=(0, 4, 0, 1),
|
||||||
prodvers=(0, 4, 0, 0),
|
prodvers=(0, 4, 0, 1),
|
||||||
# Contains a bitmask that specifies the valid bits 'flags'r
|
# Contains a bitmask that specifies the valid bits 'flags'r
|
||||||
mask=0x3f,
|
mask=0x3f,
|
||||||
# Contains a bitmask that specifies the Boolean attributes of the file.
|
# Contains a bitmask that specifies the Boolean attributes of the file.
|
||||||
@ -31,12 +31,12 @@ VSVersionInfo(
|
|||||||
'040904b0',
|
'040904b0',
|
||||||
[StringStruct('CompanyName', 'Rokae - https://www.rokae.com/'),
|
[StringStruct('CompanyName', 'Rokae - https://www.rokae.com/'),
|
||||||
StringStruct('FileDescription', 'All in one automatic toolbox'),
|
StringStruct('FileDescription', 'All in one automatic toolbox'),
|
||||||
StringStruct('FileVersion', '0.4.0.0 (2025-03-28)'),
|
StringStruct('FileVersion', '0.4.0.1 (2025-03-30)'),
|
||||||
StringStruct('InternalName', 'AIO.exe'),
|
StringStruct('InternalName', 'AIO.exe'),
|
||||||
StringStruct('LegalCopyright', '© 2024-2025 Manford Fan'),
|
StringStruct('LegalCopyright', '© 2024-2025 Manford Fan'),
|
||||||
StringStruct('OriginalFilename', 'AIO.exe'),
|
StringStruct('OriginalFilename', 'AIO.exe'),
|
||||||
StringStruct('ProductName', 'AIO'),
|
StringStruct('ProductName', 'AIO'),
|
||||||
StringStruct('ProductVersion', '0.4.0.0 (2025-03-28)')])
|
StringStruct('ProductVersion', '0.4.0.1 (2025-03-30)')])
|
||||||
]),
|
]),
|
||||||
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
VarFileInfo([VarStruct('Translation', [1033, 1200])])
|
||||||
]
|
]
|
||||||
|
@ -1 +1 @@
|
|||||||
0.4.0.0@03/27/2025
|
0.4.0.1@03/30/2025
|
@ -1,11 +1,13 @@
|
|||||||
chardet==5.2.0
|
|
||||||
customtkinter==5.2.2
|
|
||||||
matplotlib==3.10.0
|
matplotlib==3.10.0
|
||||||
numpy==2.2.2
|
Pillow==11.1.0
|
||||||
|
pyinstaller==6.12.0
|
||||||
|
chardet==5.2.0
|
||||||
|
codes==0.1.5
|
||||||
|
numpy==2.2.4
|
||||||
openpyxl==3.1.5
|
openpyxl==3.1.5
|
||||||
pandas==2.2.3
|
pandas==2.2.3
|
||||||
paramiko==3.5.0
|
paramiko==3.5.1
|
||||||
pdfplumber==0.11.5
|
pdfplumber==0.11.6
|
||||||
Pillow==11.1.0
|
pymodbus==3.8.6
|
||||||
pymodbus==3.8.3
|
PySide6==6.8.3
|
||||||
pyinstaller==6.12.0
|
|
||||||
|
@ -1 +1 @@
|
|||||||
0.4.0.0@03/27/2025
|
0.4.0.1@03/30/2025
|
@ -186,6 +186,9 @@ class DoBrakeTest(QThread):
|
|||||||
self.logger("INFO", "brake", "-" * 90, "purple")
|
self.logger("INFO", "brake", "-" * 90, "purple")
|
||||||
speed_max = 0
|
speed_max = 0
|
||||||
for rounds in range(1, 4):
|
for rounds in range(1, 4):
|
||||||
|
if clibs.stop_flag:
|
||||||
|
self.logger("ERROR", "do_brake", "后台数据清零完成,现在可以重新运行其他程序。", "green")
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
_ = 3 if count % 3 == 0 else count % 3
|
_ = 3 if count % 3 == 0 else count % 3
|
||||||
this_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
|
this_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))
|
||||||
@ -356,9 +359,6 @@ class DoBrakeTest(QThread):
|
|||||||
clibs.running[self.idx] = 1
|
clibs.running[self.idx] = 1
|
||||||
if clibs.status["hmi"] != 1 or clibs.status["md"] != 1 or clibs.status["ec"] != 1:
|
if clibs.status["hmi"] != 1 or clibs.status["md"] != 1 or clibs.status["ec"] != 1:
|
||||||
self.logger("ERROR", "do_brake", "processing: 需要在网络设置中连接HMI,Modbus通信以及外部通信!", "red")
|
self.logger("ERROR", "do_brake", "processing: 需要在网络设置中连接HMI,Modbus通信以及外部通信!", "red")
|
||||||
t = threading.Thread(target=clibs.running_detection, args=(self.idx, ))
|
|
||||||
t.daemon = True
|
|
||||||
t.start()
|
|
||||||
|
|
||||||
data_dirs, data_files = clibs.traversal_files(self.dir_path)
|
data_dirs, data_files = clibs.traversal_files(self.dir_path)
|
||||||
config_file, prj_file, result_dirs, avs = self.initialization(data_dirs, data_files)
|
config_file, prj_file, result_dirs, avs = self.initialization(data_dirs, data_files)
|
||||||
|
@ -183,6 +183,9 @@ class DoCurrentTest(QThread):
|
|||||||
clibs.c_md.r_clear_alarm()
|
clibs.c_md.r_clear_alarm()
|
||||||
|
|
||||||
for condition in conditions:
|
for condition in conditions:
|
||||||
|
if clibs.stop_flag:
|
||||||
|
self.logger("ERROR", "do_current", "后台数据清零完成,现在可以重新运行其他程序。", "green")
|
||||||
|
|
||||||
number = conditions.index(condition)
|
number = conditions.index(condition)
|
||||||
# for testing
|
# for testing
|
||||||
# if number < 12:
|
# if number < 12:
|
||||||
|
@ -64,7 +64,7 @@ class LoggerHandler(QThread):
|
|||||||
|
|
||||||
@db_lock
|
@db_lock
|
||||||
def logger(self, level, module, content, color="black", flag="both"):
|
def logger(self, level, module, content, color="black", flag="both"):
|
||||||
global cursor
|
global cursor, stop_flag
|
||||||
if "move.monitor" in content:
|
if "move.monitor" in content:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -80,21 +80,16 @@ class LoggerHandler(QThread):
|
|||||||
cursor.execute(f"INSERT INTO logs (level, module, content) VALUES (?, ?, ?)", (level, module, content))
|
cursor.execute(f"INSERT INTO logs (level, module, content) VALUES (?, ?, ?)", (level, module, content))
|
||||||
|
|
||||||
if level.upper() == "ERROR":
|
if level.upper() == "ERROR":
|
||||||
|
stop_flag = False
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
|
|
||||||
def running_detection(idx):
|
PREFIX = "resources/assets" # for pyinstaller
|
||||||
while True:
|
# PREFIX = "assets" # for local testing
|
||||||
time.sleep(INTERVAL*2)
|
|
||||||
if not running[idx]:
|
|
||||||
raise Exception("")
|
|
||||||
|
|
||||||
|
|
||||||
# PREFIX = "resources/assets" # for pyinstaller
|
|
||||||
PREFIX = "assets" # for local testing
|
|
||||||
log_path = f"{PREFIX}/logs"
|
log_path = f"{PREFIX}/logs"
|
||||||
lock = threading.Lock()
|
lock = threading.Lock()
|
||||||
running = [0, 0, 0, 0, 0, 0, 0] # 制动数据/转矩数据/激光数据/精度数据/制动自动化/转矩自动化/耐久数据采集
|
running = [0, 0, 0, 0, 0, 0, 0] # 制动数据/转矩数据/激光数据/精度数据/制动自动化/转矩自动化/耐久数据采集
|
||||||
|
stop_flag = False
|
||||||
functions = ["制动数据处理", "转矩数据处理", "激光数据处理", "精度数据处理", "制动自动化测试", "转矩自动化测试", "耐久数据采集"]
|
functions = ["制动数据处理", "转矩数据处理", "激光数据处理", "精度数据处理", "制动自动化测试", "转矩自动化测试", "耐久数据采集"]
|
||||||
levels = ["DEBUG", "INFO", "WARNING", "ERROR"]
|
levels = ["DEBUG", "INFO", "WARNING", "ERROR"]
|
||||||
ip_addr, ssh_port, socket_port, xService_port, external_port, modbus_port, upgrade_port = "", 22, 5050, 6666, 8080, 502, 4567
|
ip_addr, ssh_port, socket_port, xService_port, external_port, modbus_port, upgrade_port = "", 22, 5050, 6666, 8080, 502, 4567
|
||||||
|
@ -167,7 +167,7 @@ class DoFactoryTest(QThread):
|
|||||||
# 保留数据并处理输出
|
# 保留数据并处理输出
|
||||||
self.gen_results(params, start_time, end_time)
|
self.gen_results(params, start_time, end_time)
|
||||||
else:
|
else:
|
||||||
self.change_curve_state(False)
|
clibs.stop_flag = False
|
||||||
self.logger("INFO", "factory", "后台数据清零完成,现在可以重新运行其他程序。", "green")
|
self.logger("INFO", "factory", "后台数据清零完成,现在可以重新运行其他程序。", "green")
|
||||||
|
|
||||||
def gen_results(self, params, start_time, end_time):
|
def gen_results(self, params, start_time, end_time):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user