mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Add button to rename pilots in air wing
This commit is contained in:
parent
192741af36
commit
ee1fc53dd3
@ -5,6 +5,7 @@
|
|||||||
* **[Mission Generation]** Add option to switch ATFLIR to LITENING automatically for ground based F-18C flights
|
* **[Mission Generation]** Add option to switch ATFLIR to LITENING automatically for ground based F-18C flights
|
||||||
* **[Cheat Menu]** Option to instantly transfer squadrons across bases.
|
* **[Cheat Menu]** Option to instantly transfer squadrons across bases.
|
||||||
* **[UI]** Add selectable units in faction overview during campaign generation.
|
* **[UI]** Add selectable units in faction overview during campaign generation.
|
||||||
|
* **[UI]** Add button to rename pilots in Air Wing's Squadron dialog.
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
* **[UI]** Removed deprecated options
|
* **[UI]** Removed deprecated options
|
||||||
|
|||||||
@ -12,6 +12,8 @@ from PySide2.QtWidgets import (
|
|||||||
QListView,
|
QListView,
|
||||||
QPushButton,
|
QPushButton,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
|
QInputDialog,
|
||||||
|
QLineEdit,
|
||||||
)
|
)
|
||||||
|
|
||||||
from game.ato.flightplans.custom import CustomFlightPlan
|
from game.ato.flightplans.custom import CustomFlightPlan
|
||||||
@ -178,6 +180,11 @@ class SquadronDialog(QDialog):
|
|||||||
button_panel.addStretch()
|
button_panel.addStretch()
|
||||||
layout.addLayout(button_panel)
|
layout.addLayout(button_panel)
|
||||||
|
|
||||||
|
self.rename_button = QPushButton("Rename pilot")
|
||||||
|
self.rename_button.setProperty("style", "start-button")
|
||||||
|
self.rename_button.clicked.connect(self.rename_pilot)
|
||||||
|
button_panel.addWidget(self.rename_button, alignment=Qt.AlignRight)
|
||||||
|
|
||||||
self.toggle_ai_button = QPushButton()
|
self.toggle_ai_button = QPushButton()
|
||||||
self.reset_ai_toggle_state(self.pilot_list.currentIndex())
|
self.reset_ai_toggle_state(self.pilot_list.currentIndex())
|
||||||
self.toggle_ai_button.setProperty("style", "start-button")
|
self.toggle_ai_button.setProperty("style", "start-button")
|
||||||
@ -231,6 +238,18 @@ class SquadronDialog(QDialog):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def rename_pilot(self) -> None:
|
||||||
|
index = self.pilot_list.currentIndex()
|
||||||
|
if not index.isValid():
|
||||||
|
logging.error("Cannot toggle player/AI: no pilot is selected")
|
||||||
|
return
|
||||||
|
p = self.squadron_model.pilot_at_index(index)
|
||||||
|
text, ok = QInputDialog.getText(
|
||||||
|
self, "Rename pilot", "New name: ", QLineEdit.EchoMode.Normal
|
||||||
|
)
|
||||||
|
if ok:
|
||||||
|
p.name = text
|
||||||
|
|
||||||
def toggle_ai(self) -> None:
|
def toggle_ai(self) -> None:
|
||||||
index = self.pilot_list.currentIndex()
|
index = self.pilot_list.currentIndex()
|
||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user