mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Shows total at top for economic intel
This commit is contained in:
parent
c68e583c20
commit
fe227e02b8
@ -26,12 +26,16 @@ class QHorizontalSeparationLine(QFrame):
|
||||
|
||||
|
||||
class FinancesLayout(QGridLayout):
|
||||
def __init__(self, game: Game, player: bool) -> None:
|
||||
def __init__(self, game: Game, player: bool, total_at_top: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.row = itertools.count(0)
|
||||
|
||||
income = Income(game, player)
|
||||
|
||||
if total_at_top:
|
||||
self.add_total(game, income, player)
|
||||
self.add_line()
|
||||
|
||||
control_points = reversed(
|
||||
sorted(income.control_points, key=lambda c: c.income_per_turn)
|
||||
)
|
||||
@ -44,18 +48,19 @@ class FinancesLayout(QGridLayout):
|
||||
for building in buildings:
|
||||
self.add_building(building)
|
||||
|
||||
self.add_line()
|
||||
if not total_at_top:
|
||||
self.add_line()
|
||||
self.add_total(game, income, player)
|
||||
|
||||
def add_total(self, game, income, player):
|
||||
self.add_row(
|
||||
middle=f"Income multiplier: {income.multiplier:.1f}",
|
||||
right=f"<b>{income.total}M</b>",
|
||||
)
|
||||
|
||||
if player:
|
||||
budget = game.budget
|
||||
else:
|
||||
budget = game.enemy_budget
|
||||
|
||||
self.add_row(middle="Balance", right=f"<b>{budget}M</b>")
|
||||
self.setRowStretch(next(self.row), 1)
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class ScrollingFrame(QFrame):
|
||||
class EconomyIntelTab(ScrollingFrame):
|
||||
def __init__(self, game: Game, player: bool) -> None:
|
||||
super().__init__()
|
||||
self.addLayout(FinancesLayout(game, player=player))
|
||||
self.addLayout(FinancesLayout(game, player=player, total_at_top=True))
|
||||
|
||||
|
||||
class IntelTableLayout(QGridLayout):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user