From f43a07d51143480ea67080b94a7dd16b2b52e5a8 Mon Sep 17 00:00:00 2001 From: Zzaphkiel Date: Tue, 10 Dec 2024 17:12:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=9D=99=E9=BB=98=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E4=BB=A5=E5=8F=8A=E8=AE=BE=E7=BD=AE=E9=A1=B9=20(#557)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/config.py | 3 + app/common/icons.py | 1 + app/resource/i18n/Seraphine.zh_CN.qm | Bin 36678 -> 36886 bytes app/resource/i18n/Seraphine.zh_CN.ts | 306 ++++++++++++++------------- app/resource/icons/Snooze_black.svg | 5 + app/resource/icons/Snooze_white.svg | 5 + app/view/main_window.py | 13 +- app/view/setting_interface.py | 9 + 8 files changed, 191 insertions(+), 151 deletions(-) create mode 100644 app/resource/icons/Snooze_black.svg create mode 100644 app/resource/icons/Snooze_white.svg diff --git a/app/common/config.py b/app/common/config.py index 6406540..3cabbde 100644 --- a/app/common/config.py +++ b/app/common/config.py @@ -163,6 +163,9 @@ class Config(QConfig): enableReserveGameinfo = ConfigItem( "Functions", "EnableReserveGameinfo", False, BoolValidator()) + enableSilent = ConfigItem( + "General", "EnableSilent", False, BoolValidator()) + YEAR = 2023 AUTHOR = "Zzaphkiel" diff --git a/app/common/icons.py b/app/common/icons.py index cab0c78..d3cc578 100644 --- a/app/common/icons.py +++ b/app/common/icons.py @@ -66,6 +66,7 @@ class Icon(FluentIconBase, Enum): ERASER = "Eraser" ATTACHTEXT = "AttachText" TEXTCOLOR = "TextColor" + SNOOZE = "Snooze" def path(self, theme=Theme.AUTO): return f'./app/resource/icons/{self.value}_{getIconColor(theme)}.svg' diff --git a/app/resource/i18n/Seraphine.zh_CN.qm b/app/resource/i18n/Seraphine.zh_CN.qm index 15b48d2326d9132eb7d439b3f66e27282872a5a0..aa1be46975f7183b8ab55311e5dbb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$gV4f0k`?WUX@aecAMK{7+?5;&s${3 zOmYJK?`jq_Y6kX^%NS2Pjs2M~kJ^l>teB|BXkot3^w+q8ud>4Akc+#F7w!V6XrVTf zIiX~`@p*4FFzB`BuuYo&A=G1Xu=4w4Rm=%x_f1vrjsZmvOu=2;g!88QLlQ5dnPw_k ztg?ebiY242QJHsqH*ax^Qk0y}VSdX@C(id;3JbtC^Tr!^}F(`YqGZEWX_3~W-Hu8MpS9l2C*#3&aUwp(ZxwAAMB>nE(I) diff --git a/app/resource/i18n/Seraphine.zh_CN.ts b/app/resource/i18n/Seraphine.zh_CN.ts index 5cef3ad..7e557ad 100644 --- a/app/resource/i18n/Seraphine.zh_CN.ts +++ b/app/resource/i18n/Seraphine.zh_CN.ts @@ -85,12 +85,12 @@ 第一率: - + Games 对局 - + First Rate 第一率 @@ -159,12 +159,12 @@ 已启用,自动禁用: - + Disabled 未启用 - + Enable: 启用自动 Ban: @@ -174,67 +174,67 @@ 若队友预选该英雄,则空 Ban: - + Ban after a delay of seconds: 在进入禁用阶段后 Ban 人的秒数: - + Default Configurations 默认设置 - + Default champions: 默认禁用英雄: - + Choose 选择 - + Rank Configurations 按照位置设置 - + Top: 上路: - + Juggle: 打野: - + Mid: 中路: - + Bottom: 下路: - + Support: 辅助: - + Prevent banning champions picked by teammates: 若队友预选该英雄,则空 Ban: - + Reset 恢复默认 - + Enabled 已启用 @@ -248,7 +248,7 @@ 若非排位模式或按位置设置英雄不可用,则将使用默认设置 - + Default settings must be set. If champions set by lane are not available, default settings will be used. @@ -270,7 +270,7 @@ If champions set by lane are not available, default settings will be used.已启用,自动选择: - + Disabled 未启用 @@ -280,7 +280,7 @@ If champions set by lane are not available, default settings will be used.将要自动亮起的英雄: - + Enable: 启用自动亮起: @@ -290,7 +290,7 @@ If champions set by lane are not available, default settings will be used.在时间结束后确定选择(更换亮起英雄后无效) - + Completed before timeout: 在时间结束时确定选择: @@ -310,57 +310,57 @@ If champions set by lane are not available, default settings will be used.将要自动亮起的英雄: - + Default Configurations 默认设置 - + Default champions: 默认亮起英雄: - + Choose 选择 - + Rank Configurations 按照位置设置 - + Top: 上路: - + Juggle: 打野: - + Mid: 中路: - + Bottom: 下路: - + Support: 辅助: - + Enabled 已启用 - + Reset 恢复默认 @@ -374,7 +374,7 @@ If champions set by lane are not available, default settings will be used. - + Default settings must be set. If champions set by lane are not available, default settings will be used. @@ -753,12 +753,12 @@ If champions set by lane are not available, default settings will be used. ChampionPerksWidget - + Set Rune Page 设为当前符文页 - + : @@ -779,7 +779,7 @@ If champions set by lane are not available, default settings will be used.英雄技能 - + Games 局游戏 @@ -787,27 +787,27 @@ If champions set by lane are not available, default settings will be used. ChampionTitleBar - + Win Rate 胜率 - + Pick Rate 登场率 - + Ban Rate 禁用率 - + First Rate 第一率 - + Average Place 平均排名 @@ -986,12 +986,12 @@ If champions set by lane are not available, default settings will be used. ErrorInterface - + Fetch data failed 😭 数据拉取失败 😭 - + Please wait and try again 请等待后重试 @@ -1030,32 +1030,32 @@ If champions set by lane are not available, default settings will be used. FriendRequestCard - + Send 发送 - + Please input summoner's name 请输入召唤师名及编号 - + Summoner not found 召唤师未找到 - + Please check the summoner's name and retry 请检查召唤师名后重试 - + Send friend request successfully 发送好友请求成功 - + Summoners's name you want to send friend request to: 你想加好友的召唤师名: @@ -1283,7 +1283,7 @@ If champions set by lane are not available, default settings will be used. HomeInterface - + Waiting for LOL Client 等待客户端连接中 @@ -1296,7 +1296,7 @@ If champions set by lane are not available, default settings will be used. ItemsWidget - + Games 局游戏 @@ -1376,27 +1376,27 @@ If champions set by lane are not available, default settings will be used. MainWindow - + Career 生涯 - + Game Information 对局信息 - + Start LOL 启动游戏 - + Settings 设置 - + Auxiliary Functions 其他功能 @@ -1406,92 +1406,92 @@ If champions set by lane are not available, default settings will be used.客户端已连接 - + Invalid path 路径非法 - + Please set the correct directory of the LOL client in the setting page 请在设置页面中设置正确的 LOL 客户端路径 - + Start 启动页 - + Start LOL successfully 启动客户端成功 - + Home 游戏大厅 - + Selecting Champions 英雄选择 - + Gaming 游戏中 - + Waiting for status 等待游戏结果 - + End of game 游戏结束 - + Lobby 房间组队中 - + Ready check 匹配确认 - + Match making 匹配中 - + Exception occurred 😥 程序出现异常 😥 - + Search 👀 战绩查询 👀 - + Exit 直接退出 - + Minimize 最小化到任务栏 - + Quit 退出 - + Do you wish to exit? 你第一次点击了关闭按钮 @@ -1502,47 +1502,47 @@ If champions set by lane are not available, default settings will be used.请选择点击关闭按钮的默认行为 - + Check Update Failed 检查更新失败 - + Failed to check for updates, possibly unable to connect to Github. 请确保能连接至 GitHub - + Connect API 请求 API - + The server returned abnormal content, which may be under maintenance. 服务器返回了不正常内容,可能其正在维护中 - + Exceeded maximum retry attempts. 超出最大尝试次数 - + LCU request error 客户端信息请求失败 - + Blue Team 蓝色方 - + Red Team 红色方 - + Waiting reconnect 等待重新连接 @@ -1557,7 +1557,7 @@ If champions set by lane are not available, default settings will be used.tasklist.exe 似乎在您的电脑上不可用 - + Notice 公告 @@ -1567,47 +1567,47 @@ If champions set by lane are not available, default settings will be used.复制错误信息并退出 - + Back to Lobby 修复无限加载 - + Fetch notice Failed 拉取公告失败 - + Failed to fetch notice, possibly unable to connect to Github. 请确保能连接至 GitHub - + ( - + ) - + , - + Get cmdline error 获取启动参数失败 - + Try running Seraphine as an administrator 请尝试使用管理员身份启动 Seraphine - + Choose action for close button (you can modify it at any time in the settings page) 请选择点击关闭按钮的默认行为 @@ -2049,7 +2049,7 @@ If champions set by lane are not available, default settings will be used.辅助 - + Version: 游戏版本: @@ -2098,7 +2098,7 @@ If champions set by lane are not available, default settings will be used. PerksSummaryWidget - + Games 局游戏 @@ -2476,7 +2476,7 @@ If champions set by lane are not available, default settings will be used. SearchLineEditFlyout - + Search champions 搜索英雄 @@ -2504,82 +2504,82 @@ If champions set by lane are not available, default settings will be used.客户端路径 - + Auto-start LOL 自动启动游戏 - + Launch LOL client upon opening Seraphine automatically 启动 Seraphine 时自动启动 LOL 客户端 - + Personalization 个性化 - + Application theme 应用主题 - + Change the appearance of Seraphine 调整 Seraphine 的外观主题 - + Light 浅色 - + Dark 深色 - + Use system setting 跟随系统设置 - + Theme color 主题色 - + Change the theme color of Seraphine 调整 Seraphine 的主题色 - + Interface zoom 界面缩放 - + Change the size of widgets and fonts 调整部件和字体的大小 - + Updated successfully 更新成功 - + Configuration takes effect after restart 设置在重启软件后生效 - + Language 语言 - + Set your preferred language for Seraphine 选择 Seraphine 所使用的语言 @@ -2610,52 +2610,52 @@ If champions set by lane are not available, default settings will be used.在对局详情界面中显示段位图标,启动该选项将影响加载该界面的速度 - + About 关于 - + Provide feedback 提供反馈 - + Help us improve Seraphine by providing feedback 通过提供反馈帮助我们改善 Seraphine - + Copyright 版权所有 - + Version 当前版本 - + Delete 删除 - + Delete cache 清除缓存 - + Delete all game resources (Apply it when game resources update) 删除所有游戏资源的缓存(建议在游戏资源有更新时使用) - + View GitHub 查看 GitHub - + Really? 真的要删除吗? @@ -2667,32 +2667,32 @@ If champions set by lane are not available, default settings will be used. - + Confirm delete 确定删除 - + Mica effect 云母效果 - + Apply semi transparent to windows and surfaces (only available on Win11) 窗口和表面显示半透明(仅在 Win11 上可用) - + Minimize to tray on close 最小化到任务栏托盘 - + Minimize to system tray when clicking close 点击右上角关闭时将程序最小化到托盘 - + Settings have been applied 设置已应用 @@ -2707,12 +2707,12 @@ If champions set by lane are not available, default settings will be used.打开此选项后,当你在排位时,对局信息界面将只显示排位模式对局战绩 - + Check for updates 检查更新 - + Automatically check for updates when software starts 在 Seraphine 启动时自动检查更新 @@ -2732,12 +2732,12 @@ If champions set by lane are not available, default settings will be used.在游戏时通过避免渲染窗口以减少 CPU 使用 - + Log Level 日志等级 - + The level of logging for Seraphine (take effect after restart) 修改 Seraphine 记录日志的等级(重启后生效) @@ -2747,12 +2747,12 @@ If champions set by lane are not available, default settings will be used.HTTP 代理 - + Using a proxy when connecting to GitHub 连接 GitHub 时启用 HTTP 代理 - + Update 软件更新 @@ -2772,32 +2772,32 @@ If champions set by lane are not available, default settings will be used.该值越大数据加载速度越快,但越可能引起客户端闪退 - + Game tabs color 对局卡片颜色 - + Change the color of game tabs 改变对局卡片提示胜利 / 失败的颜色 - + HTTP proxy HTTP 代理 - + Open 打开文件夹 - + Log file 日志文件 - + Open log directory 打开日志文件夹 @@ -2812,7 +2812,7 @@ If champions set by lane are not available, default settings will be used.设置客户端路径以及顺序 - + Log 日志 @@ -2822,7 +2822,7 @@ If champions set by lane are not available, default settings will be used.在搜索界面对局详情界面中显示段位,启动该选项将影响加载该界面的速度 - + Game resources will be downloaded again when they are used by Seraphine, which will cost more time 游戏资源将会在它们要被 Seraphine 使用时重新下载, @@ -2869,15 +2869,25 @@ when they are used by Seraphine, which will cost more time 保留上一局的对局信息内容直到下一次对局开始 - + Deaths number color 死亡数字体颜色 - + Change the color of Deaths number of KDA 改变 KDA 标签中死亡数字的字体颜色 + + + Silently start + 静默启动 + + + + Show Seraphine window minimized when it starts + 启动 Seraphine 后最小化窗口到任务栏托盘 + SpectateCard @@ -2940,7 +2950,7 @@ when they are used by Seraphine, which will cost more time Spell - + Games 局游戏 @@ -3086,17 +3096,17 @@ when they are used by Seraphine, which will cost more time SynergyItemWidget - + Average Place 平均排名 - + First Rate 第一率 - + Games 局游戏 diff --git a/app/resource/icons/Snooze_black.svg b/app/resource/icons/Snooze_black.svg new file mode 100644 index 0000000..1d7f59b --- /dev/null +++ b/app/resource/icons/Snooze_black.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/app/resource/icons/Snooze_white.svg b/app/resource/icons/Snooze_white.svg new file mode 100644 index 0000000..d27433e --- /dev/null +++ b/app/resource/icons/Snooze_white.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/app/view/main_window.py b/app/view/main_window.py index 29b66d6..8356b0e 100644 --- a/app/view/main_window.py +++ b/app/view/main_window.py @@ -11,7 +11,7 @@ import asyncio from aiohttp.client_exceptions import ClientConnectorError from qasync import asyncClose, asyncSlot -from PyQt5.QtCore import Qt, pyqtSignal, QSize, QEvent +from PyQt5.QtCore import Qt, pyqtSignal, QSize, QEvent, QTimer from PyQt5.QtGui import QIcon, QImage from PyQt5.QtWidgets import QApplication, QSystemTrayIcon @@ -101,8 +101,6 @@ def __init__(self): self.lastTipsTime = time.time() self.lastTipsType = None - self.isDragging = False - self.__initInterface() self.__initNavigation() self.__initListener() @@ -115,6 +113,8 @@ def __init__(self): logger.critical("Seraphine initialized", TAG) + self.__silentStart() + def __initConfig(self): folder = cfg.get(cfg.lolFolder) @@ -278,6 +278,7 @@ def __initWindow(self): self.move(w // 2 - self.width() // 2, h // 2 - self.height() // 2) self.show() + QApplication.processEvents() self.oldHook = sys.excepthook @@ -740,6 +741,12 @@ async def closeEvent(self, a0) -> None: a0.ignore() self.hide() + def __silentStart(self): + if not cfg.get(cfg.enableSilent): + return + + QTimer.singleShot(0, self.hide) + @asyncSlot(str) async def __switchToSearchInterface(self, name): self.searchInterface.searchLineEdit.setText(name) diff --git a/app/view/setting_interface.py b/app/view/setting_interface.py index 489cd3b..21c9810 100644 --- a/app/view/setting_interface.py +++ b/app/view/setting_interface.py @@ -91,6 +91,13 @@ def __init__(self, parent=None): self.lolFolderCard.button.setStyleSheet( "QPushButton {padding-left: 0; padding-right: 0;}") + self.silentCard = SwitchSettingCard( + Icon.SNOOZE, self.tr("Silently start"), + self.tr( + "Show Seraphine window minimized when it starts"), + cfg.enableSilent + ) + self.logGroup = SettingCardGroup(self.tr("Log"), self.scrollWidget) self.logLevelCard = ComboBoxSettingCard( @@ -197,6 +204,7 @@ def __init__(self, parent=None): self.updateGroup = SettingCardGroup( self.tr("Update"), self.scrollWidget) + self.checkUpdateCard = SwitchSettingCard( Icon.UPDATE, self.tr("Check for updates"), self.tr( @@ -261,6 +269,7 @@ def __initLayout(self): self.generalGroup.addSettingCard(self.enableStartLolWithApp) self.generalGroup.addSettingCard(self.deleteResourceCard) self.generalGroup.addSettingCard(self.enableCloseToTray) + self.generalGroup.addSettingCard(self.silentCard) self.logGroup.addSettingCard(self.logLevelCard) self.logGroup.addSettingCard(self.viewLogCard)