mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Polished mission generator, fixed sam bug on map view.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from PySide2.QtGui import Qt
|
||||
from PySide2.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout
|
||||
from PySide2.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout, QGroupBox
|
||||
from dcs import Point
|
||||
|
||||
from game import Game
|
||||
@@ -31,8 +31,6 @@ class QCASMissionGenerator(QAbstractMissionGenerator):
|
||||
else:
|
||||
self.distanceToTargetLabel.setText("??? nm")
|
||||
|
||||
|
||||
|
||||
def init_ui(self):
|
||||
layout = QVBoxLayout()
|
||||
|
||||
@@ -41,14 +39,16 @@ class QCASMissionGenerator(QAbstractMissionGenerator):
|
||||
wpt_layout.addWidget(self.wpt_selection_box)
|
||||
wpt_layout.addStretch()
|
||||
|
||||
distToTargetBox = QGroupBox("Infos :")
|
||||
distToTarget = QHBoxLayout()
|
||||
distToTarget.addWidget(QLabel("Distance to target : "))
|
||||
distToTarget.addStretch()
|
||||
distToTarget.addWidget(self.distanceToTargetLabel, alignment=Qt.AlignRight)
|
||||
distToTargetBox.setLayout(distToTarget)
|
||||
|
||||
layout.addLayout(wpt_layout)
|
||||
layout.addWidget(self.wpt_info)
|
||||
layout.addLayout(distToTarget)
|
||||
layout.addWidget(distToTargetBox)
|
||||
layout.addStretch()
|
||||
layout.addWidget(self.ok_button)
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from PySide2.QtGui import Qt
|
||||
from PySide2.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout
|
||||
from PySide2.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout, QGroupBox
|
||||
|
||||
from game import Game
|
||||
from gen.flights.ai_flight_planner import meter_to_nm
|
||||
from gen.flights.flight import Flight
|
||||
from qt_ui.widgets.combos.QSEADTargetSelectionComboBox import QSEADTargetSelectionComboBox
|
||||
from qt_ui.widgets.views.QSeadTargetInfoView import QSeadTargetInfoView
|
||||
from qt_ui.windows.mission.flight.generator.QAbstractMissionGenerator import QAbstractMissionGenerator
|
||||
|
||||
|
||||
@@ -20,14 +21,17 @@ class QSEADMissionGenerator(QAbstractMissionGenerator):
|
||||
self.distanceToTargetLabel = QLabel("0 nm")
|
||||
self.threatRangeLabel = QLabel("0 nm")
|
||||
self.detectionRangeLabel = QLabel("0 nm")
|
||||
self.seadTargetInfoView = QSeadTargetInfoView(None)
|
||||
self.init_ui()
|
||||
self.on_selected_target_changed()
|
||||
|
||||
def on_selected_target_changed(self):
|
||||
target = self.tgt_selection_box.get_selected_target()
|
||||
self.distanceToTargetLabel.setText("~" + str(meter_to_nm(self.flight.from_cp.position.distance_to_point(target.location.position))) + " nm")
|
||||
self.threatRangeLabel.setText(str(meter_to_nm(target.threat_range)) + " nm")
|
||||
self.detectionRangeLabel.setText(str(meter_to_nm(target.detection_range)) + " nm")
|
||||
if target is not None:
|
||||
self.distanceToTargetLabel.setText("~" + str(meter_to_nm(self.flight.from_cp.position.distance_to_point(target.location.position))) + " nm")
|
||||
self.threatRangeLabel.setText(str(meter_to_nm(target.threat_range)) + " nm")
|
||||
self.detectionRangeLabel.setText(str(meter_to_nm(target.detection_range)) + " nm")
|
||||
self.seadTargetInfoView.setTarget(target)
|
||||
|
||||
def init_ui(self):
|
||||
layout = QVBoxLayout()
|
||||
@@ -37,6 +41,9 @@ class QSEADMissionGenerator(QAbstractMissionGenerator):
|
||||
wpt_layout.addStretch()
|
||||
wpt_layout.addWidget(self.tgt_selection_box, alignment=Qt.AlignRight)
|
||||
|
||||
distThreatBox = QGroupBox("Infos :")
|
||||
threatLayout = QVBoxLayout()
|
||||
|
||||
distToTarget = QHBoxLayout()
|
||||
distToTarget.addWidget(QLabel("Distance to site : "))
|
||||
distToTarget.addStretch()
|
||||
@@ -52,10 +59,14 @@ class QSEADMissionGenerator(QAbstractMissionGenerator):
|
||||
detectionRangeLayout.addStretch()
|
||||
detectionRangeLayout.addWidget(self.detectionRangeLabel, alignment=Qt.AlignRight)
|
||||
|
||||
threatLayout.addLayout(distToTarget)
|
||||
threatLayout.addLayout(threatRangeLayout)
|
||||
threatLayout.addLayout(detectionRangeLayout)
|
||||
distThreatBox.setLayout(threatLayout)
|
||||
|
||||
layout.addLayout(wpt_layout)
|
||||
layout.addLayout(distToTarget)
|
||||
layout.addLayout(threatRangeLayout)
|
||||
layout.addLayout(detectionRangeLayout)
|
||||
layout.addWidget(self.seadTargetInfoView)
|
||||
layout.addWidget(distThreatBox)
|
||||
layout.addStretch()
|
||||
layout.addWidget(self.ok_button)
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from PySide2.QtGui import Qt
|
||||
from PySide2.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout
|
||||
from PySide2.QtWidgets import QLabel, QHBoxLayout, QVBoxLayout, QGroupBox
|
||||
|
||||
from game import Game
|
||||
from gen.flights.ai_flight_planner import meter_to_nm
|
||||
from gen.flights.flight import Flight
|
||||
from qt_ui.widgets.combos.QStrikeTargetSelectionComboBox import QStrikeTargetSelectionComboBox
|
||||
from qt_ui.widgets.views.QStrikeTargetInfoView import QStrikeTargetInfoView
|
||||
from qt_ui.windows.mission.flight.generator.QAbstractMissionGenerator import QAbstractMissionGenerator
|
||||
|
||||
|
||||
@@ -17,13 +18,16 @@ class QSTRIKEMissionGenerator(QAbstractMissionGenerator):
|
||||
self.tgt_selection_box.setMinimumWidth(200)
|
||||
self.tgt_selection_box.currentTextChanged.connect(self.on_selected_target_changed)
|
||||
|
||||
|
||||
self.distanceToTargetLabel = QLabel("0 nm")
|
||||
self.strike_infos = QStrikeTargetInfoView(None)
|
||||
self.init_ui()
|
||||
self.on_selected_target_changed()
|
||||
|
||||
def on_selected_target_changed(self):
|
||||
target = self.tgt_selection_box.get_selected_target()
|
||||
self.distanceToTargetLabel.setText("~" + str(meter_to_nm(self.flight.from_cp.position.distance_to_point(target.location.position))) + " nm")
|
||||
self.strike_infos.setTarget(target)
|
||||
|
||||
def init_ui(self):
|
||||
layout = QVBoxLayout()
|
||||
@@ -33,13 +37,16 @@ class QSTRIKEMissionGenerator(QAbstractMissionGenerator):
|
||||
wpt_layout.addStretch()
|
||||
wpt_layout.addWidget(self.tgt_selection_box, alignment=Qt.AlignRight)
|
||||
|
||||
distToTargetBox = QGroupBox("Infos :")
|
||||
distToTarget = QHBoxLayout()
|
||||
distToTarget.addWidget(QLabel("Distance to target : "))
|
||||
distToTarget.addStretch()
|
||||
distToTarget.addWidget(self.distanceToTargetLabel, alignment=Qt.AlignRight)
|
||||
distToTargetBox.setLayout(distToTarget)
|
||||
|
||||
layout.addLayout(wpt_layout)
|
||||
layout.addLayout(distToTarget)
|
||||
layout.addWidget(self.strike_infos)
|
||||
layout.addWidget(distToTargetBox)
|
||||
layout.addStretch()
|
||||
layout.addWidget(self.ok_button)
|
||||
|
||||
@@ -47,10 +54,10 @@ class QSTRIKEMissionGenerator(QAbstractMissionGenerator):
|
||||
|
||||
def apply(self):
|
||||
self.flight.points = []
|
||||
# target = self.tgt_selection_box.get_selected_target()
|
||||
# self.planner.generate_sead(self.flight, target.location, target.radars)
|
||||
# self.flight_waypoint_list.update_list()
|
||||
# self.close()
|
||||
target = self.tgt_selection_box.get_selected_target()
|
||||
self.planner.generate_strike(self.flight, target.location)
|
||||
self.flight_waypoint_list.update_list()
|
||||
self.close()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ class QLoadoutEditor(QGroupBox):
|
||||
|
||||
self.toggled.connect(self.on_toggle)
|
||||
|
||||
layout = QGridLayout()
|
||||
hboxLayout = QVBoxLayout(self)
|
||||
layout = QGridLayout(self)
|
||||
|
||||
pylons = [v for v in self.flight.unit_type.__dict__.values() if inspect.isclass(v) and v.__name__.startswith("Pylon")]
|
||||
for i, pylon in enumerate(pylons):
|
||||
@@ -25,7 +26,9 @@ class QLoadoutEditor(QGroupBox):
|
||||
layout.addWidget(label, i, 0)
|
||||
layout.addWidget(QPylonEditor(flight, pylon, i+1), i, 1)
|
||||
|
||||
self.setLayout(layout)
|
||||
hboxLayout.addLayout(layout)
|
||||
hboxLayout.addStretch()
|
||||
self.setLayout(hboxLayout)
|
||||
|
||||
def on_toggle(self):
|
||||
self.flight.use_custom_loadout = self.isChecked()
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
from PySide2.QtCore import QItemSelectionModel, QPoint
|
||||
from PySide2.QtCore import QItemSelectionModel, QPoint, Qt
|
||||
from PySide2.QtGui import QStandardItemModel
|
||||
from PySide2.QtWidgets import QListView
|
||||
from PySide2.QtWidgets import QListView, QTableView, QHeaderView
|
||||
|
||||
from gen.flights.flight import Flight, FlightWaypoint
|
||||
from qt_ui.windows.mission.flight.waypoints.QFlightWaypointItem import QWaypointItem
|
||||
|
||||
|
||||
class QFlightWaypointList(QListView):
|
||||
class QFlightWaypointList(QTableView):
|
||||
|
||||
def __init__(self, flight: Flight):
|
||||
super(QFlightWaypointList, self).__init__()
|
||||
self.model = QStandardItemModel(self)
|
||||
self.setModel(self.model)
|
||||
self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
self.model.setHorizontalHeaderLabels(["Name"])
|
||||
self.flight = flight
|
||||
|
||||
if len(self.flight.points) > 0:
|
||||
|
||||
Reference in New Issue
Block a user