From 32dc3c3170c8641f296cbe587e8de2adec0d22dd Mon Sep 17 00:00:00 2001 From: Chris Seagraves <47610393+nosv1@users.noreply.github.com> Date: Wed, 30 Jun 2021 14:04:06 -0500 Subject: [PATCH] asset reference links :sunglasses: (#1363) Adds urls to unit info pages that don't have data. (cherry picked from commit 5f5b5f69e31c0abb358f64431c686356a051543a) --- changelog.md | 2 ++ game/dcs/aircrafttype.py | 5 ++++- game/dcs/groundunittype.py | 6 +++++- qt_ui/windows/QUnitInfoWindow.py | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index aa3cad6b..b30a0482 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,8 @@ Saves from 4.0.0 are compatible with 4.0.1. ## Features/Improvements +* **[UI]** Google search link added to unit information when there is no information provided. + ## Fixes # 4.0.0 diff --git a/game/dcs/aircrafttype.py b/game/dcs/aircrafttype.py index 126f2064..9b5fedae 100644 --- a/game/dcs/aircrafttype.py +++ b/game/dcs/aircrafttype.py @@ -229,7 +229,10 @@ class AircraftType(UnitType[FlyingType]): yield AircraftType( dcs_unit_type=aircraft, name=variant, - description=data.get("description", "No data."), + description=data.get( + "description", + f"No data. Google {variant}", + ), year_introduced=introduction, country_of_origin=data.get("origin", "No data."), manufacturer=data.get("manufacturer", "No data."), diff --git a/game/dcs/groundunittype.py b/game/dcs/groundunittype.py index 7cf92fcf..c2b6f2ab 100644 --- a/game/dcs/groundunittype.py +++ b/game/dcs/groundunittype.py @@ -57,6 +57,7 @@ class GroundUnitType(UnitType[VehicleType]): def _load_all(cls) -> None: for unit_type in cls._each_unit_type(): for data in cls._each_variant_of(unit_type): + print(data.name, data.description) cls.register(data) cls._loaded = True @@ -88,7 +89,10 @@ class GroundUnitType(UnitType[VehicleType]): unit_class=unit_class, spawn_weight=data.get("spawn_weight", 0), name=variant, - description=data.get("description", "No data."), + description=data.get( + "description", + f"No data. Google {variant}", + ), year_introduced=introduction, country_of_origin=data.get("origin", "No data."), manufacturer=data.get("manufacturer", "No data."), diff --git a/qt_ui/windows/QUnitInfoWindow.py b/qt_ui/windows/QUnitInfoWindow.py index a87ce597..e5503544 100644 --- a/qt_ui/windows/QUnitInfoWindow.py +++ b/qt_ui/windows/QUnitInfoWindow.py @@ -94,6 +94,9 @@ class QUnitInfoWindow(QDialog): self.details_text = QTextBrowser() self.details_text.setProperty("style", "info-desc") self.details_text.setText(unit_type.description) + self.details_text.setOpenExternalLinks( + True + ) # in aircrafttype.py and groundunittype.py, for the descriptions, if No Data. including a google search link self.gridLayout.addWidget(self.details_text, 3, 0) self.layout.addLayout(self.gridLayout, 1, 0)