From fe227e02b877d051ddfb3ed35161c71ee8b2f726 Mon Sep 17 00:00:00 2001 From: jsjlewis96 Date: Sat, 19 Jun 2021 01:20:49 +0100 Subject: [PATCH] Shows total at top for economic intel --- qt_ui/windows/finances/QFinancesMenu.py | 13 +++++++++---- qt_ui/windows/intel.py | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/qt_ui/windows/finances/QFinancesMenu.py b/qt_ui/windows/finances/QFinancesMenu.py index ea008c10..4ef8b281 100644 --- a/qt_ui/windows/finances/QFinancesMenu.py +++ b/qt_ui/windows/finances/QFinancesMenu.py @@ -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"{income.total}M", ) - if player: budget = game.budget else: budget = game.enemy_budget - self.add_row(middle="Balance", right=f"{budget}M") self.setRowStretch(next(self.row), 1) diff --git a/qt_ui/windows/intel.py b/qt_ui/windows/intel.py index 65e352bf..619938cf 100644 --- a/qt_ui/windows/intel.py +++ b/qt_ui/windows/intel.py @@ -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):