Skip to content

Commit

Permalink
修复对局信息界面若对局数少于 11 则对局卡片高了一点的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Jun 7, 2024
1 parent e0fc862 commit 60ac9c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/view/game_info_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ def updateSummonersOrder(self, order: list):
self.vBoxLayout.addWidget(view)

if len(order) < 5:
self.vBoxLayout.addSpacing(self.vBoxLayout.spacing())
self.vBoxLayout.addStretch(5 - len(order))
spacing = self.vBoxLayout.spacing()
self.vBoxLayout.addSpacing(spacing * (5 - len(order)))

def updateSummoners(self, summoners, isAram=False):
self.clear()
Expand All @@ -291,8 +292,9 @@ def updateSummoners(self, summoners, isAram=False):
self.vBoxLayout.addWidget(summonerView, stretch=1)

if len(summoners) < 5:
self.vBoxLayout.addSpacing(self.vBoxLayout.spacing())
self.vBoxLayout.addStretch(5 - len(summoners))
spacing = self.vBoxLayout.spacing()
self.vBoxLayout.addSpacing(spacing * (5 - len(summoners)))

def updateColor(self, colors):
for summonerId, color in colors.items():
Expand Down Expand Up @@ -521,8 +523,9 @@ def updateOrder(self, order):
view.style().polish(view)

if len(order) < 5:
self.hBoxLayout.addSpacing(self.hBoxLayout.spacing())
self.hBoxLayout.addStretch(5 - len(order))
spacing = self.hBoxLayout.spacing()
self.hBoxLayout.addSpacing(spacing * (5 - len(order)))

def updateSummoners(self, summoners):
self.clear()
Expand All @@ -542,6 +545,8 @@ def updateSummoners(self, summoners):

if len(summoners) < 5:
self.hBoxLayout.addStretch(5 - len(summoners))
spacing = self.hBoxLayout.spacing()
self.hBoxLayout.addSpacing(spacing * (5 - len(summoners)))

def clear(self):
for i in reversed(range(self.hBoxLayout.count())):
Expand Down Expand Up @@ -601,7 +606,8 @@ def __init__(self, summoner, parent=None):

if len(games) < 11:
self.gamesLayout.addStretch(11-len(games))
self.gamesLayout.addSpacing(5)
spacing = self.gamesLayout.spacing()
self.gamesLayout.addSpacing(spacing * (11 - len(games)))

@asyncSlot()
async def __onSummonerNameClicked(self):
Expand Down
2 changes: 2 additions & 0 deletions app/view/search_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def prepareNextPage(self):
# 如果不够十个就给它填充一下
if end - begin < 10:
layout.addStretch(10 - (end - begin))
spacing = layout.spacing()
layout.addSpacing((10 - (end - begin)) * spacing)

self.stackWidget.addWidget(widget)
self.maxPageNum += 1
Expand Down

0 comments on commit 60ac9c7

Please sign in to comment.