Merge branch 'generic_dev' into dev
This commit is contained in:
@@ -707,7 +707,7 @@ class GeneralSubConfig(LQConfig):
|
|||||||
|
|
||||||
class AppConfig(GlobalConfig):
|
class AppConfig(GlobalConfig):
|
||||||
|
|
||||||
VERSION = "4.4.0.6"
|
VERSION = "4.4.0.0"
|
||||||
|
|
||||||
stage_refreshed = Signal()
|
stage_refreshed = Signal()
|
||||||
PASSWORD_refreshed = Signal()
|
PASSWORD_refreshed = Signal()
|
||||||
@@ -1386,7 +1386,7 @@ class AppConfig(GlobalConfig):
|
|||||||
logger.warning(f"保存历史记录时未找到调度队列: {key}")
|
logger.warning(f"保存历史记录时未找到调度队列: {key}")
|
||||||
|
|
||||||
def save_maa_log(self, log_path: Path, logs: list, maa_result: str) -> bool:
|
def save_maa_log(self, log_path: Path, logs: list, maa_result: str) -> bool:
|
||||||
"""保存MAA日志并生成初步统计数据"""
|
"""保存MAA日志并生成对应统计数据"""
|
||||||
|
|
||||||
data: Dict[str, Union[str, Dict[str, Union[int, dict]]]] = {
|
data: Dict[str, Union[str, Dict[str, Union[int, dict]]]] = {
|
||||||
"recruit_statistics": defaultdict(int),
|
"recruit_statistics": defaultdict(int),
|
||||||
@@ -1507,117 +1507,77 @@ class AppConfig(GlobalConfig):
|
|||||||
|
|
||||||
logger.info(f"处理完成:{log_path}")
|
logger.info(f"处理完成:{log_path}")
|
||||||
|
|
||||||
self.merge_maa_logs("所有项", log_path.parent)
|
|
||||||
|
|
||||||
return if_six_star
|
return if_six_star
|
||||||
|
|
||||||
def merge_maa_logs(self, mode: str, logs_path: Union[Path, List[Path]]) -> dict:
|
def merge_statistic_info(self, statistic_path_list: List[Path]) -> dict:
|
||||||
"""合并指定数据统计信息文件"""
|
"""合并指定数据统计信息文件"""
|
||||||
|
|
||||||
data = {
|
data = {"index": {}}
|
||||||
"recruit_statistics": defaultdict(int),
|
|
||||||
"drop_statistics": defaultdict(dict),
|
|
||||||
"maa_result": defaultdict(str),
|
|
||||||
}
|
|
||||||
|
|
||||||
if mode == "所有项":
|
for json_file in statistic_path_list:
|
||||||
logs_path_list = list(logs_path.glob("*.json"))
|
|
||||||
elif mode == "指定项":
|
|
||||||
logs_path_list = logs_path
|
|
||||||
|
|
||||||
for json_file in logs_path_list:
|
|
||||||
|
|
||||||
with json_file.open("r", encoding="utf-8") as f:
|
with json_file.open("r", encoding="utf-8") as f:
|
||||||
single_data: Dict[str, Union[str, Dict[str, Union[int, dict]]]] = (
|
single_data: Dict[str, Union[str, Dict[str, Union[int, dict]]]] = (
|
||||||
json.load(f)
|
json.load(f)
|
||||||
)
|
)
|
||||||
|
|
||||||
# 合并公招统计
|
for key in single_data.keys():
|
||||||
for star_level, count in single_data["recruit_statistics"].items():
|
|
||||||
data["recruit_statistics"][star_level] += count
|
|
||||||
|
|
||||||
# 合并掉落统计
|
if key not in data:
|
||||||
for stage, drops in single_data["drop_statistics"].items():
|
data[key] = {}
|
||||||
if stage not in data["drop_statistics"]:
|
|
||||||
data["drop_statistics"][stage] = {} # 初始化关卡
|
|
||||||
|
|
||||||
for item, count in drops.items():
|
# 合并公招统计
|
||||||
|
if key == "recruit_statistics":
|
||||||
|
|
||||||
if item in data["drop_statistics"][stage]:
|
for star_level, count in single_data[key].items():
|
||||||
data["drop_statistics"][stage][item] += count
|
if star_level not in data[key]:
|
||||||
else:
|
data[key][star_level] = 0
|
||||||
data["drop_statistics"][stage][item] = count
|
data[key][star_level] += count
|
||||||
|
|
||||||
# 合并MAA结果
|
# 合并掉落统计
|
||||||
data["maa_result"][json_file.stem.replace("-", ":")] = single_data[
|
if key == "drop_statistics":
|
||||||
"maa_result"
|
|
||||||
]
|
|
||||||
|
|
||||||
# 生成汇总 JSON 文件
|
for stage, drops in single_data[key].items():
|
||||||
if mode == "所有项":
|
if stage not in data[key]:
|
||||||
|
data[key][stage] = {} # 初始化关卡
|
||||||
|
|
||||||
with logs_path.with_suffix(".json").open("w", encoding="utf-8") as f:
|
for item, count in drops.items():
|
||||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
|
||||||
|
|
||||||
logger.info(f"统计完成:{logs_path.with_suffix('.json')}")
|
if item not in data[key][stage]:
|
||||||
|
data[key][stage][item] = 0
|
||||||
|
data[key][stage][item] += count
|
||||||
|
|
||||||
return data
|
# 录入MAA结果
|
||||||
|
if key == "maa_result":
|
||||||
|
|
||||||
def load_maa_logs(
|
actual_date = datetime.strptime(
|
||||||
self, mode: str, json_path: Path
|
f"{json_file.parent.parent.name} {json_file.stem}",
|
||||||
) -> Dict[str, Union[str, list, Dict[str, list]]]:
|
"%Y-%m-%d %H-%M-%S",
|
||||||
"""加载MAA日志统计信息"""
|
) + timedelta(
|
||||||
|
days=(
|
||||||
|
1
|
||||||
|
if datetime.strptime(json_file.stem, "%H-%M-%S").time()
|
||||||
|
< datetime.min.time().replace(hour=4)
|
||||||
|
else 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if mode == "总览":
|
if single_data[key] != "Success!":
|
||||||
|
if "error_info" not in data:
|
||||||
|
data["error_info"] = {}
|
||||||
|
data["error_info"][actual_date.strftime("%d日 %H:%M:%S")] = (
|
||||||
|
single_data[key]
|
||||||
|
)
|
||||||
|
|
||||||
with json_path.open("r", encoding="utf-8") as f:
|
data["index"][actual_date] = [
|
||||||
info: Dict[str, Dict[str, Union[int, dict]]] = json.load(f)
|
actual_date.strftime("%d日 %H:%M:%S"),
|
||||||
|
("完成" if single_data["maa_result"] == "Success!" else "异常"),
|
||||||
|
json_file,
|
||||||
|
]
|
||||||
|
|
||||||
data = {}
|
data["index"] = [data["index"][_] for _ in sorted(data["index"])]
|
||||||
# 4点前的记录放在当日最后
|
|
||||||
sorted_maa_result = sorted(
|
|
||||||
info["maa_result"].items(),
|
|
||||||
key=lambda x: (
|
|
||||||
(
|
|
||||||
1
|
|
||||||
if datetime.strptime(x[0], "%H:%M:%S").time()
|
|
||||||
< datetime.min.time().replace(hour=4)
|
|
||||||
else 0
|
|
||||||
),
|
|
||||||
datetime.strptime(x[0], "%H:%M:%S"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
data["条目索引"] = [
|
|
||||||
[k, "完成" if v == "Success!" else "异常"] for k, v in sorted_maa_result
|
|
||||||
]
|
|
||||||
data["条目索引"].insert(0, ["数据总览", "运行"])
|
|
||||||
data["统计数据"] = {"公招统计": list(info["recruit_statistics"].items())}
|
|
||||||
|
|
||||||
for game_id, drops in info["drop_statistics"].items():
|
return {k: v for k, v in data.items() if v}
|
||||||
data["统计数据"][f"掉落统计:{game_id}"] = list(drops.items())
|
|
||||||
|
|
||||||
data["统计数据"]["报错汇总"] = [
|
|
||||||
[k, v] for k, v in info["maa_result"].items() if v != "Success!"
|
|
||||||
]
|
|
||||||
|
|
||||||
elif mode == "单项":
|
|
||||||
|
|
||||||
with json_path.open("r", encoding="utf-8") as f:
|
|
||||||
info: Dict[str, Union[str, Dict[str, Union[int, dict]]]] = json.load(f)
|
|
||||||
|
|
||||||
data = {}
|
|
||||||
|
|
||||||
data["统计数据"] = {"公招统计": list(info["recruit_statistics"].items())}
|
|
||||||
|
|
||||||
for game_id, drops in info["drop_statistics"].items():
|
|
||||||
data["统计数据"][f"掉落统计:{game_id}"] = list(drops.items())
|
|
||||||
|
|
||||||
with json_path.with_suffix(".log").open("r", encoding="utf-8") as f:
|
|
||||||
log = f.read()
|
|
||||||
|
|
||||||
data["日志信息"] = log
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
def search_history(
|
def search_history(
|
||||||
self, mode: str, start_date: datetime, end_date: datetime
|
self, mode: str, start_date: datetime, end_date: datetime
|
||||||
@@ -1638,43 +1598,28 @@ class AppConfig(GlobalConfig):
|
|||||||
continue # 只统计在范围内的日期
|
continue # 只统计在范围内的日期
|
||||||
|
|
||||||
if mode == "按日合并":
|
if mode == "按日合并":
|
||||||
|
date_name = date.strftime("%Y年 %m月 %d日")
|
||||||
history_dict[date.strftime("%Y年 %m月 %d日")] = list(
|
|
||||||
date_folder.glob("*.json")
|
|
||||||
)
|
|
||||||
|
|
||||||
elif mode == "按周合并":
|
elif mode == "按周合并":
|
||||||
|
|
||||||
year, week, _ = date.isocalendar()
|
year, week, _ = date.isocalendar()
|
||||||
if f"{year}年 第{week}周" not in history_dict:
|
date_name = f"{year}年 第{week}周"
|
||||||
history_dict[f"{year}年 第{week}周"] = {}
|
|
||||||
|
|
||||||
for user in date_folder.glob("*.json"):
|
|
||||||
|
|
||||||
if user.stem not in history_dict[f"{year}年 第{week}周"]:
|
|
||||||
history_dict[f"{year}年 第{week}周"][user.stem] = list(
|
|
||||||
user.with_suffix("").glob("*.json")
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
history_dict[f"{year}年 第{week}周"][user.stem] += list(
|
|
||||||
user.with_suffix("").glob("*.json")
|
|
||||||
)
|
|
||||||
|
|
||||||
elif mode == "按月合并":
|
elif mode == "按月合并":
|
||||||
|
date_name = date.strftime("%Y年 %m月")
|
||||||
|
|
||||||
if date.strftime("%Y年 %m月") not in history_dict:
|
if date_name not in history_dict:
|
||||||
history_dict[date.strftime("%Y年 %m月")] = {}
|
history_dict[date_name] = {}
|
||||||
|
|
||||||
for user in date_folder.glob("*.json"):
|
for user_folder in date_folder.iterdir():
|
||||||
|
if not user_folder.is_dir():
|
||||||
|
continue # 只处理用户文件夹
|
||||||
|
|
||||||
if user.stem not in history_dict[date.strftime("%Y年 %m月")]:
|
if user_folder.stem not in history_dict[date_name]:
|
||||||
history_dict[date.strftime("%Y年 %m月")][user.stem] = list(
|
history_dict[date_name][user_folder.stem] = list(
|
||||||
user.with_suffix("").glob("*.json")
|
user_folder.with_suffix("").glob("*.json")
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
history_dict[date.strftime("%Y年 %m月")][user.stem] += list(
|
history_dict[date_name][user_folder.stem] += list(
|
||||||
user.with_suffix("").glob("*.json")
|
user_folder.with_suffix("").glob("*.json")
|
||||||
)
|
)
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.warning(f"非日期格式的目录: {date_folder}")
|
logger.warning(f"非日期格式的目录: {date_folder}")
|
||||||
|
|||||||
@@ -701,7 +701,7 @@ class MaaManager(QObject):
|
|||||||
logger.info(f"{self.name} | 更新动作结束")
|
logger.info(f"{self.name} | 更新动作结束")
|
||||||
|
|
||||||
# 发送统计信息
|
# 发送统计信息
|
||||||
statistics = Config.merge_maa_logs("指定项", user_logs_list)
|
statistics = Config.merge_statistic_info(user_logs_list)
|
||||||
statistics["user_index"] = user[2]
|
statistics["user_index"] = user[2]
|
||||||
statistics["user_info"] = user[0]
|
statistics["user_info"] = user[0]
|
||||||
statistics["start_time"] = user_start_time.strftime("%Y-%m-%d %H:%M:%S")
|
statistics["start_time"] = user_start_time.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
@@ -1122,21 +1122,25 @@ class MaaManager(QObject):
|
|||||||
|
|
||||||
elif "任务已全部完成!" in log:
|
elif "任务已全部完成!" in log:
|
||||||
|
|
||||||
if "完成任务: StartUp" in log:
|
if "完成任务: StartUp" in log or "完成任务: 开始唤醒" in log:
|
||||||
self.task_dict["WakeUp"] = "False"
|
self.task_dict["WakeUp"] = "False"
|
||||||
if "完成任务: Recruit" in log:
|
if "完成任务: Recruit" in log or "完成任务: 自动公招" in log:
|
||||||
self.task_dict["Recruiting"] = "False"
|
self.task_dict["Recruiting"] = "False"
|
||||||
if "完成任务: Infrast" in log:
|
if "完成任务: Infrast" in log or "完成任务: 基建换班" in log:
|
||||||
self.task_dict["Base"] = "False"
|
self.task_dict["Base"] = "False"
|
||||||
if "完成任务: Fight" in log or "剿灭任务失败" in log:
|
if (
|
||||||
|
"完成任务: Fight" in log
|
||||||
|
or "完成任务: 刷理智" in log
|
||||||
|
or "剿灭任务失败" in log
|
||||||
|
):
|
||||||
self.task_dict["Combat"] = "False"
|
self.task_dict["Combat"] = "False"
|
||||||
if "完成任务: Mall" in log:
|
if "完成任务: Mall" in log or "完成任务: 获取信用及购物" in log:
|
||||||
self.task_dict["Mall"] = "False"
|
self.task_dict["Mall"] = "False"
|
||||||
if "完成任务: Award" in log:
|
if "完成任务: Award" in log or "完成任务: 领取奖励" in log:
|
||||||
self.task_dict["Mission"] = "False"
|
self.task_dict["Mission"] = "False"
|
||||||
if "完成任务: Roguelike" in log:
|
if "完成任务: Roguelike" in log or "完成任务: 自动肉鸽" in log:
|
||||||
self.task_dict["AutoRoguelike"] = "False"
|
self.task_dict["AutoRoguelike"] = "False"
|
||||||
if "完成任务: Reclamation" in log:
|
if "完成任务: Reclamation" in log or "完成任务: 生息演算" in log:
|
||||||
self.task_dict["Reclamation"] = "False"
|
self.task_dict["Reclamation"] = "False"
|
||||||
|
|
||||||
if all(v == "False" for v in self.task_dict.values()):
|
if all(v == "False" for v in self.task_dict.values()):
|
||||||
@@ -1171,7 +1175,7 @@ class MaaManager(QObject):
|
|||||||
self.maa_result = "Wait"
|
self.maa_result = "Wait"
|
||||||
|
|
||||||
elif mode == "人工排查":
|
elif mode == "人工排查":
|
||||||
if "完成任务: StartUp" in log:
|
if "完成任务: StartUp" in log or "完成任务: 开始唤醒" in log:
|
||||||
self.maa_result = "Success!"
|
self.maa_result = "Success!"
|
||||||
elif "请 「检查连接设置」 → 「尝试重启模拟器与 ADB」 → 「重启电脑」" in log:
|
elif "请 「检查连接设置」 → 「尝试重启模拟器与 ADB」 → 「重启电脑」" in log:
|
||||||
self.maa_result = "MAA的ADB连接异常"
|
self.maa_result = "MAA的ADB连接异常"
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import subprocess
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Union, List, Dict
|
from typing import List, Dict
|
||||||
|
|
||||||
|
|
||||||
from app.core import Config, SoundPlayer
|
from app.core import Config, SoundPlayer
|
||||||
@@ -100,9 +100,9 @@ class History(QWidget):
|
|||||||
datetime(end_date.year(), end_date.month(), end_date.day()),
|
datetime(end_date.year(), end_date.month(), end_date.day()),
|
||||||
)
|
)
|
||||||
|
|
||||||
for date, user in history_dict.items():
|
for date, user_dict in history_dict.items():
|
||||||
|
|
||||||
self.history_card_list.append(self.HistoryCard(mode, date, user, self))
|
self.history_card_list.append(self.HistoryCard(date, user_dict, self))
|
||||||
self.content_layout.addWidget(self.history_card_list[-1])
|
self.content_layout.addWidget(self.history_card_list[-1])
|
||||||
|
|
||||||
self.content_layout.addStretch(1)
|
self.content_layout.addStretch(1)
|
||||||
@@ -172,14 +172,9 @@ class History(QWidget):
|
|||||||
self.search.clicked.emit()
|
self.search.clicked.emit()
|
||||||
|
|
||||||
class HistoryCard(QuickExpandGroupCard):
|
class HistoryCard(QuickExpandGroupCard):
|
||||||
|
"""历史记录卡片"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, date: str, user_dict: Dict[str, List[Path]], parent=None):
|
||||||
self,
|
|
||||||
mode: str,
|
|
||||||
date: str,
|
|
||||||
user: Union[List[Path], Dict[str, List[Path]]],
|
|
||||||
parent=None,
|
|
||||||
):
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
FluentIcon.HISTORY, date, f"{date}的历史运行记录与统计信息", parent
|
FluentIcon.HISTORY, date, f"{date}的历史运行记录与统计信息", parent
|
||||||
)
|
)
|
||||||
@@ -192,64 +187,28 @@ class History(QWidget):
|
|||||||
|
|
||||||
self.user_history_card_list = []
|
self.user_history_card_list = []
|
||||||
|
|
||||||
if mode == "按日合并":
|
for user, info in user_dict.items():
|
||||||
|
self.user_history_card_list.append(
|
||||||
for user_path in user:
|
self.UserHistoryCard(user, info, self)
|
||||||
self.user_history_card_list.append(
|
)
|
||||||
self.UserHistoryCard(mode, user_path.stem, user_path, self)
|
Layout.addWidget(self.user_history_card_list[-1])
|
||||||
)
|
|
||||||
Layout.addWidget(self.user_history_card_list[-1])
|
|
||||||
|
|
||||||
elif mode in ["按周合并", "按月合并"]:
|
|
||||||
|
|
||||||
for user, info in user.items():
|
|
||||||
self.user_history_card_list.append(
|
|
||||||
self.UserHistoryCard(mode, user, info, self)
|
|
||||||
)
|
|
||||||
Layout.addWidget(self.user_history_card_list[-1])
|
|
||||||
|
|
||||||
class UserHistoryCard(HeaderCardWidget):
|
class UserHistoryCard(HeaderCardWidget):
|
||||||
"""用户历史记录卡片"""
|
"""用户历史记录卡片"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, name: str, user_history: List[Path], parent=None):
|
||||||
self,
|
|
||||||
mode: str,
|
|
||||||
name: str,
|
|
||||||
user_history: Union[Path, List[Path]],
|
|
||||||
parent=None,
|
|
||||||
):
|
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.setTitle(name)
|
self.setTitle(name)
|
||||||
|
|
||||||
if mode == "按日合并":
|
self.user_history = user_history
|
||||||
|
|
||||||
self.user_history_path = user_history
|
self.index_card = self.IndexCard(self.user_history, self)
|
||||||
self.main_history = Config.load_maa_logs("总览", user_history)
|
self.index_card.index_changed.connect(self.update_info)
|
||||||
|
|
||||||
self.index_card = self.IndexCard(
|
|
||||||
self.main_history["条目索引"], self
|
|
||||||
)
|
|
||||||
self.index_card.index_changed.connect(self.update_info)
|
|
||||||
self.viewLayout.addWidget(self.index_card)
|
|
||||||
|
|
||||||
elif mode in ["按周合并", "按月合并"]:
|
|
||||||
|
|
||||||
history = Config.merge_maa_logs("指定项", user_history)
|
|
||||||
|
|
||||||
self.main_history = {}
|
|
||||||
self.main_history["统计数据"] = {
|
|
||||||
"公招统计": list(history["recruit_statistics"].items())
|
|
||||||
}
|
|
||||||
|
|
||||||
for game_id, drops in history["drop_statistics"].items():
|
|
||||||
self.main_history["统计数据"][f"掉落统计:{game_id}"] = list(
|
|
||||||
drops.items()
|
|
||||||
)
|
|
||||||
|
|
||||||
self.statistics_card = QHBoxLayout()
|
self.statistics_card = QHBoxLayout()
|
||||||
self.log_card = self.LogCard(self)
|
self.log_card = self.LogCard(self)
|
||||||
|
|
||||||
|
self.viewLayout.addWidget(self.index_card)
|
||||||
self.viewLayout.addLayout(self.statistics_card)
|
self.viewLayout.addLayout(self.statistics_card)
|
||||||
self.viewLayout.addWidget(self.log_card)
|
self.viewLayout.addWidget(self.log_card)
|
||||||
self.viewLayout.setContentsMargins(0, 0, 0, 0)
|
self.viewLayout.setContentsMargins(0, 0, 0, 0)
|
||||||
@@ -259,19 +218,45 @@ class History(QWidget):
|
|||||||
|
|
||||||
self.update_info("数据总览")
|
self.update_info("数据总览")
|
||||||
|
|
||||||
|
def get_statistics(self, mode: str) -> dict:
|
||||||
|
"""生成GUI相应结构化统计数据"""
|
||||||
|
|
||||||
|
history_info = Config.merge_statistic_info(
|
||||||
|
self.user_history if mode == "数据总览" else [Path(mode)]
|
||||||
|
)
|
||||||
|
|
||||||
|
statistics_info = {}
|
||||||
|
|
||||||
|
if "recruit_statistics" in history_info:
|
||||||
|
statistics_info["公招统计"] = list(
|
||||||
|
history_info["recruit_statistics"].items()
|
||||||
|
)
|
||||||
|
|
||||||
|
if "drop_statistics" in history_info:
|
||||||
|
for game_id, drops in history_info["drop_statistics"].items():
|
||||||
|
statistics_info[f"掉落统计:{game_id}"] = list(drops.items())
|
||||||
|
|
||||||
|
if mode == "数据总览" and "error_info" in history_info:
|
||||||
|
statistics_info["报错汇总"] = list(
|
||||||
|
history_info["error_info"].items()
|
||||||
|
)
|
||||||
|
|
||||||
|
return statistics_info
|
||||||
|
|
||||||
def update_info(self, index: str) -> None:
|
def update_info(self, index: str) -> None:
|
||||||
"""更新信息"""
|
"""更新信息"""
|
||||||
|
|
||||||
|
# 移除已有统计信息UI组件
|
||||||
|
while self.statistics_card.count() > 0:
|
||||||
|
item = self.statistics_card.takeAt(0)
|
||||||
|
if item.spacerItem():
|
||||||
|
self.statistics_card.removeItem(item.spacerItem())
|
||||||
|
elif item.widget():
|
||||||
|
item.widget().deleteLater()
|
||||||
|
|
||||||
if index == "数据总览":
|
if index == "数据总览":
|
||||||
|
|
||||||
while self.statistics_card.count() > 0:
|
for name, item_list in self.get_statistics("数据总览").items():
|
||||||
item = self.statistics_card.takeAt(0)
|
|
||||||
if item.spacerItem():
|
|
||||||
self.statistics_card.removeItem(item.spacerItem())
|
|
||||||
elif item.widget():
|
|
||||||
item.widget().deleteLater()
|
|
||||||
|
|
||||||
for name, item_list in self.main_history["统计数据"].items():
|
|
||||||
|
|
||||||
statistics_card = self.StatisticsCard(name, item_list, self)
|
statistics_card = self.StatisticsCard(name, item_list, self)
|
||||||
self.statistics_card.addWidget(statistics_card)
|
self.statistics_card.addWidget(statistics_card)
|
||||||
@@ -280,44 +265,24 @@ class History(QWidget):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
single_history = Config.load_maa_logs(
|
single_history = self.get_statistics(index)
|
||||||
"单项",
|
log_path = Path(index).with_suffix(".log")
|
||||||
self.user_history_path.with_suffix("")
|
|
||||||
/ f"{index.replace(":","-")}.json",
|
|
||||||
)
|
|
||||||
|
|
||||||
while self.statistics_card.count() > 0:
|
|
||||||
item = self.statistics_card.takeAt(0)
|
|
||||||
if item.spacerItem():
|
|
||||||
self.statistics_card.removeItem(item.spacerItem())
|
|
||||||
elif item.widget():
|
|
||||||
item.widget().deleteLater()
|
|
||||||
|
|
||||||
for name, item_list in single_history["统计数据"].items():
|
|
||||||
|
|
||||||
|
for name, item_list in single_history.items():
|
||||||
statistics_card = self.StatisticsCard(name, item_list, self)
|
statistics_card = self.StatisticsCard(name, item_list, self)
|
||||||
self.statistics_card.addWidget(statistics_card)
|
self.statistics_card.addWidget(statistics_card)
|
||||||
|
|
||||||
self.log_card.text.setText(single_history["日志信息"])
|
with log_path.open("r", encoding="utf-8") as f:
|
||||||
|
log = f.read()
|
||||||
|
|
||||||
|
self.log_card.text.setText(log)
|
||||||
self.log_card.open_file.clicked.disconnect()
|
self.log_card.open_file.clicked.disconnect()
|
||||||
self.log_card.open_file.clicked.connect(
|
self.log_card.open_file.clicked.connect(
|
||||||
lambda: os.startfile(
|
lambda: os.startfile(log_path)
|
||||||
self.user_history_path.with_suffix("")
|
|
||||||
/ f"{index.replace(":","-")}.log"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
self.log_card.open_dir.clicked.disconnect()
|
self.log_card.open_dir.clicked.disconnect()
|
||||||
self.log_card.open_dir.clicked.connect(
|
self.log_card.open_dir.clicked.connect(
|
||||||
lambda: subprocess.Popen(
|
lambda: subprocess.Popen(["explorer", "/select,", log_path])
|
||||||
[
|
|
||||||
"explorer",
|
|
||||||
"/select,",
|
|
||||||
str(
|
|
||||||
self.user_history_path.with_suffix("")
|
|
||||||
/ f"{index.replace(":","-")}.log"
|
|
||||||
),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
self.log_card.show()
|
self.log_card.show()
|
||||||
|
|
||||||
@@ -329,7 +294,7 @@ class History(QWidget):
|
|||||||
|
|
||||||
index_changed = Signal(str)
|
index_changed = Signal(str)
|
||||||
|
|
||||||
def __init__(self, index_list: list, parent=None):
|
def __init__(self, history_list: List[Path], parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setTitle("记录条目")
|
self.setTitle("记录条目")
|
||||||
|
|
||||||
@@ -339,11 +304,14 @@ class History(QWidget):
|
|||||||
|
|
||||||
self.index_cards: List[StatefulItemCard] = []
|
self.index_cards: List[StatefulItemCard] = []
|
||||||
|
|
||||||
|
index_list = Config.merge_statistic_info(history_list)["index"]
|
||||||
|
index_list.insert(0, ["数据总览", "运行", "数据总览"])
|
||||||
|
|
||||||
for index in index_list:
|
for index in index_list:
|
||||||
|
|
||||||
self.index_cards.append(StatefulItemCard(index))
|
self.index_cards.append(StatefulItemCard(index[:2]))
|
||||||
self.index_cards[-1].clicked.connect(
|
self.index_cards[-1].clicked.connect(
|
||||||
partial(self.index_changed.emit, index[0])
|
partial(self.index_changed.emit, str(index[2]))
|
||||||
)
|
)
|
||||||
self.Layout.addWidget(self.index_cards[-1])
|
self.Layout.addWidget(self.index_cards[-1])
|
||||||
|
|
||||||
|
|||||||
@@ -1392,12 +1392,12 @@ class MemberManager(QWidget):
|
|||||||
QTableWidgetItem(
|
QTableWidgetItem(
|
||||||
Config.stage_dict["ALL"]["text"][
|
Config.stage_dict["ALL"]["text"][
|
||||||
Config.stage_dict["ALL"]["value"].index(
|
Config.stage_dict["ALL"]["value"].index(
|
||||||
stage_info["Stage"]
|
stage_info["Stage_1"]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
if stage_info["Stage"]
|
if stage_info["Stage_1"]
|
||||||
in Config.stage_dict["ALL"]["value"]
|
in Config.stage_dict["ALL"]["value"]
|
||||||
else stage_info["Stage"]
|
else stage_info["Stage_1"]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.dashboard.setItem(
|
self.dashboard.setItem(
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
{
|
{
|
||||||
"main_version": "4.4.0.6",
|
"main_version": "4.4.0.0",
|
||||||
"version_info": {
|
"version_info": {
|
||||||
"4.4.0.6": {
|
"4.4.0.0": {
|
||||||
"修复BUG": [
|
"修复BUG": [
|
||||||
"信任系统证书,并添加网络代理地址配置项 #50"
|
"信任系统证书,并添加网络代理地址配置项 #50",
|
||||||
|
"适配 MAA 任务及基建设施日志翻译"
|
||||||
|
],
|
||||||
|
"程序优化": [
|
||||||
|
"重构历史记录保存与载入逻辑"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"4.4.0.5": {
|
"4.4.0.5": {
|
||||||
|
|||||||
Reference in New Issue
Block a user