mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge branch 'develop' into frontline
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout, QLCDNumber
|
||||
|
||||
from theater import ControlPoint, Airport
|
||||
|
||||
|
||||
class QAirportInformation(QGroupBox):
|
||||
|
||||
def __init__(self, cp:ControlPoint, airport:Airport):
|
||||
super(QAirportInformation, self).__init__(airport.name)
|
||||
self.cp = cp
|
||||
self.airport = airport
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.layout = QGridLayout()
|
||||
|
||||
# Runway information
|
||||
self.runways = QGroupBox("Runways")
|
||||
self.runwayLayout = QGridLayout()
|
||||
for i, runway in enumerate(self.airport.runways):
|
||||
|
||||
# Seems like info is missing in pydcs, even if the attribute is there
|
||||
lr = ""
|
||||
if runway.leftright == 1:
|
||||
lr = "L"
|
||||
elif runway.leftright == 2:
|
||||
lr = "R"
|
||||
|
||||
self.runwayLayout.addWidget(QLabel("Runway " + str(runway.heading) + lr), i, 0)
|
||||
|
||||
# Seems like info is missing in pydcs, even if the attribute is there
|
||||
if runway.ils:
|
||||
self.runwayLayout.addWidget(QLabel("ILS "), i, 1)
|
||||
self.runwayLayout.addWidget(QLCDNumber(6, runway.ils), i, 1)
|
||||
else:
|
||||
self.runwayLayout.addWidget(QLabel("NO ILS"), i, 1)
|
||||
|
||||
|
||||
self.runways.setLayout(self.runwayLayout)
|
||||
self.layout.addWidget(self.runways, 0, 0)
|
||||
|
||||
self.layout.addWidget(QLabel("<b>Parking Slots :</b>"), 1, 0)
|
||||
self.layout.addWidget(QLabel(str(len(self.airport.parking_slots))), 1, 1)
|
||||
|
||||
|
||||
stretch = QVBoxLayout()
|
||||
stretch.addStretch()
|
||||
|
||||
self.layout.addLayout(stretch, 2, 0)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ from typing import Iterable
|
||||
|
||||
from PySide2.QtWidgets import QComboBox
|
||||
|
||||
from dcs.planes import PlaneType
|
||||
from dcs.unittype import FlyingType
|
||||
|
||||
|
||||
class QAircraftTypeSelector(QComboBox):
|
||||
"""Combo box for selecting among the given aircraft types."""
|
||||
|
||||
def __init__(self, aircraft_types: Iterable[PlaneType]) -> None:
|
||||
def __init__(self, aircraft_types: Iterable[FlyingType]) -> None:
|
||||
super().__init__()
|
||||
for aircraft in aircraft_types:
|
||||
self.addItem(f"{aircraft.id}", userData=aircraft)
|
||||
|
||||
40
qt_ui/widgets/combos/QArrivalAirfieldSelector.py
Normal file
40
qt_ui/widgets/combos/QArrivalAirfieldSelector.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""Combo box for selecting a departure airfield."""
|
||||
from typing import Iterable
|
||||
|
||||
from PySide2.QtWidgets import QComboBox
|
||||
from dcs.unittype import FlyingType
|
||||
|
||||
from game import db
|
||||
from game.theater.controlpoint import ControlPoint
|
||||
|
||||
|
||||
class QArrivalAirfieldSelector(QComboBox):
|
||||
"""A combo box for selecting a flight's arrival or divert airfield.
|
||||
|
||||
The combo box will automatically be populated with all airfields the given
|
||||
aircraft type is able to land at.
|
||||
"""
|
||||
|
||||
def __init__(self, destinations: Iterable[ControlPoint],
|
||||
aircraft: FlyingType, optional_text: str) -> None:
|
||||
super().__init__()
|
||||
self.destinations = list(destinations)
|
||||
self.aircraft = aircraft
|
||||
self.optional_text = optional_text
|
||||
self.rebuild_selector()
|
||||
self.setCurrentIndex(0)
|
||||
|
||||
def change_aircraft(self, aircraft: FlyingType) -> None:
|
||||
if self.aircraft == aircraft:
|
||||
return
|
||||
self.aircraft = aircraft
|
||||
self.rebuild_selector()
|
||||
|
||||
def rebuild_selector(self) -> None:
|
||||
self.clear()
|
||||
for destination in self.destinations:
|
||||
if destination.can_land(self.aircraft):
|
||||
self.addItem(destination.name, destination)
|
||||
self.model().sort(0)
|
||||
self.insertItem(0, self.optional_text, None)
|
||||
self.update()
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from PySide2.QtWidgets import QComboBox
|
||||
|
||||
from theater import ConflictTheater, MissionTarget
|
||||
from game.theater import ConflictTheater, MissionTarget
|
||||
|
||||
|
||||
class QFlightTypeComboBox(QComboBox):
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import Iterable
|
||||
|
||||
from PySide2.QtCore import Signal
|
||||
from PySide2.QtWidgets import QComboBox
|
||||
from dcs.planes import PlaneType
|
||||
from dcs.unittype import FlyingType
|
||||
|
||||
from game.inventory import GlobalAircraftInventory
|
||||
from game.theater.controlpoint import ControlPoint
|
||||
@@ -20,7 +20,7 @@ class QOriginAirfieldSelector(QComboBox):
|
||||
|
||||
def __init__(self, global_inventory: GlobalAircraftInventory,
|
||||
origins: Iterable[ControlPoint],
|
||||
aircraft: PlaneType) -> None:
|
||||
aircraft: FlyingType) -> None:
|
||||
super().__init__()
|
||||
self.global_inventory = global_inventory
|
||||
self.origins = list(origins)
|
||||
@@ -28,7 +28,7 @@ class QOriginAirfieldSelector(QComboBox):
|
||||
self.rebuild_selector()
|
||||
self.currentIndexChanged.connect(self.index_changed)
|
||||
|
||||
def change_aircraft(self, aircraft: PlaneType) -> None:
|
||||
def change_aircraft(self, aircraft: FlyingType) -> None:
|
||||
if self.aircraft == aircraft:
|
||||
return
|
||||
self.aircraft = aircraft
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from PySide2.QtGui import QStandardItem, QStandardItemModel
|
||||
|
||||
from game import Game
|
||||
from game.theater import ControlPointType
|
||||
from gen import BuildingGroundObject, Conflict, FlightWaypointType
|
||||
from gen.flights.flight import FlightWaypoint
|
||||
from qt_ui.widgets.combos.QFilteredComboBox import QFilteredComboBox
|
||||
from theater import ControlPointType
|
||||
|
||||
|
||||
class QPredefinedWaypointSelectionComboBox(QFilteredComboBox):
|
||||
|
||||
@@ -13,11 +13,11 @@ from PySide2.QtWidgets import (
|
||||
)
|
||||
|
||||
import qt_ui.uiconstants as const
|
||||
from game.theater import FrontLine
|
||||
from qt_ui.dialogs import Dialog
|
||||
from qt_ui.models import GameModel
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from qt_ui.windows.mission.QPackageDialog import QNewPackageDialog
|
||||
from theater import FrontLine
|
||||
|
||||
|
||||
class QFrontLine(QGraphicsLineItem):
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
import datetime
|
||||
import logging
|
||||
import math
|
||||
from typing import Iterable, List, Optional, Tuple, Iterator
|
||||
from typing import Iterable, Iterator, List, Optional, Tuple
|
||||
|
||||
from PySide2.QtCore import QPointF, Qt
|
||||
from PySide2.QtGui import (
|
||||
@@ -27,6 +27,13 @@ from dcs.mapping import point_from_heading
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game import Game, db
|
||||
from game.theater import ControlPoint
|
||||
from game.theater.conflicttheater import FrontLine
|
||||
from game.theater.theatergroundobject import (
|
||||
EwrGroundObject,
|
||||
MissileSiteGroundObject,
|
||||
TheaterGroundObject,
|
||||
)
|
||||
from game.utils import meter_to_feet
|
||||
from game.weather import TimeOfDay
|
||||
from gen import Conflict
|
||||
@@ -39,13 +46,7 @@ from qt_ui.widgets.map.QLiberationScene import QLiberationScene
|
||||
from qt_ui.widgets.map.QMapControlPoint import QMapControlPoint
|
||||
from qt_ui.widgets.map.QMapGroundObject import QMapGroundObject
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from theater import ControlPoint
|
||||
from game.theater.conflicttheater import FrontLine
|
||||
from game.theater.theatergroundobject import (
|
||||
EwrGroundObject,
|
||||
MissileSiteGroundObject,
|
||||
TheaterGroundObject,
|
||||
)
|
||||
|
||||
|
||||
def binomial(i: int, n: int) -> float:
|
||||
"""Binomial coefficient"""
|
||||
@@ -373,6 +374,10 @@ class QLiberationMap(QGraphicsView):
|
||||
FlightWaypointType.TARGET_SHIP,
|
||||
)
|
||||
for idx, point in enumerate(flight.flight_plan.waypoints[1:]):
|
||||
if point.waypoint_type == FlightWaypointType.DIVERT:
|
||||
# Don't clutter the map showing divert points.
|
||||
continue
|
||||
|
||||
new_pos = self._transform_point(Point(point.x, point.y))
|
||||
self.draw_flight_path(scene, prev_pos, new_pos, is_player,
|
||||
selected)
|
||||
@@ -386,7 +391,6 @@ class QLiberationMap(QGraphicsView):
|
||||
self.draw_waypoint_info(scene, idx + 1, point, new_pos,
|
||||
flight.flight_plan)
|
||||
prev_pos = tuple(new_pos)
|
||||
self.draw_flight_path(scene, prev_pos, pos, is_player, selected)
|
||||
|
||||
def draw_waypoint(self, scene: QGraphicsScene, position: Tuple[int, int],
|
||||
player: bool, selected: bool) -> None:
|
||||
|
||||
@@ -4,9 +4,9 @@ from PySide2.QtGui import QColor, QPainter
|
||||
from PySide2.QtWidgets import QAction, QMenu
|
||||
|
||||
import qt_ui.uiconstants as const
|
||||
from game.theater import ControlPoint
|
||||
from qt_ui.models import GameModel
|
||||
from qt_ui.windows.basemenu.QBaseMenu2 import QBaseMenu2
|
||||
from theater import ControlPoint
|
||||
from .QMapObject import QMapObject
|
||||
from ...displayoptions import DisplayOptions
|
||||
from ...windows.GameUpdateSignal import GameUpdateSignal
|
||||
|
||||
@@ -8,8 +8,8 @@ import qt_ui.uiconstants as const
|
||||
from game import Game
|
||||
from game.data.building_data import FORTIFICATION_BUILDINGS
|
||||
from game.db import REWARDS
|
||||
from game.theater import ControlPoint, TheaterGroundObject
|
||||
from qt_ui.windows.groundobject.QGroundObjectMenu import QGroundObjectMenu
|
||||
from theater import ControlPoint, TheaterGroundObject
|
||||
from .QMapObject import QMapObject
|
||||
from ...displayoptions import DisplayOptions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user