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 24923b2..a7e0ad0 100644
Binary files a/app/resource/i18n/Seraphine.zh_CN.qm and b/app/resource/i18n/Seraphine.zh_CN.qm differ
diff --git a/app/resource/i18n/Seraphine.zh_CN.ts b/app/resource/i18n/Seraphine.zh_CN.ts
index 498d510..3a4a792 100644
--- a/app/resource/i18n/Seraphine.zh_CN.ts
+++ b/app/resource/i18n/Seraphine.zh_CN.ts
@@ -1162,12 +1162,12 @@
客户端已连接
-
+
路径非法
-
+
请在设置页面中设置正确的 LOL 客户端路径
@@ -1177,52 +1177,52 @@
启动页
-
+
启动客户端成功
-
+
游戏大厅
-
+
英雄选择
-
+
游戏中
-
+
等待游戏结果
-
+
游戏结束
-
+
房间组队中
-
+
匹配确认
-
+
匹配中
-
+
程序出现异常 😥
@@ -1232,12 +1232,12 @@
战绩查询 👀
-
+
直接退出
-
+
最小化到任务栏
@@ -1247,7 +1247,7 @@
退出
-
+
你第一次点击了关闭按钮
@@ -1288,17 +1288,17 @@
客户端信息请求失败
-
+
蓝色方
-
+
红色方
-
+
等待重新连接
@@ -1353,7 +1353,7 @@
,
-
+
请选择点击关闭按钮的默认行为
@@ -1549,12 +1549,45 @@
你想要改成的在线状态(签名):
+
+ PathDraggableWidget
+
+
+
+ 选择文件夹
+
+
+
+
+ 修改失败
+
+
+
+
+ 路径 “
+
+
+
+
+ ” 已经存在
+
+
PathTabItem
- 设置
+ 设置
+
+
+
+
+ 删除
+
+
+
+
+ 修改