mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add basic enemy intel widget.
https://github.com/Khopa/dcs_liberation/issues/658
This commit is contained in:
parent
c833078e71
commit
b53cac4c7a
40
qt_ui/widgets/QIntelBox.py
Normal file
40
qt_ui/widgets/QIntelBox.py
Normal file
@ -0,0 +1,40 @@
|
||||
from typing import Optional
|
||||
|
||||
from PySide2.QtWidgets import QGroupBox, QHBoxLayout, QLabel, QVBoxLayout
|
||||
|
||||
from game import Game
|
||||
|
||||
|
||||
class QIntelBox(QGroupBox):
|
||||
def __init__(self, game: Game) -> None:
|
||||
super().__init__("Intel")
|
||||
self.game = game
|
||||
|
||||
columns = QHBoxLayout()
|
||||
self.setLayout(columns)
|
||||
|
||||
summary = QVBoxLayout()
|
||||
columns.addLayout(summary)
|
||||
|
||||
self.total_aircraft = QLabel()
|
||||
summary.addWidget(self.total_aircraft)
|
||||
self.total_ground_forces = QLabel()
|
||||
summary.addWidget(self.total_ground_forces)
|
||||
|
||||
self.update_summary()
|
||||
|
||||
def set_game(self, game: Optional[Game]) -> None:
|
||||
self.game = game
|
||||
self.update_summary()
|
||||
|
||||
def update_summary(self) -> None:
|
||||
if self.game is None:
|
||||
aircraft = 0
|
||||
ground_units = 0
|
||||
else:
|
||||
data = self.game.game_stats.data_per_turn[-1]
|
||||
aircraft = data.enemy_units.aircraft_count
|
||||
ground_units = data.enemy_units.vehicles_count
|
||||
self.total_aircraft.setText(f"Total enemy aircraft: {aircraft}")
|
||||
self.total_ground_forces.setText(
|
||||
f"Total enemy ground units: {ground_units}")
|
||||
@ -19,6 +19,7 @@ from gen.flights.traveltime import TotEstimator
|
||||
from qt_ui.models import GameModel
|
||||
from qt_ui.widgets.QBudgetBox import QBudgetBox
|
||||
from qt_ui.widgets.QFactionsInfos import QFactionsInfos
|
||||
from qt_ui.widgets.QIntelBox import QIntelBox
|
||||
from qt_ui.widgets.clientslots import MaxPlayerCount
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from qt_ui.windows.QWaitingForMissionResultWindow import \
|
||||
@ -74,6 +75,8 @@ class QTopPanel(QFrame):
|
||||
self.statistics.setProperty("style", "btn-primary")
|
||||
self.statistics.clicked.connect(self.openStatisticsWindow)
|
||||
|
||||
self.intel_box = QIntelBox(self.game)
|
||||
|
||||
self.buttonBox = QGroupBox("Misc")
|
||||
self.buttonBoxLayout = QHBoxLayout()
|
||||
self.buttonBoxLayout.addWidget(self.settings)
|
||||
@ -93,6 +96,7 @@ class QTopPanel(QFrame):
|
||||
self.layout.addWidget(self.factionsInfos)
|
||||
self.layout.addWidget(self.conditionsWidget)
|
||||
self.layout.addWidget(self.budgetBox)
|
||||
self.layout.addWidget(self.intel_box)
|
||||
self.layout.addWidget(self.buttonBox)
|
||||
self.layout.addStretch(1)
|
||||
self.layout.addWidget(self.proceedBox)
|
||||
@ -109,6 +113,7 @@ class QTopPanel(QFrame):
|
||||
self.statistics.setEnabled(True)
|
||||
|
||||
self.conditionsWidget.setCurrentTurn(game.turn, game.conditions)
|
||||
self.intel_box.set_game(game)
|
||||
self.budgetBox.setGame(game)
|
||||
self.factionsInfos.setGame(game)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user