diff --git a/README.md b/README.md index aaf6ed7..8a8f06c 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ English | 简体中文 ### Software Screenshots -![front_page](images/home.png) -![sidebar](images/home_tab.png) -![cfg_management](images/cfg.png) -![resource_management](images/resouces.png) -![server_list_management](images/server_list.png) -![setting](images/settings.png) \ No newline at end of file +![front_page](images/zh/home.png) +![sidebar](images/zh/home_tab.png) +![cfg_management](images/zh/cfg.png) +![resource_management](images/zh/resouces.png) +![server_list_management](images/zh/server_list.png) +![setting](images/zh/settings.png) \ No newline at end of file diff --git a/README_zh.md b/README_zh.md index c24c61a..ab580af 100644 --- a/README_zh.md +++ b/README_zh.md @@ -30,9 +30,9 @@ ### 软件截图 -![首页](images/home.png) -![侧栏](images/home_tab.png) -![cfg管理](images/cfg.png) -![资源管理](images/resouces.png) -![服务器列表管理](images/server_list.png) -![设置](images/settings.png) \ No newline at end of file +![首页](images/zh/home.png) +![侧栏](images/zh/home_tab.png) +![cfg管理](images/zh/cfg.png) +![资源管理](images/zh/resouces.png) +![服务器列表管理](images/zh/server_list.png) +![设置](images/zh/settings.png) \ No newline at end of file diff --git a/app/view/home_interface.py b/app/view/home_interface.py index f823e5e..1332c85 100644 --- a/app/view/home_interface.py +++ b/app/view/home_interface.py @@ -6,7 +6,8 @@ from app.config import cfg, base_path from PyQt5.QtCore import Qt, QThread, pyqtSignal, QTimer from PyQt5.QtWidgets import QVBoxLayout, QWidget, QHBoxLayout, QSpacerItem, QSizePolicy -from qfluentwidgets import ImageLabel, CardWidget, SubtitleLabel, BodyLabel, HeaderCardWidget, InfoBar, InfoBarPosition, CaptionLabel, FlowLayout, SingleDirectionScrollArea, setFont +from qfluentwidgets import ImageLabel, CardWidget, SubtitleLabel, BodyLabel, HeaderCardWidget, InfoBar, InfoBarPosition, \ + CaptionLabel, FlowLayout, SingleDirectionScrollArea, setFont from app.utils.network import ImageLoader @@ -59,11 +60,11 @@ def __init__(self, name: str, parent=None): self.labels = [ SubtitleLabel(name, self), - BodyLabel('全球排名:加载中...\n' - '游戏分数:加载中...\n' - '游玩时长:加载中...\n' - '最后完成:加载中...\n' - '入坑时间:加载中...', self), + BodyLabel(self.tr('全球排名:加载中...\n' + '游戏分数:加载中...\n' + '游玩时长:加载中...\n' + '最后完成:加载中...\n' + '入坑时间:加载中...'), self), ] for label in self.labels: @@ -88,21 +89,25 @@ def on_image_loaded(self, pixmap): def on_data_loaded(self, json_data: dict): if json_data == {}: - self.labels[1].setText(f'全球排名:NO.数据获取失败\n' - f'游戏分数:数据获取失败/数据获取失败 分\n' - f'游玩时长:数据获取失败 小时\n' - f'最后完成:数据获取失败\n' - f'入坑时间:数据获取失败') + self.labels[1].setText(self.tr('全球排名:NO.数据获取失败\n' + '游戏分数:数据获取失败/数据获取失败 分\n' + '游玩时长:数据获取失败 小时\n' + '最后完成:数据获取失败\n' + '入坑时间:数据获取失败')) return use_time = 0 for time in json_data['activity']: use_time = use_time + time['hours_played'] - self.labels[1].setText(f'全球排名:NO.{json_data["points"]["rank"]}\n' - f'游戏分数:{json_data["points"]["points"]}/{json_data["points"]["total"]} 分\n' - f'游玩时长:{use_time} 小时\n' - f'最后完成:{json_data["last_finishes"][0]["map"]}\n' - f'入坑时间:{datetime.datetime.fromtimestamp(json_data["first_finish"]["timestamp"])}') + self.labels[1].setText(self.tr('全球排名:NO.{}\n' + '游戏分数:{}/{} 分\n' + '游玩时长:{} 小时\n' + '最后完成:{}\n' + '入坑时间:{}').format(json_data["points"]["rank"], json_data["points"]["points"], + json_data["points"]["total"], use_time, + json_data["last_finishes"][0]["map"], + datetime.datetime.fromtimestamp( + json_data["first_finish"]["timestamp"]))) class FriendCard(CardWidget): @@ -182,7 +187,8 @@ def __init__(self, parent=None): self.hBoxLayout = QHBoxLayout() self.vBoxLayout.addLayout(self.hBoxLayout, Qt.AlignTop) - self.TEECARD(GlobalsVal.ddnet_setting_config.get("player_name", "nameless tee"), GlobalsVal.ddnet_setting_config.get("dummy_name", "[D] nameless te")) + self.TEECARD(GlobalsVal.ddnet_setting_config.get("player_name", "nameless tee"), + GlobalsVal.ddnet_setting_config.get("dummy_name", "[D] nameless te")) self.vBoxLayout.addWidget(FriendList(), Qt.AlignCenter) if cfg.get(cfg.DDNetCheckUpdate): @@ -205,7 +211,8 @@ def on_check_update_loaded(self, json_data: list): if GlobalsVal.ddnet_info['version'] != json_data[0]["version"]: InfoBar.warning( title=self.tr('DDNet 版本检测'), - content=self.tr("您当前的DDNet版本为 {} 最新版本为 {} 请及时更新").format(GlobalsVal.ddnet_info['version'], json_data[0]["version"]), + content=self.tr("您当前的DDNet版本为 {} 最新版本为 {} 请及时更新").format( + GlobalsVal.ddnet_info['version'], json_data[0]["version"]), orient=Qt.Horizontal, isClosable=True, position=InfoBarPosition.BOTTOM_RIGHT, diff --git a/images/cfg.png b/images/zh/cfg.png similarity index 100% rename from images/cfg.png rename to images/zh/cfg.png diff --git a/images/home.png b/images/zh/home.png similarity index 100% rename from images/home.png rename to images/zh/home.png diff --git a/images/home_tab.png b/images/zh/home_tab.png similarity index 100% rename from images/home_tab.png rename to images/zh/home_tab.png diff --git a/images/resouces.png b/images/zh/resouces.png similarity index 100% rename from images/resouces.png rename to images/zh/resouces.png diff --git a/images/server_list.png b/images/zh/server_list.png similarity index 100% rename from images/server_list.png rename to images/zh/server_list.png diff --git a/images/settings.png b/images/zh/settings.png similarity index 100% rename from images/settings.png rename to images/zh/settings.png