mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixes #268
Changes red base info to show defenses first, and adds an attack option
This commit is contained in:
parent
ac05c7cfaa
commit
cdb16cc591
@ -34,12 +34,13 @@ class Dialog:
|
||||
cls.game_model = game_model
|
||||
|
||||
@classmethod
|
||||
def open_new_package_dialog(cls, mission_target: MissionTarget):
|
||||
def open_new_package_dialog(cls, mission_target: MissionTarget, parent=None):
|
||||
"""Opens the dialog to create a new package with the given target."""
|
||||
cls.new_package_dialog = QNewPackageDialog(
|
||||
cls.game_model,
|
||||
cls.game_model.ato_model,
|
||||
mission_target
|
||||
mission_target,
|
||||
parent=parent
|
||||
)
|
||||
cls.new_package_dialog.show()
|
||||
|
||||
|
||||
@ -16,11 +16,11 @@ class QBaseMenuTabs(QTabWidget):
|
||||
if cp:
|
||||
|
||||
if not cp.captured:
|
||||
self.intel = QIntelInfo(cp, game_model.game)
|
||||
self.addTab(self.intel, "Intel")
|
||||
if not cp.is_carrier:
|
||||
self.base_defenses_hq = QBaseDefensesHQ(cp, game_model.game)
|
||||
self.addTab(self.base_defenses_hq, "Base Defenses")
|
||||
self.intel = QIntelInfo(cp, game_model.game)
|
||||
self.addTab(self.intel, "Intel")
|
||||
else:
|
||||
if cp.has_runway():
|
||||
self.airfield_command = QAirfieldCommand(cp, game_model)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from PySide2.QtCore import Qt
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QPushButton, QVBoxLayout
|
||||
|
||||
from qt_ui.dialogs import Dialog
|
||||
from qt_ui.uiconstants import VEHICLES_ICONS
|
||||
from qt_ui.windows.groundobject.QGroundObjectMenu import QGroundObjectMenu
|
||||
from theater import ControlPoint, TheaterGroundObject
|
||||
@ -23,12 +24,17 @@ class QBaseDefenseGroupInfo(QGroupBox):
|
||||
def init_ui(self):
|
||||
|
||||
self.buildLayout()
|
||||
self.main_layout.addLayout(self.unit_layout)
|
||||
if not self.cp.captured:
|
||||
attack_button = QPushButton("Attack")
|
||||
attack_button.setProperty("style", "btn-danger")
|
||||
attack_button.setMaximumWidth(180)
|
||||
attack_button.clicked.connect(self.onAttack)
|
||||
self.main_layout.addWidget(attack_button, 0, Qt.AlignLeft)
|
||||
manage_button = QPushButton("Manage")
|
||||
manage_button.setProperty("style", "btn-success")
|
||||
manage_button.setMaximumWidth(180)
|
||||
manage_button.clicked.connect(self.onManage)
|
||||
|
||||
self.main_layout.addLayout(self.unit_layout)
|
||||
self.main_layout.addWidget(manage_button, 0, Qt.AlignLeft)
|
||||
|
||||
self.setLayout(self.main_layout)
|
||||
@ -66,6 +72,9 @@ class QBaseDefenseGroupInfo(QGroupBox):
|
||||
|
||||
|
||||
self.setLayout(self.main_layout)
|
||||
|
||||
def onAttack(self):
|
||||
Dialog.open_new_package_dialog(self.ground_object, parent=self.window())
|
||||
|
||||
def onManage(self):
|
||||
self.edition_menu = QGroundObjectMenu(self.window(), self.ground_object, self.buildings, self.cp, self.game)
|
||||
|
||||
@ -15,8 +15,8 @@ from qt_ui.windows.mission.flight.QFlightPlanner import QFlightPlanner
|
||||
class QEditFlightDialog(QDialog):
|
||||
"""Dialog window for editing flight plans and loadouts."""
|
||||
|
||||
def __init__(self, game_model: GameModel, package: Package, flight: Flight) -> None:
|
||||
super().__init__()
|
||||
def __init__(self, game_model: GameModel, package: Package, flight: Flight, parent=None) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self.game_model = game_model
|
||||
|
||||
|
||||
@ -36,8 +36,8 @@ class QPackageDialog(QDialog):
|
||||
#: Emitted when a change is made to the package.
|
||||
package_changed = Signal()
|
||||
|
||||
def __init__(self, game_model: GameModel, model: PackageModel) -> None:
|
||||
super().__init__()
|
||||
def __init__(self, game_model: GameModel, model: PackageModel, parent=None) -> None:
|
||||
super().__init__(parent)
|
||||
self.game_model = game_model
|
||||
self.package_model = model
|
||||
self.add_flight_dialog: Optional[QFlightCreator] = None
|
||||
@ -156,7 +156,8 @@ class QPackageDialog(QDialog):
|
||||
def on_add_flight(self) -> None:
|
||||
"""Opens the new flight dialog."""
|
||||
self.add_flight_dialog = QFlightCreator(self.game,
|
||||
self.package_model.package)
|
||||
self.package_model.package,
|
||||
parent=self.window())
|
||||
self.add_flight_dialog.created.connect(self.add_flight)
|
||||
self.add_flight_dialog.show()
|
||||
|
||||
@ -189,8 +190,8 @@ class QNewPackageDialog(QPackageDialog):
|
||||
"""
|
||||
|
||||
def __init__(self, game_model: GameModel, model: AtoModel,
|
||||
target: MissionTarget) -> None:
|
||||
super().__init__(game_model, PackageModel(Package(target)))
|
||||
target: MissionTarget, parent=None) -> None:
|
||||
super().__init__(game_model, PackageModel(Package(target)), parent=parent)
|
||||
self.ato_model = model
|
||||
|
||||
self.save_button = QPushButton("Save")
|
||||
|
||||
@ -23,8 +23,8 @@ from theater import ControlPoint
|
||||
class QFlightCreator(QDialog):
|
||||
created = Signal(Flight)
|
||||
|
||||
def __init__(self, game: Game, package: Package) -> None:
|
||||
super().__init__()
|
||||
def __init__(self, game: Game, package: Package, parent=None) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
self.game = game
|
||||
self.package = package
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user