Skip to content

Commit

Permalink
重画对局信息界面,取消每一列战绩的单独边框
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Sep 14, 2023
1 parent d3422cf commit 828e8b8
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 28 deletions.
2 changes: 1 addition & 1 deletion app/components/game_infobar_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def __init__(self, game: dict = None, parent: QWidget = None):
super().__init__(parent=parent)
self.hBoxLayout = QHBoxLayout(self)

self.setProperty('press', False)
self.setProperty('pressed', False)
self.gameId = game['gameId']

self.__initWidget(game)
Expand Down
28 changes: 22 additions & 6 deletions app/resource/qss/dark/game_info_interface.qss
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ GameTab>#time {
font: 11px;
}


Games {
color: white;
border-radius: 6px;
border: 1px solid rgb(82, 82, 82);
background-color: rgba(255, 255, 255, 0.051);
border: none;
border-right: 1px solid rgb(35, 35, 35);
background-color: transparent;
}

Games[isLast=true] {
border: none;
}

Games>#summonerName {
Expand All @@ -81,7 +85,19 @@ Games>#summonerName {
}

Games:hover {
border-radius: 6px;
border: 1px solid rgb(82, 82, 82);
border: none;
border-radius: 0;
background-color: rgba(255, 255, 255, 0.0837);
}

Games[isFirst=true]:hover {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
background-color: rgba(255, 255, 255, 0.0837);
}

Games[isLast=true]:hover {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
background-color: rgba(255, 255, 255, 0.0837);
}
32 changes: 28 additions & 4 deletions app/resource/qss/light/game_info_interface.qss
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,50 @@ SummonerInfoView>#kdaValLabel {
/* border: 1px solid black; */
}

SummonerInfoView>#kdaValLabel {
font: bold;
}

GameTab>QLabel {
font: 13px 'Segoe UI', 'Microsoft YaHei';
}

GameTab>#time {
font: 11px;
font: bold 11px;
}

Games {
/* Games {
border-radius: 6px;
border: 1px solid rgba(0, 0, 0, 0.095);
background-color: rgba(245, 245, 245, 0.667);
} */

Games {
border: none;
border-right: 1px solid rgba(0, 0, 0, 0.095);
background-color: transparent;
}

Games[isLast=true] {
border: none;
}

Games>#summonerName {
font: bold 15px 'Microsoft YaHei', 'Segoe UI';
}

Games:hover {
border-radius: 6px;
border: 1px solid rgba(0, 0, 0, 0.095);
background-color: rgba(233, 233, 233, 0.5);
}

Games[isFirst=true]:hover {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
background-color: rgba(233, 233, 233, 0.5);
}

Games[isLast=true]:hover {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
background-color: rgba(233, 233, 233, 0.5);
}
42 changes: 26 additions & 16 deletions app/view/game_info_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,17 @@ def __init__(self, parent=None):

def __initLayout(self):
self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
# self.vBoxLayout.setSpacing(0)

def updateSummoners(self, summoners):
self.clear()

for summoner in summoners:
summonerView = SummonerInfoView(summoner)
self.vBoxLayout.addWidget(summonerView)
self.vBoxLayout.addWidget(summonerView, stretch=1)

if len(summoners) < 5:
self.vBoxLayout.addSpacerItem(
QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding))
self.vBoxLayout.addStretch(5 - len(summoners))

def clear(self):
for i in reversed(range(self.vBoxLayout.count())):
Expand Down Expand Up @@ -362,7 +362,7 @@ def __initLayout(self):
self.infoVBoxLayout.addSpacerItem(
QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding))

self.hBoxLayout.setContentsMargins(7, 0, 7, 0)
self.hBoxLayout.setContentsMargins(9, 0, 9, 0)
self.hBoxLayout.setSpacing(0)
self.hBoxLayout.addWidget(self.icon)
self.hBoxLayout.addLayout(self.infoVBoxLayout)
Expand Down Expand Up @@ -409,18 +409,23 @@ def __init__(self, parent=None):

def __initLayout(self):
self.hBoxLayout.setSpacing(0)
self.hBoxLayout.setContentsMargins(0, 0, 0, 0)

def updateSummoners(self, summoners):
self.clear()
self.summoners = summoners

for summoner in summoners:
for i, summoner in enumerate(summoners):
games = Games(summoner)
self.hBoxLayout.addWidget(games, alignment=Qt.AlignHCenter)
self.hBoxLayout.addWidget(games, stretch=1)

if i == 0:
games.setProperty("isFirst", True)
elif i == len(summoners) - 1:
games.setProperty("isLast", True)

if len(summoners) < 5:
self.hBoxLayout.addSpacerItem(QSpacerItem(
1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum))
self.hBoxLayout.addStretch(5 - len(summoners))

def clear(self):
self.summoners.clear()
Expand All @@ -440,33 +445,38 @@ def __init__(self, summoner, parent=None):

self.vBoxLayout = QVBoxLayout(self)
self.vBoxLayout.setSpacing(5)
# self.vBoxLayout.setContentsMargins(0, 0, 0, 0)

self.setSizePolicy(QSizePolicy.Policy.Expanding,
QSizePolicy.Policy.Expanding)

self.summonerName = SummonerName(summoner['name'])
self.summonerName.setObjectName("summonerName")
self.summonerName.clicked.connect(lambda: self.parent().parent(
).parent().summonerGamesClicked.emit(self.summonerName.text()))

# self.vBoxLayout.setContentsMargins(4, 4, 4, 4)
self.vBoxLayout.addSpacing(5)
self.vBoxLayout.addWidget(self.summonerName, alignment=Qt.AlignCenter)
# self.vBoxLayout.addSpacing(10)
self.vBoxLayout.addSpacing(10)

games = summoner['gamesInfo']

for game in games:
tab = GameTab(game)
self.vBoxLayout.addWidget(tab)

if len(games) < 11:
self.vBoxLayout.addSpacerItem(QSpacerItem(
1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum))
# if len(games) < 11:
# self.vBoxLayout.addSpacerItem(QSpacerItem(
# 1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum))


class GameTab(QFrame):

def __init__(self, game=None, parent=None):
super().__init__(parent)
self.setFixedHeight(54)
self.setFixedWidth(129)
# self.setFixedHeight(54)
# self.setFixedWidth(129)

self.hBoxLayout = QHBoxLayout(self)
self.nameTimeKdaLayout = QVBoxLayout()
Expand All @@ -477,7 +487,7 @@ def __init__(self, game=None, parent=None):
self.modeName = QLabel(game['name'].replace("排位赛 ", ""))

self.time = QLabel(
f"{game['shortTime']} {game['kills']}/{game['deaths']}/{game['assists']}"
f"{game['shortTime']} {game['kills']}-{game['deaths']}-{game['assists']}"
)
self.resultLabel = QLabel()

Expand All @@ -497,7 +507,7 @@ def __initWidget(self):
self.time.setObjectName("time")

def __initLayout(self):
self.hBoxLayout.setContentsMargins(4, 9, 4, 9)
self.hBoxLayout.setContentsMargins(7, 9, 7, 9)

self.nameTimeKdaLayout.addWidget(self.modeName)
self.nameTimeKdaLayout.addWidget(self.time)
Expand Down
2 changes: 1 addition & 1 deletion app/view/search_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ def __init__(self, game=None, parent=None):
super().__init__(parent)
self.setFixedHeight(54)
self.setFixedWidth(141)
self.setProperty("press", False)
self.setProperty("pressed", False)

self.vBoxLayout = QHBoxLayout(self)
self.nameTimeKdaLayout = QVBoxLayout()
Expand Down

0 comments on commit 828e8b8

Please sign in to comment.