mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Allow manual SAM orientation.
Fixes https://github.com/dcs-liberation/dcs_liberation/issues/2479.
This commit is contained in:
parent
97c4168d13
commit
03671bbfb0
@ -23,6 +23,7 @@ Saves from 6.x are not compatible with 7.0.
|
||||
* **[New Game Wizard]** Squadrons can be directly replaced with a preset during air wing configuration rather than needing to remove and create a new squadron.
|
||||
* **[New Game Wizard]** Squadron liveries can now be selected during air wing configuration.
|
||||
* **[Squadrons]** Squadron-specific mission capability lists no longer restrict players from assigning missions outside the squadron's preferences.
|
||||
* **[UI]** The orientation of objects like SAMs, EWRs, garrisons, and ships can now be manually adjusted.
|
||||
|
||||
## Fixes
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ from PySide6.QtWidgets import (
|
||||
QPushButton,
|
||||
QVBoxLayout,
|
||||
QSpinBox,
|
||||
QWidget,
|
||||
)
|
||||
from dcs import Point
|
||||
|
||||
@ -30,6 +31,18 @@ from qt_ui.windows.groundobject.QBuildingInfo import QBuildingInfo
|
||||
from qt_ui.windows.groundobject.QGroundObjectBuyMenu import QGroundObjectBuyMenu
|
||||
|
||||
|
||||
class HeadingIndicator(QLabel):
|
||||
def __init__(self, initial_heading: Heading, parent: QWidget) -> None:
|
||||
super().__init__(parent)
|
||||
self.set_heading(initial_heading)
|
||||
self.setFixedSize(32, 32)
|
||||
|
||||
def set_heading(self, heading: Heading) -> None:
|
||||
self.setPixmap(
|
||||
ICONS["heading"].transformed(QTransform().rotate(heading.degrees))
|
||||
)
|
||||
|
||||
|
||||
class QGroundObjectMenu(QDialog):
|
||||
def __init__(
|
||||
self,
|
||||
@ -150,24 +163,21 @@ class QGroundObjectMenu(QDialog):
|
||||
self.orientationBox = QGroupBox("Orientation :")
|
||||
self.orientationBoxLayout = QHBoxLayout()
|
||||
|
||||
heading_image = QLabel()
|
||||
heading_image.setPixmap(
|
||||
ICONS["heading"].transformed(
|
||||
QTransform().rotate(self.ground_object.heading.degrees)
|
||||
)
|
||||
)
|
||||
heading_image = HeadingIndicator(self.ground_object.heading, self)
|
||||
self.orientationBoxLayout.addWidget(heading_image)
|
||||
self.headingLabel = QLabel("Heading:")
|
||||
self.orientationBoxLayout.addWidget(self.headingLabel)
|
||||
self.headingSelector = QSpinBox()
|
||||
self.headingSelector.setEnabled(False) # Disable for now
|
||||
self.headingSelector.setMinimum(0)
|
||||
self.headingSelector.setMaximum(360)
|
||||
self.headingSelector.setEnabled(self.cp.is_friendly(to_player=True))
|
||||
self.headingSelector.setRange(0, 359)
|
||||
self.headingSelector.setWrapping(True)
|
||||
self.headingSelector.setSingleStep(5)
|
||||
self.headingSelector.setValue(self.ground_object.heading.degrees)
|
||||
self.headingSelector.valueChanged.connect(
|
||||
lambda degrees: heading_image.set_heading(Heading(degrees))
|
||||
)
|
||||
self.orientationBoxLayout.addWidget(self.headingSelector)
|
||||
if self.cp.captured:
|
||||
# TODO Let the user choose the heading with the SpinBox
|
||||
self.headingSelector.setEnabled(False)
|
||||
self.head_to_conflict_button = QPushButton("Head to conflict")
|
||||
heading = (
|
||||
self.game.theater.heading_to_conflict_from(self.ground_object.position)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user