mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Blacken.
This commit is contained in:
@@ -28,13 +28,14 @@ from gen.flights.flight import FlightType
|
||||
|
||||
|
||||
class QUnitInfoWindow(QDialog):
|
||||
|
||||
def __init__(self, game: Game, unit_type: Type[UnitType]) -> None:
|
||||
super(QUnitInfoWindow, self).__init__()
|
||||
self.setModal(True)
|
||||
self.game = game
|
||||
self.unit_type = unit_type
|
||||
self.setWindowTitle(f"Unit Info: {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'name')}")
|
||||
self.setWindowTitle(
|
||||
f"Unit Info: {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'name')}"
|
||||
)
|
||||
self.setWindowIcon(QIcon("./resources/icon.png"))
|
||||
self.setMinimumHeight(570)
|
||||
self.setMaximumWidth(640)
|
||||
@@ -47,7 +48,10 @@ class QUnitInfoWindow(QDialog):
|
||||
|
||||
header = QLabel(self)
|
||||
header.setGeometry(0, 0, 720, 360)
|
||||
if dcs.planes.plane_map.get(self.unit_type.id) is not None or dcs.helicopters.helicopter_map.get(self.unit_type.id) is not None:
|
||||
if (
|
||||
dcs.planes.plane_map.get(self.unit_type.id) is not None
|
||||
or dcs.helicopters.helicopter_map.get(self.unit_type.id) is not None
|
||||
):
|
||||
pixmap = AIRCRAFT_BANNERS.get(self.unit_type.id)
|
||||
elif dcs.vehicles.vehicle_map.get(self.unit_type.id) is not None:
|
||||
pixmap = VEHICLE_BANNERS.get(self.unit_type.id)
|
||||
@@ -57,24 +61,32 @@ class QUnitInfoWindow(QDialog):
|
||||
self.layout.addWidget(header, 0, 0)
|
||||
|
||||
self.gridLayout = QGridLayout()
|
||||
|
||||
|
||||
# Build the topmost details grid.
|
||||
self.details_grid = QFrame()
|
||||
self.details_grid_layout = QGridLayout()
|
||||
self.details_grid_layout.setMargin(0)
|
||||
|
||||
self.name_box = QLabel(f"<b>Name:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'manufacturer')} {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'name')}")
|
||||
self.name_box = QLabel(
|
||||
f"<b>Name:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'manufacturer')} {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'name')}"
|
||||
)
|
||||
self.name_box.setProperty("style", "info-element")
|
||||
|
||||
self.country_box = QLabel(f"<b>Country of Origin:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'country-of-origin')}")
|
||||
|
||||
self.country_box = QLabel(
|
||||
f"<b>Country of Origin:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'country-of-origin')}"
|
||||
)
|
||||
self.country_box.setProperty("style", "info-element")
|
||||
|
||||
self.role_box = QLabel(f"<b>Role:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'role')}")
|
||||
|
||||
self.role_box = QLabel(
|
||||
f"<b>Role:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'role')}"
|
||||
)
|
||||
self.role_box.setProperty("style", "info-element")
|
||||
|
||||
self.year_box = QLabel(f"<b>Variant Introduction:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'year-of-variant-introduction')}")
|
||||
|
||||
self.year_box = QLabel(
|
||||
f"<b>Variant Introduction:</b> {db.unit_get_expanded_info(self.game.player_country, self.unit_type, 'year-of-variant-introduction')}"
|
||||
)
|
||||
self.year_box.setProperty("style", "info-element")
|
||||
|
||||
|
||||
self.details_grid_layout.addWidget(self.name_box, 0, 0)
|
||||
self.details_grid_layout.addWidget(self.country_box, 0, 1)
|
||||
self.details_grid_layout.addWidget(self.role_box, 1, 0)
|
||||
@@ -83,17 +95,24 @@ class QUnitInfoWindow(QDialog):
|
||||
self.details_grid.setLayout(self.details_grid_layout)
|
||||
|
||||
self.gridLayout.addWidget(self.details_grid, 1, 0)
|
||||
|
||||
|
||||
# If it's an aircraft, include the task list.
|
||||
if dcs.planes.plane_map.get(self.unit_type.id) is not None or dcs.helicopters.helicopter_map.get(self.unit_type.id) is not None:
|
||||
self.tasks_box = QLabel(f"<b>In-Game Tasks:</b> {self.generateAircraftTasks()}")
|
||||
if (
|
||||
dcs.planes.plane_map.get(self.unit_type.id) is not None
|
||||
or dcs.helicopters.helicopter_map.get(self.unit_type.id) is not None
|
||||
):
|
||||
self.tasks_box = QLabel(
|
||||
f"<b>In-Game Tasks:</b> {self.generateAircraftTasks()}"
|
||||
)
|
||||
self.tasks_box.setProperty("style", "info-element")
|
||||
self.gridLayout.addWidget(self.tasks_box, 2, 0)
|
||||
|
||||
# Finally, add the description box.
|
||||
self.details_text = QTextBrowser()
|
||||
self.details_text.setProperty("style", "info-desc")
|
||||
self.details_text.setText(db.unit_get_expanded_info(self.game.player_country, self.unit_type, "text"))
|
||||
self.details_text.setText(
|
||||
db.unit_get_expanded_info(self.game.player_country, self.unit_type, "text")
|
||||
)
|
||||
self.gridLayout.addWidget(self.details_text, 3, 0)
|
||||
|
||||
self.layout.addLayout(self.gridLayout, 1, 0)
|
||||
@@ -102,9 +121,18 @@ class QUnitInfoWindow(QDialog):
|
||||
def generateAircraftTasks(self) -> str:
|
||||
aircraft_tasks = ""
|
||||
if self.unit_type in gen.flights.ai_flight_planner_db.CAP_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.BARCAP}, {FlightType.ESCORT}, {FlightType.INTERCEPTION}, {FlightType.SWEEP}, {FlightType.TARCAP}, "
|
||||
if self.unit_type in gen.flights.ai_flight_planner_db.CAS_CAPABLE or self.unit_type in gen.flights.ai_flight_planner_db.TRANSPORT_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.CAS}, {FlightType.BAI}, {FlightType.OCA_AIRCRAFT}, "
|
||||
aircraft_tasks = (
|
||||
aircraft_tasks
|
||||
+ f"{FlightType.BARCAP}, {FlightType.ESCORT}, {FlightType.INTERCEPTION}, {FlightType.SWEEP}, {FlightType.TARCAP}, "
|
||||
)
|
||||
if (
|
||||
self.unit_type in gen.flights.ai_flight_planner_db.CAS_CAPABLE
|
||||
or self.unit_type in gen.flights.ai_flight_planner_db.TRANSPORT_CAPABLE
|
||||
):
|
||||
aircraft_tasks = (
|
||||
aircraft_tasks
|
||||
+ f"{FlightType.CAS}, {FlightType.BAI}, {FlightType.OCA_AIRCRAFT}, "
|
||||
)
|
||||
if self.unit_type in gen.flights.ai_flight_planner_db.SEAD_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.SEAD}, "
|
||||
if self.unit_type in gen.flights.ai_flight_planner_db.DEAD_CAPABLE:
|
||||
@@ -113,6 +141,9 @@ class QUnitInfoWindow(QDialog):
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.ANTISHIP}, "
|
||||
if self.unit_type in gen.flights.ai_flight_planner_db.RUNWAY_ATTACK_CAPABLE:
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.OCA_RUNWAY}, "
|
||||
if self.unit_type in gen.flights.ai_flight_planner_db.STRIKE_CAPABLE or self.unit_type in gen.flights.ai_flight_planner_db.TRANSPORT_CAPABLE:
|
||||
if (
|
||||
self.unit_type in gen.flights.ai_flight_planner_db.STRIKE_CAPABLE
|
||||
or self.unit_type in gen.flights.ai_flight_planner_db.TRANSPORT_CAPABLE
|
||||
):
|
||||
aircraft_tasks = aircraft_tasks + f"{FlightType.STRIKE}, "
|
||||
return aircraft_tasks[:-2]
|
||||
return aircraft_tasks[:-2]
|
||||
|
||||
Reference in New Issue
Block a user