From 06684e8f8b75cd0acaa7786a8e8a6fc7683ea79e Mon Sep 17 00:00:00 2001 From: Zzaphkiel Date: Fri, 14 Jun 2024 18:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=9B=B4=E6=8D=A2=E7=94=9F=E6=B6=AF?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E9=80=89=E9=A1=B9=E5=8D=A1=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E8=8B=B1=E9=9B=84=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/multi_champion_select.py | 90 +++-- app/lol/connector.py | 2 +- app/resource/i18n/Seraphine.zh_CN.qm | Bin 29958 -> 29953 bytes app/resource/i18n/Seraphine.zh_CN.ts | 335 +++++++++--------- .../qss/dark/champion_select_widget.qss | 2 +- .../qss/light/champion_select_widget.qss | 2 +- app/view/auxiliary_interface.py | 80 ++--- app/view/main_window.py | 10 +- app/view/search_interface.py | 5 +- 9 files changed, 285 insertions(+), 241 deletions(-) diff --git a/app/components/multi_champion_select.py b/app/components/multi_champion_select.py index 2da4d93e..eaa525d1 100644 --- a/app/components/multi_champion_select.py +++ b/app/components/multi_champion_select.py @@ -6,10 +6,11 @@ from PyQt5.QtGui import QMouseEvent from PyQt5.QtWidgets import (QVBoxLayout, QFrame, QHBoxLayout, QLabel, QApplication, QWidget, QCompleter) +from app.common.qfluentwidgets import (TransparentToolButton, FluentIcon, ToolButton, + SearchLineEdit, FlowLayout, SmoothScrollArea, + FlyoutViewBase, TeachingTipView) -from app.common.qfluentwidgets import (TransparentToolButton, FluentIcon, ToolButton, - SearchLineEdit, FlowLayout, SmoothScrollArea) from app.common.style_sheet import StyleSheet from app.components.animation_frame import CardWidget from app.components.champion_icon_widget import RoundIcon, RoundIconButton @@ -67,7 +68,7 @@ def sizeHint(self): return QSize(141, 44) -class ItemsDraggableLayout(QFrame): +class ItemsDraggableWidget(QFrame): def __init__(self, parent=None): super().__init__(parent=parent) self.items: List[ChampionTabItem] = [] @@ -231,44 +232,34 @@ def tabRect(self, index: int) -> QRect: return rect -class MultiChampionSelectWidget(QWidget): - def __init__(self, champions: dict, selected: list, parent=None): - super().__init__(parent=parent) +class ChampionsSelectWidget(QWidget): + championClicked = pyqtSignal(int) - self.hBoxLayout = QHBoxLayout(self) + def __init__(self, champions: dict, parent: QWidget = None): + super().__init__(parent=parent) - self.itemsDraggableWidget = ItemsDraggableLayout() - self.championSelectLayout = QVBoxLayout() + self.champions = champions self.searchLineEdit = SearchLineEdit() + + self.vBoxLayout = QVBoxLayout(self) self.scrollArea = SmoothScrollArea() self.scrollWidget = QWidget() self.championsShowLayout = FlowLayout(needAni=False) - self.champions: dict = champions - self.selected = selected - self.__initWidget() self.__initLayout() - StyleSheet.CHAMPION_SELECT_WIDGET.apply(self) - def __initWidget(self): self.scrollArea.setObjectName("scrollArea") self.scrollWidget.setObjectName("scrollWidget") for i, [name, icon] in self.champions.items(): button = RoundIconButton(icon, 38, 4, 2, name, i) - button.clicked.connect(self.__onChampionIconClicked) + button.clicked.connect(self.championClicked) self.championsShowLayout.addWidget(button) - for id in self.selected: - name = connector.manager.getChampionNameById(id) - icon = self.champions[id][1] - - self.itemsDraggableWidget.addItem(icon, name, id) - self.searchLineEdit.textChanged.connect(self.__onSearchLineTextChanged) def __initLayout(self): @@ -283,12 +274,9 @@ def __initLayout(self): self.scrollArea.setFixedSize(330, 279) - self.championSelectLayout.setContentsMargins(0, 0, 0, 0) - self.championSelectLayout.addWidget(self.searchLineEdit) - self.championSelectLayout.addWidget(self.scrollArea) - - self.hBoxLayout.addWidget(self.itemsDraggableWidget) - self.hBoxLayout.addLayout(self.championSelectLayout) + self.vBoxLayout.setContentsMargins(0, 0, 0, 0) + self.vBoxLayout.addWidget(self.searchLineEdit) + self.vBoxLayout.addWidget(self.scrollArea) def __onSearchLineTextChanged(self, text: str): for i in reversed(range(self.championsShowLayout.count())): @@ -305,7 +293,7 @@ def __onSearchLineTextChanged(self, text: str): icon = champion[1] button = RoundIconButton(icon, 38, 4, 2, name, i) - button.clicked.connect(self.__onChampionIconClicked) + button.clicked.connect(self.championClicked) self.championsShowLayout.addWidget(button) @@ -318,6 +306,37 @@ def __getChampionIdsByAlias(self, alias): return [id for id, [name, _] in self.champions.items() if alias in name] + +class MultiChampionSelectWidget(QWidget): + def __init__(self, champions: dict, selected: list, parent=None): + super().__init__(parent=parent) + + self.hBoxLayout = QHBoxLayout(self) + + self.itemsDraggableWidget = ItemsDraggableWidget() + self.championsSelectWidget = ChampionsSelectWidget(champions) + self.champions: dict = champions + self.selected = selected + + self.__initWidget() + self.__initLayout() + + StyleSheet.CHAMPION_SELECT_WIDGET.apply(self) + + def __initWidget(self): + for id in self.selected: + name = connector.manager.getChampionNameById(id) + icon = self.champions[id][1] + + self.itemsDraggableWidget.addItem(icon, name, id) + + self.championsSelectWidget.championClicked.connect( + self.__onChampionIconClicked) + + def __initLayout(self): + self.hBoxLayout.addWidget(self.itemsDraggableWidget) + self.hBoxLayout.addWidget(self.championsSelectWidget) + def __onChampionIconClicked(self, championId): if self.itemsDraggableWidget.count() == 6: return @@ -330,3 +349,18 @@ def __onChampionIconClicked(self, championId): def getSelectedChampionIds(self) -> list: return self.itemsDraggableWidget.getCurrentChampionIds() + + +class ChampionSelectFlyout(FlyoutViewBase): + championSelected = pyqtSignal(int) + + def __init__(self, champions: dict, parent=None): + super().__init__(parent) + + self.vBoxLayout = QVBoxLayout(self) + self.selectWidget = ChampionsSelectWidget(champions) + self.selectWidget.championClicked.connect(self.championSelected) + + self.vBoxLayout.addWidget(self.selectWidget) + + StyleSheet.CHAMPION_SELECT_WIDGET.apply(self) diff --git a/app/lol/connector.py b/app/lol/connector.py index 9faaa070..923b7c5e 100644 --- a/app/lol/connector.py +++ b/app/lol/connector.py @@ -1074,7 +1074,7 @@ def getChampions(self): def getSkinListByChampionName(self, championName): try: - return [item for item in self.champions[championName]["skins"]] + return [item for item in self.champions[championName]["skins"].items()] except: return [] diff --git a/app/resource/i18n/Seraphine.zh_CN.qm b/app/resource/i18n/Seraphine.zh_CN.qm index 0d209d8284bd560563981894a161da2df7fd716c..c01bfaf3350d448bcb4c6208cfef78494a34d7c7 100644 GIT binary patch delta 1997 zcmY*aZBSI#8Gi2W{n*dDKp-mwUB1jp#PT6wMHW_AJ|m#8F^URt!38uzw1}q041&QC zkvQb2DQbdLNzn*1l`$rysH139LUp1IYJ;YRRBMx<4p8W%wJ&q~r#rLz+_U$b_nhZ> zpZ7gG9&xpgxB&ZStEXKZIkayeIPmPMw%(!N0}!^9zwXR!_KJv(r-2s`5JQ*%*#4p5 z>T$wkAn7pS3SeHYf}YUkiaj-tfy@YCTBw3fUm!;Vg!~&=^Z`)v0+4r;FdbNO35a+L zSVn}h6R!{f6$EV&9XJU>+&+r!r(j9}gwiuW{%m%NvvOT*h_i7L^HW*9 z4OqDR&lEiu+1XjZsux*~%Iv)#u4OGi%vQM8oCn)_9zfPri)m&`rN5rz3OCKW@ex>2Eg(;=hahs&+UCbPQF4tsN+PtZKvn>F|}R;|A&Bxy{DZmf$M2_k)9gX`y=NdOskv zNx^~%b<~X%TKon}Jph0$xdP(8a1dl@0Mj`Jb8#C~NHA7%*z(!KaujlZM3cd{Yg%xT#eZw)Tyf7?i!&bg3b0_Az7Fz-0UNUCI= zf`zMK1A;kgv9Nm{v6`KvU`oBPJN+V%eBpmMDKurC17>Uy_V?4gMgI~G+bPBZhj8|p z76{V|mpW*trQ>XlXz{iS-@P_9`-FnU=UJg>_AVAJSAI=;`-{QbHj=IfS-qGM+$A2n zK-DnAqF`}}*waaj%svV(uVp`p=9)#~pr4g;=p){;7XZ_rh(muRE(Gu{b_XPI5yMR*=SFZUs{>D!9TX$xn&Tb6(Pm zTha&@O5w#ce@VYI_bhqiC2W>rujLcLb5h*+BNC=YO52%0MKL60pV$PHZkHD4AEgc6 zXPuJSzg2pt$QLLUrET35uJoByKl=!kbT}K5%)vLLcCT#!w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(7LM->{v7k*9h z+oiCm#xUD65|~t=Ft%A?QI8>F%r5d9L*&?VTY$nj|2|$+aZ) ziH7wMK6<`LsSi-|@q(0IvxA6?0v#;=B*fN3|3-~4(8^(52yeUO>X z>m}V~HYTe$)txpV!&j<) zpXib*)wI$?Eew{}sZBt9vb1L}IZ{uQ`ZkvU7D@Wk=}&0NTcooW!)bO(rJEN+X+J|6 z*-p_yk AutoAcceptMatchingCard - + Delay seconds after match made: 在对局找到后接受对局前延迟的秒数: - + seconds - + Disabled 未启用 - + Enabled, delay: 已启用,延迟: @@ -103,22 +103,22 @@ AutoAcceptSwapingCard - + Enable auto accept cail swap request: 自动接受楼层交换请求: - + Enable auto accept champion trade request: 自动接受英雄交换请求: - + Enabled 已启用 - + Disabled 未启用 @@ -141,12 +141,12 @@ 已启用,自动禁用: - + Disabled 未启用 - + Enable: 启用自动 Ban: @@ -156,67 +156,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 已启用 @@ -234,7 +234,7 @@ 已启用,自动选择: - + Disabled 未启用 @@ -244,7 +244,7 @@ 将要自动亮起的英雄: - + Enable: 启用自动亮起: @@ -254,7 +254,7 @@ 在时间结束后确定选择(更换亮起英雄后无效) - + Completed before timeout: 在时间结束时确定选择: @@ -274,57 +274,57 @@ 将要自动亮起的英雄: - + Default Configurations 默认设置 - + Default champions: 默认亮起英雄: - + Choose 选择 - + Rank Configurations 按照位置设置 - + Top: 上路: - + Juggle: 打野: - + Mid: 中路: - + Bottom: 下路: - + Support: 辅助: - + Enabled 已启用 - + Reset 恢复默认 @@ -332,92 +332,92 @@ AuxiliaryInterface - + Auxiliary Functions 其他功能 - + Profile 个人主页 - + Online status 个人签名 - + Set your profile online status 修改你个人卡片的的签名 - + Profile background 个人主页背景 - + Set your profile background skin 修改你的个人主页背景皮肤图片 - + Profile tier 段位展示 - + Set your tier showed in your profile card 修改你个人卡片显示的段位 - + Online Availability 在线状态 - + Set your online Availability 修改你的在线状态 - + Remove challenge tokens 卸下勋章 - + Remove all challenge tokens from your profile 卸下你个人卡片中的所有勋章 - + Game 游戏 - + Create 5v5 practice lobby 创建 5v5 练习模式 - + Auto accept 自动接受对局 - + Spectate 观战 - + Spectate live game of summoner in the same environment 观战同大区玩家正在进行的游戏 - + Auto select champion 自动亮起英雄 @@ -427,42 +427,42 @@ 在盲选开始时自动亮起英雄 - + Lock config 锁定游戏设置 - + Make your game config unchangeable 让你的游戏设置不会因为切换账号而改变 - + Accept match making automatically after the number of seconds you set 在你设置的秒数之后自动接受对局匹配 - + Only bots can be added to the lobby 只能添加人机玩家 - + Auto reconnect 自动重连 - + Automatically reconnect when disconnected 当你掉线退出游戏时自动重新连接 - + Fix client window 修复客户端窗口 - + Fix incorrect client window size caused by DirectX 9 (need UAC) 修复客户端错误的窗口大小(需要管理员权限) @@ -477,27 +477,27 @@ 向玩家发送好友请求 - + Auto select champion when your selection begin 在你的选择开始时自动亮起英雄 - + Auto ban champion 自动禁用英雄 - + Auto ban champion when your ban section begin 在你的禁用环节开始时自动禁用英雄 - + Ban / Pick 英雄选择 - + Remove prestige crest 卸下头像框 @@ -508,32 +508,32 @@ 卸下你的召唤师头像框(需要召唤师等级大于等于 525) - + Auto accept swaping 自动接受交换请求 - + Accept ceil or champion swaping requests during B/P 自动接受队友的交换楼层或英雄的请求 - + Client 客户端 - + Remove prestige crest from your profile icon (need your summoner level >= 525) 卸下你的召唤师头像框(需要召唤师等级大于等于 525) - + Restart client 重启客户端 - + Restart the LOL client without re queuing 重启客户端而不需要重新排队 @@ -773,27 +773,27 @@ CreatePracticeLobbyCard - + Create 创建 - + Lobby's name: (cannot be empty) 房间名:(不可为空) - + Please input lobby's name 请输入房间名 - + Please input password 请输入房间密码 - + Password: (password will NOT be set if it's empty) 房间密码:(若留空则不设密码) @@ -801,7 +801,7 @@ DodgeCard - + Dodge 秒退 @@ -822,7 +822,7 @@ FixClientDpiCard - + Fix 修复 @@ -840,32 +840,32 @@ 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: 你想加好友的召唤师名: @@ -1106,12 +1106,12 @@ LockConfigCard - + Error 错误 - + Failed to set file permissions 设置文件读写属性失败 @@ -1142,7 +1142,7 @@ 对局信息 - + Start LOL 启动游戏 @@ -1162,12 +1162,12 @@ 客户端已连接 - + Invalid path 路径非法 - + Please set the correct directory of the LOL client in the setting page 请在设置页面中设置正确的 LOL 客户端路径 @@ -1177,47 +1177,47 @@ 启动页 - + Start LOL successfully 启动客户端成功 - + Home 游戏大厅 - + Selecting Champions 英雄选择 - + Gaming 游戏中 - + Waiting for status 等待游戏结果 - + End of game 游戏结束 - + Lobby 房间组队中 - + Ready check 匹配确认 - + Match making 匹配中 @@ -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 等待重新连接 @@ -1338,22 +1338,22 @@ 请确保能连接至 GitHub - + ( - + ) - + , - + Choose action for close button (you can modify it at any time in the settings page) 请选择点击关闭按钮的默认行为 @@ -1483,32 +1483,32 @@ OnlineAvailabilityCard - + Apply 应用 - + chat 在线 - + away 离开 - + offline 离线 - + Availability 在线状态 - + Your online availability will be shown: 你将要被展示的在线状态: @@ -1516,17 +1516,17 @@ OnlineStatusCard - + Please input your status 请输入你的签名 - + Apply 应用 - + Online status you want to change to: 你想要改成的在线状态(签名): @@ -1570,7 +1570,7 @@ ProfileBackgroundCard - + Apply 应用 @@ -1587,143 +1587,158 @@ Champion's name: - 英雄名: + 英雄名: Skin's name: - 皮肤: + 皮肤: Please input champion name - 请输入英雄名 + 请输入英雄名 - + Please select skin 请选择皮肤 + + + Champion's name: + 英雄: + + + + Select champion + 选择英雄 + + + + Skin's name: + 皮肤: + ProfileTierCard - + Apply 应用 - + Teamfight Tactics 云顶之弈 - + Ranked solo 单 / 双排 - + Ranked flex 灵活排位 - + Na 未定级 - + Iron 坚韧黑铁 - + Bronze 英勇黄铜 - + Silver 不屈白银 - + Gold 荣耀黄金 - + Platinum 华贵铂金 - + Emerald 流光翡翠 - + Diamond 璀璨钻石 - + Master 超凡大师 - + Grandmaster 傲世宗师 - + Challenger 最强王者 - + Game mode 游戏模式 - + Tier 段位 - + Division 等级 - + Game mode: 游戏模式: - + Tier: 段位: - + Division: 等级: - + Please select game mode 请选择游戏模式 - + Please select Tier 请选择段位 - + Please select Division 请选择等级 @@ -1754,7 +1769,7 @@ RemovePrestigeCrestCard - + Remove 卸下 @@ -1762,7 +1777,7 @@ RemoveTokensCard - + Remove 卸下 @@ -1770,7 +1785,7 @@ RestartClientCard - + Restart 重启 @@ -2192,42 +2207,42 @@ when they are used by Seraphine, which will cost more time SpectateCard - + Spectate 观战 - + Summoner not found 召唤师未找到 - + Please check the summoner's name and retry 请检查召唤师名后重试 - + Summoner isn't in game 召唤师不在游戏中 - + Spectate successfully 观战拉起成功 - + Please wait 请等待游戏观战启动 - + Summoners's name you want to spectate: 你想观战的同大区召唤师名: - + Please input summoner's name 请输入召唤师名 diff --git a/app/resource/qss/dark/champion_select_widget.qss b/app/resource/qss/dark/champion_select_widget.qss index d72812d3..d53d9d61 100644 --- a/app/resource/qss/dark/champion_select_widget.qss +++ b/app/resource/qss/dark/champion_select_widget.qss @@ -19,7 +19,7 @@ ChampionTabItem>QLabel { font: 14px 'Segoe UI', 'Microsoft YaHei' } -ItemsDraggableLayout { +ItemsDraggableWidget { border: 1px solid rgb(70, 70, 70); border-radius: 6px; background-color: rgba(255, 255, 255, 0.051); diff --git a/app/resource/qss/light/champion_select_widget.qss b/app/resource/qss/light/champion_select_widget.qss index b6706a5e..34de8168 100644 --- a/app/resource/qss/light/champion_select_widget.qss +++ b/app/resource/qss/light/champion_select_widget.qss @@ -19,7 +19,7 @@ ChampionTabItem>QLabel { font: 14px 'Segoe UI', 'Microsoft YaHei' } -ItemsDraggableLayout { +ItemsDraggableWidget { border: 1px solid rgba(0, 0, 0, 0.095); border-radius: 6px; background-color: rgba(245, 245, 245, 0.667); diff --git a/app/view/auxiliary_interface.py b/app/view/auxiliary_interface.py index b04740a5..b5fe6424 100644 --- a/app/view/auxiliary_interface.py +++ b/app/view/auxiliary_interface.py @@ -8,7 +8,7 @@ PushButton, ComboBox, SwitchButton, ConfigItem, qconfig, IndicatorPosition, InfoBar, InfoBarPosition, SpinBox, ExpandGroupSettingCard, TransparentToolButton, - FluentIcon) + FluentIcon, Flyout, FlyoutAnimationType, TeachingTip) from PyQt5.QtCore import Qt, pyqtSignal, QEvent, QSize from PyQt5.QtWidgets import (QWidget, QLabel, QCompleter, QVBoxLayout, QHBoxLayout, QGridLayout, @@ -18,6 +18,7 @@ from app.components.seraphine_interface import SeraphineInterface from app.components.message_box import MultiChampionSelectMsgBox from app.components.champion_icon_widget import RoundIcon +from app.components.multi_champion_select import ChampionSelectFlyout from app.lol.tools import fixLCUWindowViaExe from app.common.icons import Icon from app.common.config import cfg @@ -189,6 +190,7 @@ def __initLayout(self): async def initChampionList(self): champions = await self.autoSelectChampionCard.initChampionList() await self.autoBanChampionsCard.initChampionList(champions) + await self.profileBackgroundCard.initChampionList(champions) class OnlineStatusCard(ExpandGroupSettingCard): @@ -251,10 +253,10 @@ def __init__(self, title, content, parent): self.inputWidget = QWidget(self.view) self.inputLayout = QGridLayout(self.inputWidget) - self.championLabel = QLabel(self.tr("Champion's name:")) - self.championEdit = LineEdit(self) + self.championLabel = QLabel(self.tr("Champion's name: ")) + self.championButton = PushButton(self.tr("Select champion"), self) - self.skinLabel = QLabel(self.tr("Skin's name:")) + self.skinLabel = QLabel(self.tr("Skin's name: ")) self.skinComboBox = ComboBox() self.buttonWidget = QWidget(self.view) @@ -274,7 +276,7 @@ def __initLayout(self): self.inputLayout.addWidget( self.championLabel, 0, 0, alignment=Qt.AlignLeft) self.inputLayout.addWidget( - self.championEdit, 0, 1, alignment=Qt.AlignRight) + self.championButton, 0, 1, alignment=Qt.AlignRight) self.inputLayout.addWidget( self.skinLabel, 1, 0, alignment=Qt.AlignLeft) @@ -293,61 +295,51 @@ def __initLayout(self): self.addGroupWidget(self.buttonWidget) def __initWidget(self): - self.championEdit.setPlaceholderText( - self.tr("Please input champion name")) - self.championEdit.setMinimumWidth(250) - self.championEdit.setClearButtonEnabled(True) + self.championButton.setMinimumWidth(100) + self.championButton.clicked.connect(self.__onSelectButtonClicked) self.pushButton.setMinimumWidth(100) self.pushButton.setEnabled(False) + self.pushButton.clicked.connect(self.__onApplyButtonClicked) self.skinComboBox.setEnabled(False) self.skinComboBox.setMinimumWidth(250) self.skinComboBox.setPlaceholderText(self.tr("Please select skin")) - self.championEdit.textChanged.connect(self.__onLineEditTextChanged) - self.skinComboBox.currentTextChanged.connect( - self.__onComboBoxTextChanged) - self.pushButton.clicked.connect( - self.__onButtonClicked) + def __onSelectButtonClicked(self): + view = ChampionSelectFlyout(self.champions) + self.w = Flyout.make(view, self.championButton, + self, FlyoutAnimationType.SLIDE_RIGHT, True) - def clear(self): - self.championEdit.clear() - self.skinComboBox.clear() - self.completer = None + view.championSelected.connect(self.__onChampionSelected) - def updateCompleter(self): - champions = connector.manager.getChampionList() - self.completer = QCompleter(champions) - self.completer.setFilterMode(Qt.MatchContains) - self.championEdit.setCompleter(self.completer) + async def initChampionList(self, champions: dict = None): + if champions: + self.champions = champions + else: + self.champions = { + i: [name, await connector.getChampionIcon(i)] + for i, name in connector.manager.getChampions().items() + if i != -1 + } - def __onLineEditTextChanged(self): - text = self.championEdit.text() - skins = connector.manager.getSkinListByChampionName(text) + return self.champions - if len(skins) != 0: - self.skinComboBox.addItems(skins) - self.skinComboBox.setEnabled(True) - else: - self.skinComboBox.clear() - self.skinComboBox.setEnabled(False) - self.skinComboBox.setPlaceholderText(self.tr("Please select skin")) + def __onChampionSelected(self, championId): + self.w.fadeOut() + self.skinComboBox.clear() - self.__onComboBoxTextChanged() + name = self.champions[championId][0] + skins = connector.manager.getSkinListByChampionName(name) + for skin in skins: + self.skinComboBox.addItem(skin[0], userData=skin[1]) - def __onComboBoxTextChanged(self): - enable = self.championEdit.text( - ) != "" and self.skinComboBox.currentText() != "" - self.pushButton.setEnabled(enable) + self.skinComboBox.setEnabled(True) + self.pushButton.setEnabled(True) @asyncSlot() - async def __onButtonClicked(self): - champion = self.championEdit.text() - skin = self.skinComboBox.currentText() - - skinId = connector.manager.getSkinIdByChampionAndSkinName( - champion, skin) + async def __onApplyButtonClicked(self): + skinId = self.skinComboBox.currentData() await connector.setProfileBackground(skinId) diff --git a/app/view/main_window.py b/app/view/main_window.py index 3a7eafee..fa6be835 100644 --- a/app/view/main_window.py +++ b/app/view/main_window.py @@ -446,8 +446,6 @@ async def __onLolClientStarted(self, pid): self.__setLolInstallFolder(folder) - self.auxiliaryFuncInterface.profileBackgroundCard.updateCompleter() - asyncio.create_task(self.auxiliaryFuncInterface.initChampionList()) self.auxiliaryFuncInterface.lockConfigCard.loadNowMode() @@ -903,13 +901,15 @@ async def __onGameEnd(self): async def __onCareerGameClicked(self, gameId): name = self.careerInterface.getSummonerName() self.searchInterface.searchLineEdit.setText(name) - self.searchInterface.filterComboBox.setCurrentIndex( - 0) # 从生涯页跳过来默认将筛选条件设置为全部 -- By Hpero4 - await self.searchInterface.searchAndShowFirstPage(self.careerInterface.puuid) + # 从生涯页跳过来默认将筛选条件设置为全部 -- By Hpero4 + self.searchInterface.filterComboBox.setCurrentIndex(0) + # 先加载完再切换, 避免加载过程中换搜索目标导致puuid出错 -- By Hpero4 + await self.searchInterface.searchAndShowFirstPage(self.careerInterface.puuid) self.checkAndSwitchTo(self.searchInterface) self.searchInterface.loadingGameId = gameId + # 先画框再加载对局 否则快速切换(如筛选或换人)会导致找不到widget -- By Hpero4 self.searchInterface.waitingForDrawSelect(gameId) await self.searchInterface.updateGameDetailView(gameId, self.careerInterface.puuid) diff --git a/app/view/search_interface.py b/app/view/search_interface.py index 2078429b..38d487e1 100644 --- a/app/view/search_interface.py +++ b/app/view/search_interface.py @@ -1101,6 +1101,7 @@ async def searchAndShowFirstPage(self, puuid=None): self.filterComboBox.setEnabled(True) self.gamesView.gameDetailView.clear() + # NOTE 如果是生涯和搜索反复横跳, 就不重新启loadgames任务了 if puuid != self.puuid: self.puuid = summoner['puuid'] @@ -1124,8 +1125,10 @@ async def searchAndShowFirstPage(self, puuid=None): self.gamesView.gamesTab.updateQueueIdMap(games) # 启动任务,往 gamesTab 里丢数据 + # NOTE 既然创建新任务, 并且刷新了self.puuid 就应该用self的, 否则就违背了loadGames判断的初衷 + self.gameLoadingTask = asyncio.create_task( - self.__loadGames(self.puuid)) # NOTE 既然创建新任务, 并且刷新了self.puuid 就应该用self的, 否则就违背了loadGames判断的初衷 + self.__loadGames(self.puuid)) self.gamesView.gamesTab.showTheFirstPage() self.gamesView.setLoadingPageEnable(False)