Skip to content

Commit

Permalink
修复生涯界面 “回到我” 按钮在同名召唤师下工作不正常的 BUG (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Oct 22, 2024
1 parent 2f3db82 commit 86032cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 14 additions & 9 deletions app/view/career_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CareerInterface(SeraphineInterface):

def __init__(self, parent=None):
super().__init__(parent)
self.currentSummonerName = None
self.loginSummonerPuuid = None
self.puuid = None
self.showTagLine = False
self.recentTeammatesInfo = None
Expand Down Expand Up @@ -342,7 +342,7 @@ def __connectSignalToSlot(self):
self.__onRecentTeammatesButtonClicked)

async def updateNameIconExp(self, info):
if not self.isCurrentSummoner():
if not self.isLoginSummoner():
return

name = info.get("gameName") or info['displayName']
Expand Down Expand Up @@ -454,7 +454,7 @@ async def repaintInterface(self, info):
]]
self.copyButton.setEnabled(False)

if not self.isCurrentSummoner():
if not self.isLoginSummoner():
for i in range(0, 2):
for j in [1, 2, 4]:
self.rankInfo[i][j] = '--'
Expand Down Expand Up @@ -482,7 +482,7 @@ async def repaintInterface(self, info):

self.__updateGameInfo()

self.backToMeButton.setEnabled(not self.isCurrentSummoner())
self.backToMeButton.setEnabled(not self.isLoginSummoner())

if 'champions' in info:
self.championsCard.updateChampions(info['champions'])
Expand Down Expand Up @@ -555,14 +555,19 @@ def __onfilterComboBoxChanged(self, index):
self.gameInfoLayout.addSpacerItem(
QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding))

def setCurrentSummonerName(self, name):
self.currentSummonerName = name
def setLoginSummonerPuuid(self, name):
self.loginSummonerPuuid = name

def getSummonerName(self):
return self.name.text() if not self.showTagLine else f'{self.name.text()}{self.tagLineLabel.text()}'
if self.showTagLine:
res = f'{self.name.text()}{self.tagLineLabel.text()}'
else:
res = self.name.text()

return res

def isCurrentSummoner(self):
return self.currentSummonerName == None or self.currentSummonerName == self.name.text()
def isLoginSummoner(self):
return self.loginSummonerPuuid == None or self.loginSummonerPuuid == self.puuid

def __onRecentTeammatesButtonClicked(self):
view = TeammatesFlyOut()
Expand Down
4 changes: 2 additions & 2 deletions app/view/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ async def __changeCareerToCurrentSummoner(self):
summoner = await connector.getCurrentSummoner()
self.currentSummoner = summoner
name = summoner.get("gameName") or summoner['displayName']
self.careerInterface.setCurrentSummonerName(name)
self.careerInterface.setLoginSummonerPuuid(summoner['puuid'])

asyncio.create_task(self.careerInterface.updateInterface(
summoner=summoner))
Expand Down Expand Up @@ -566,7 +566,7 @@ async def __onLolClientEnded(self):

self.isClientProcessRunning = False
self.currentSummoner = None
self.careerInterface.setCurrentSummonerName(None)
self.careerInterface.setLoginSummonerPuuid(None)

await self.__updateAvatarIconName()

Expand Down

0 comments on commit 86032cc

Please sign in to comment.