From a66ec5b6c6eb943c26d0839881eefa1b564e07d3 Mon Sep 17 00:00:00 2001 From: Zzaphkiel Date: Mon, 24 Jun 2024 17:25:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=97=B6=E5=B0=86=E6=9F=A5=E9=87=8D=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=A4=8D=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/multi_lol_path_setting.py | 50 ++++++++++------ app/resource/i18n/Seraphine.zh_CN.qm | Bin 30695 -> 31015 bytes app/resource/i18n/Seraphine.zh_CN.ts | 73 ++++++++++++++++------- 3 files changed, 86 insertions(+), 37 deletions(-) diff --git a/app/components/multi_lol_path_setting.py b/app/components/multi_lol_path_setting.py index 2b87a84..add577b 100644 --- a/app/components/multi_lol_path_setting.py +++ b/app/components/multi_lol_path_setting.py @@ -4,7 +4,8 @@ QLabel, QWidget, QSizePolicy, QFileDialog) from app.common.qfluentwidgets import (TransparentToolButton, FluentIcon, SearchLineEdit, FlowLayout, SmoothScrollArea, FlyoutViewBase, - BodyLabel) + BodyLabel, InfoBarPosition, InfoBar, ToolTipFilter, + ToolTipPosition) from app.common.style_sheet import StyleSheet @@ -14,6 +15,7 @@ class PathTabItem(DraggableItem): closedRequested = pyqtSignal() + editRequestd = pyqtSignal() def __init__(self, path: str, parent=None): super().__init__(parent=parent) @@ -38,7 +40,14 @@ def __intiWidget(self): self.closeButton.setFixedSize(QSize(26, 26)) self.closeButton.clicked.connect(self.closedRequested) - self.editButton.clicked.connect(self.__onEditButtonClicked) + self.editButton.clicked.connect(self.editRequestd) + + self.closeButton.setToolTip(self.tr("Delete")) + self.closeButton.installEventFilter( + ToolTipFilter(self.closeButton, 300)) + self.editButton.setToolTip(self.tr("Edit")) + self.editButton.installEventFilter( + ToolTipFilter(self.editButton, 300)) self.label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft) @@ -56,16 +65,6 @@ def __initLayout(self): self.hBoxLayout.addWidget( self.closeButton, alignment=Qt.AlignRight | Qt.AlignVCenter) - def __onEditButtonClicked(self): - path = QFileDialog.getExistingDirectory( - self, self.tr("Choose folder"), - self.label.text()) - - if not path: - return - - self.label.setText(path) - def sizeHint(self): return QSize(250, 44) @@ -79,16 +78,12 @@ def __initWidget(self, paths): self.setFixedHeight(318) for path in paths: - - # 别问为什么要判断一下,我也不知道为什么 - if type(path) is not str: - continue - self.addItem(path) def addItem(self, path): item = PathTabItem(path) item.closedRequested.connect(lambda i=item: self.removeItem(item)) + item.editRequestd.connect(lambda i=item: self.editItem(item)) self._addItem(item) @@ -100,3 +95,24 @@ def removeItem(self, item): def getCurrentPaths(self): return [item.label.text() for item in self.items] + + def editItem(self, item: PathTabItem): + path = QFileDialog.getExistingDirectory( + self, self.tr("Choose folder"), + item.label.text()) + + if not path: + return + + current = self.getCurrentPaths() + if path.lower() in [x.lower() for x in current]: + self.__showEditErrorInfo(path) + return + + item.label.setText(path) + + def __showEditErrorInfo(self, path): + InfoBar.error(self.tr("Editing failed"), + self.tr("Path \"") + path + self.tr("\" already exists"), + Qt.Vertical, True, 5000, InfoBarPosition.BOTTOM_RIGHT, + self.window()) diff --git a/app/resource/i18n/Seraphine.zh_CN.qm b/app/resource/i18n/Seraphine.zh_CN.qm index 24923b2a63f1074a9ceaeb22807699a674edb7bf..a7e0ad011b801035d560ed4f7d8e14ed242ebfe1 100644 GIT binary patch delta 2274 zcmZ`)dr(x@8UNk8_wK#>x{DiK745RFNKAc2r67tRuVr~7sJK4RMRpgAqg6misztFF ze4-v-7~`W=i>R1{F-|m!Rbv#J!j#x(bTm;~O^1kK5VeW1AGsYf(`ojydi8f1YFF>3LL}*nkxVgD>W4Z4`z%?A`H&{hyC6Fcq zj^{we4#4*{F!^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C4Ru{GIh)z0K4kcrq@JZd z(LG9EyDGH5q&|N}1g4o4=6I<)i;^i()e5Cw)O}|PDUq!#RI=zI`qcN<%?9G;vs}qC zFQrC39`GR`f2h>Mtdp-UO7rCMBmFC#{D`n@CuYb|}<6k~UYJCoxP&+tyB@^S?-y?KZmK zB2~{n2BcO=|I758c&UD%95B~Q2gK*p@0C)EQzfQDwM+V}tr}R7 ze3`A#SlyyCHA!cm(A-$4$^BtJuzJ1b4+n=y=!-P#&fO)2A7XnoUT&*C(_E~*4!D># z-2*>Ss(;m7bIqeT&uRKvd#JG6*&U6CTlT0n@Eckh4{8(lQr~#Kqh0wkNj2`7Hl_Iy z)%ka9j@Ig&{)P5#=?UtO*A&_&6lO=WT&3 zegsg(>RQZSQK&t-wyriBG0${ew(kLbwr(O?AVvRMH}M;FS$KwC%CuAc59w$0+^6aC zg1yjMBcf01gVzkv(pzD%tA5$cP+)q#!svSni&yJIChtXf=tC#Z0~RTa$YHrUtB*Zg zUw(HvJ@HfhCbuf;h&=t)JFikA^YnY2B*1W7f4Cuo3jVeJXt9;@AILt@g>a!Cun}E| zBXN^qn}uQz{;T1@sb13NkfAlJ3s_ifXf1u0ns=JvQ`$yevY}J80r2}$VS0?A_lS|s z2Mk}2n1Q*s4c{K}r18~k7+y*H!4-xd{Y+#>Cu{qiNj5pM&j?lBy+uwPdrEEHB$vED z3 z+|Wn{d5he&s|0Y8客户端已连接 - + Invalid path 路径非法 - + Please set the correct directory of the LOL client in the setting page 请在设置页面中设置正确的 LOL 客户端路径 @@ -1177,52 +1177,52 @@ 启动页 - + Start LOL successfully 启动客户端成功 - + Home 游戏大厅 - + Selecting Champions 英雄选择 - + Gaming 游戏中 - + Waiting for status 等待游戏结果 - + End of game 游戏结束 - + Lobby 房间组队中 - + Ready check 匹配确认 - + Match making 匹配中 - + Exception occurred 😥 程序出现异常 😥 @@ -1232,12 +1232,12 @@ 战绩查询 👀 - + Exit 直接退出 - + Minimize 最小化到任务栏 @@ -1247,7 +1247,7 @@ 退出 - + Do you wish to exit? 你第一次点击了关闭按钮 @@ -1288,17 +1288,17 @@ 客户端信息请求失败 - + Blue Team 蓝色方 - + Red Team 红色方 - + Waiting reconnect 等待重新连接 @@ -1353,7 +1353,7 @@ - + Choose action for close button (you can modify it at any time in the settings page) 请选择点击关闭按钮的默认行为 @@ -1549,12 +1549,45 @@ 你想要改成的在线状态(签名): + + PathDraggableWidget + + + Choose folder + 选择文件夹 + + + + Editing failed + 修改失败 + + + + Path " + 路径 “ + + + + " already exists + ” 已经存在 + + PathTabItem Choose folder - 设置 + 设置 + + + + Delete + 删除 + + + + Edit + 修改