mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Make the casualty report scrollable.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2567.
This commit is contained in:
parent
627ed45065
commit
b0bc46f539
@ -8,12 +8,13 @@ from PySide2.QtWidgets import (
|
|||||||
QGroupBox,
|
QGroupBox,
|
||||||
QLabel,
|
QLabel,
|
||||||
QPushButton,
|
QPushButton,
|
||||||
|
QScrollArea,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from game.debriefing import Debriefing
|
from game.debriefing import Debriefing
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
@ -52,6 +53,19 @@ class LossGrid(QGridLayout):
|
|||||||
self.addWidget(QLabel(str(count)), row, 1)
|
self.addWidget(QLabel(str(count)), row, 1)
|
||||||
|
|
||||||
|
|
||||||
|
class ScrollingCasualtyReportContainer(QGroupBox):
|
||||||
|
def __init__(self, debriefing: Debriefing, player: bool) -> None:
|
||||||
|
country = debriefing.player_country if player else debriefing.enemy_country
|
||||||
|
super().__init__(f"{country}'s lost units:")
|
||||||
|
scroll_content = QWidget()
|
||||||
|
scroll_content.setLayout(LossGrid(debriefing, player))
|
||||||
|
scroll_area = QScrollArea()
|
||||||
|
scroll_area.setWidget(scroll_content)
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
layout.addWidget(scroll_area)
|
||||||
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
|
||||||
class QDebriefingWindow(QDialog):
|
class QDebriefingWindow(QDialog):
|
||||||
def __init__(self, debriefing: Debriefing):
|
def __init__(self, debriefing: Debriefing):
|
||||||
super(QDebriefingWindow, self).__init__()
|
super(QDebriefingWindow, self).__init__()
|
||||||
@ -75,12 +89,10 @@ class QDebriefingWindow(QDialog):
|
|||||||
title = QLabel("<b>Casualty report</b>")
|
title = QLabel("<b>Casualty report</b>")
|
||||||
layout.addWidget(title)
|
layout.addWidget(title)
|
||||||
|
|
||||||
player_lost_units = QGroupBox(f"{self.debriefing.player_country}'s lost units:")
|
player_lost_units = ScrollingCasualtyReportContainer(debriefing, player=True)
|
||||||
player_lost_units.setLayout(LossGrid(debriefing, player=True))
|
|
||||||
layout.addWidget(player_lost_units)
|
layout.addWidget(player_lost_units)
|
||||||
|
|
||||||
enemy_lost_units = QGroupBox(f"{self.debriefing.enemy_country}'s lost units:")
|
enemy_lost_units = ScrollingCasualtyReportContainer(debriefing, player=False)
|
||||||
enemy_lost_units.setLayout(LossGrid(debriefing, player=False))
|
|
||||||
layout.addWidget(enemy_lost_units)
|
layout.addWidget(enemy_lost_units)
|
||||||
|
|
||||||
okay = QPushButton("Okay")
|
okay = QPushButton("Okay")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user