From 579ea088f376fbabb2a49d0b62b6527439c5fd10 Mon Sep 17 00:00:00 2001 From: Zzaphkiel <1278228162@qq.com> Date: Mon, 7 Aug 2023 21:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=90=8E=E4=BA=8B=E4=BB=B6=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/config.py | 2 +- app/lol/listener.py | 5 ++++- app/view/career_interface.py | 7 +++++-- app/view/main_window.py | 6 +++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/common/config.py b/app/common/config.py index c83686ef..5e0c6669 100644 --- a/app/common/config.py +++ b/app/common/config.py @@ -54,7 +54,7 @@ class Config(QConfig): YEAR = 2023 AUTHOR = "Zaphkiel" -VERSION = "0.2.1" +VERSION = "0.2.2" FEEDBACK_URL = "https://github.com/Zzaphkiel/Seraphine/issues" GITHUB_URL = "https://github.com/Zzaphkiel/Seraphine" diff --git a/app/lol/listener.py b/app/lol/listener.py index bfd8b2d9..455d4636 100644 --- a/app/lol/listener.py +++ b/app/lol/listener.py @@ -62,10 +62,13 @@ async def main(): wllp = await willump.start() allEventSubscription = await wllp.subscribe('OnJsonApiEvent') + res = await wllp.request("get", "/lol-summoner/v1/current-summoner") + res = await res.json() + # 订阅改头像 / 改名字消息 wllp.subscription_filter_endpoint( allEventSubscription, - f'/lol-summoner/v1/summoners/{self.parent().currentSummoner.summonerId}', + f'/lol-summoner/v1/summoners/{res["summonerId"]}', onCurrentSummonerProfileChanged) # 订阅游戏状态改变消息 diff --git a/app/view/career_interface.py b/app/view/career_interface.py index 8c41039f..1fd15d14 100644 --- a/app/view/career_interface.py +++ b/app/view/career_interface.py @@ -24,6 +24,7 @@ class CareerInterface(ScrollArea): def __init__(self, parent=None): super().__init__(parent) self.summoner: Summoner = None + self.currentSummonerName: Summoner = None self.vBoxLayout = QVBoxLayout(self) self.IconNameHBoxLayout = QHBoxLayout() @@ -483,7 +484,9 @@ def __onfilterComboBoxChanged(self, index): self.gameInfoLayout.addSpacerItem( QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding)) + def setCurrentSummonerName(self, name): + self.currentSummonerName = name + def isCurrentSummoner(self): - summoner: Summoner = self.parent().parent().parent().currentSummoner - return summoner == None or summoner.name == self.name.text() + return self.currentSummonerName == None or self.currentSummonerName == self.name.text() diff --git a/app/view/main_window.py b/app/view/main_window.py index a66a04b8..117a8969 100644 --- a/app/view/main_window.py +++ b/app/view/main_window.py @@ -216,6 +216,8 @@ def __changeCareerToCurrentSummoner(self): xpSinceLastLevel = self.currentSummoner.xpSinceLastLevel xpUntilNextLevel = self.currentSummoner.xpUntilNextLevel + self.careerInterface.currentSummonerName = name + self.rankInfo = self.lolConnector.getRankedStatsByPuuid( self.currentSummoner.puuid) gamesInfo = self.lolConnector.getSummonerGamesByPuuid( @@ -293,6 +295,8 @@ def _(): self.isClientProcessRunning = False self.currentSummoner = None + self.careerInterface.setCurrentSummonerName(None) + icon = "app/resource/images/game.png" name = self.tr("Start LOL") @@ -308,7 +312,7 @@ def _(): self.auxiliaryFuncInterface.removeTokensCard.lolConnector = None self.auxiliaryFuncInterface.createPracticeLobbyCard.lolConnector = None - self.eventListener.exit() + self.eventListener.terminate() threading.Thread(target=_).start()