解决log_text过长导致的log显示于中间

This commit is contained in:
DLmaster
2024-11-09 11:15:44 +08:00
parent 0141bf039a
commit fb27c50c75

View File

@@ -185,17 +185,30 @@ class MaaRunner(QtCore.QThread):
# 合并日志 # 合并日志
log = "".join(logs) log = "".join(logs)
# 更新MAA日志 # 更新MAA日志
self.update_gui.emit( if len(logs) > 10000:
self.data[index][0] self.update_gui.emit(
+ "_第" self.data[index][0]
+ str(i + 1) + "_第"
+ "次_" + str(i + 1)
+ mode_book[j][5:7], + "次_"
"\n".join([self.data[_][0] for _ in wait_index]), + mode_book[j][5:7],
"\n".join([self.data[_][0] for _ in over_index]), "\n".join([self.data[_][0] for _ in wait_index]),
"\n".join([self.data[_][0] for _ in error_index]), "\n".join([self.data[_][0] for _ in over_index]),
log, "\n".join([self.data[_][0] for _ in error_index]),
) "".join(logs[-10000:]),
)
else:
self.update_gui.emit(
self.data[index][0]
+ "_第"
+ str(i + 1)
+ "次_"
+ mode_book[j][5:7],
"\n".join([self.data[_][0] for _ in wait_index]),
"\n".join([self.data[_][0] for _ in over_index]),
"\n".join([self.data[_][0] for _ in error_index]),
"".join(logs),
)
# 判断MAA程序运行状态 # 判断MAA程序运行状态
result = self.if_maa_success(log, mode_book[j]) result = self.if_maa_success(log, mode_book[j])
if result == "Success!": if result == "Success!":
@@ -307,13 +320,30 @@ class MaaRunner(QtCore.QThread):
# 合并日志 # 合并日志
log = "".join(logs) log = "".join(logs)
# 更新MAA日志 # 更新MAA日志
self.update_gui.emit( if len(logs) > 10000:
self.data[index][0], self.update_gui.emit(
"\n".join([self.data[_][0] for _ in wait_index]), self.data[index][0]
"\n".join([self.data[_][0] for _ in over_index]), + "_第"
"\n".join([self.data[_][0] for _ in error_index]), + str(i + 1)
log, + "次_"
) + mode_book[j][5:7],
"\n".join([self.data[_][0] for _ in wait_index]),
"\n".join([self.data[_][0] for _ in over_index]),
"\n".join([self.data[_][0] for _ in error_index]),
"".join(logs[-10000:]),
)
else:
self.update_gui.emit(
self.data[index][0]
+ "_第"
+ str(i + 1)
+ "次_"
+ mode_book[j][5:7],
"\n".join([self.data[_][0] for _ in wait_index]),
"\n".join([self.data[_][0] for _ in over_index]),
"\n".join([self.data[_][0] for _ in error_index]),
"".join(logs),
)
# 判断MAA程序运行状态 # 判断MAA程序运行状态
result = self.if_maa_success(log, "人工排查") result = self.if_maa_success(log, "人工排查")
if result == "Success!": if result == "Success!":