From 72619358cfabf865031a02eedeb67dbffe419e35 Mon Sep 17 00:00:00 2001 From: Zzaphkiel Date: Sat, 22 Jun 2024 15:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=9C=80=E8=BF=91=E9=98=9F=E5=8F=8B=E9=A3=9E=E5=87=BA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E6=82=AC=E7=A9=BA=E6=8C=87=E9=92=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lol/connector.py | 40 +++++++++++++++++++++--------------- app/view/career_interface.py | 13 +++++++++--- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/app/lol/connector.py b/app/lol/connector.py index 2dd750d..4a7adc8 100644 --- a/app/lol/connector.py +++ b/app/lol/connector.py @@ -12,11 +12,11 @@ import aiohttp from PyQt5.QtCore import pyqtSignal, QObject -from ..common.config import cfg, Language -from ..common.logger import logger -from ..common.signals import signalBus -from ..common.util import getPortTokenServerByPid -from .exceptions import * +from app.common.config import cfg, Language +from app.common.logger import logger +from app.common.signals import signalBus +from app.common.util import getPortTokenServerByPid +from app.lol.exceptions import * requests.packages.urllib3.disable_warnings() @@ -829,14 +829,26 @@ async def spectate(self, summonerName): return res - def getConversations(self): - res = self.__get("/lol-chat/v1/conversations").json() + async def dodge(self): + data = { + "destination": 'lcdsServiceProxy', + "method": 'call', + "args": '["", "teambuilder-draft", "quitV2", ""]' + } - return res + res = await self.__post("/lol-login/v1/session/invoke", data=data) - def getHelp(self): - res = self.__get("/help").json() - return res + return await res.json() + + async def getConversations(self): + res = await self.__get("/lol-chat/v1/conversations") + + return await res.json() + + async def getHelp(self): + res = await self.__get("/help") + + return await res.json() @retry() async def sendFriendRequest(self, name): @@ -851,12 +863,6 @@ async def sendFriendRequest(self, name): print(await res.read()) - def dodge(self): - res = self.__post( - '/lol-login/v1/session/invoke?destination=lcdsServiceProxy&method=call&args=["","teambuilder-draft","quitV2",""])').content - - return res - @retry() def sendNotificationMsg(self, title, content): data = { diff --git a/app/view/career_interface.py b/app/view/career_interface.py index ab9abe3..976429b 100644 --- a/app/view/career_interface.py +++ b/app/view/career_interface.py @@ -384,6 +384,7 @@ async def updateInterface(self, puuid=None, summoner=None): self.setLoadingPageEnabled(True) self.recentTeammatesInfo = None + if self.recentTeammatesFlyout: self.recentTeammatesFlyout.close() self.recentTeammatesFlyout = None @@ -565,15 +566,21 @@ def isCurrentSummoner(self): def __onRecentTeammatesButtonClicked(self): view = TeammatesFlyOut() - if self.info: + + if self.recentTeammatesInfo: view.setLoadingPageEnabled(False) - view.updateSummoners(self.info) + view.updateSummoners(self.recentTeammatesInfo) self.recentTeammatesFlyout = Flyout.make( view, self.recentTeamButton, self, FlyoutAnimationType.DROP_DOWN) + self.recentTeammatesFlyout.closed.connect( + self.__resetRecentTeammatesFlyout) + + def __resetRecentTeammatesFlyout(self): + self.recentTeammatesFlyout = None async def __updateRecentTeammates(self): - self.info = await getRecentTeammates(self.games['games'], self.puuid) + self.recentTeammatesInfo = await getRecentTeammates(self.games['games'], self.puuid) if self.recentTeammatesFlyout: self.recentTeammatesFlyout.close()