mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Improved base menu to show planned AI flights and base defence. (WIP)
This commit is contained in:
33
qt_ui/widgets/QBaseInformation.py
Normal file
33
qt_ui/widgets/QBaseInformation.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox
|
||||
|
||||
from game import db
|
||||
from theater import ControlPoint, Airport
|
||||
|
||||
|
||||
class QBaseInformation(QGroupBox):
|
||||
|
||||
def __init__(self, cp:ControlPoint, airport:Airport):
|
||||
super(QBaseInformation, self).__init__("Base defenses")
|
||||
self.cp = cp
|
||||
self.airport = airport
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.layout = QGridLayout()
|
||||
|
||||
unit_dict = {}
|
||||
for g in self.cp.ground_objects:
|
||||
if g.airbase_group:
|
||||
for group in g.groups:
|
||||
for u in group.units:
|
||||
if u.type in unit_dict.keys():
|
||||
unit_dict[u.type] = unit_dict[u.type] + 1
|
||||
else:
|
||||
unit_dict[u.type] = 1
|
||||
|
||||
i = 0
|
||||
for k,v in unit_dict.items():
|
||||
self.layout.addWidget(QLabel(str(v) + " x " + k), i, 0)
|
||||
i = i + 1
|
||||
|
||||
self.setLayout(self.layout)
|
||||
27
qt_ui/widgets/QPlannedFlightView.py
Normal file
27
qt_ui/widgets/QPlannedFlightView.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox
|
||||
|
||||
from game import db
|
||||
from gen.flights.ai_flight_planner import FlightPlanner
|
||||
|
||||
|
||||
class QPlannedFlightView(QGroupBox):
|
||||
|
||||
def __init__(self, flight_planner:FlightPlanner):
|
||||
super(QPlannedFlightView, self).__init__("Planned flights")
|
||||
self.flight_planner = flight_planner
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
self.layout = QGridLayout()
|
||||
|
||||
for i,f in enumerate(self.flight_planner.flights):
|
||||
ftype = QLabel("<b>" + f.flight_type.name + "</b>")
|
||||
count = QLabel(str(f.count) + "x" + db.unit_type_name(f.unit_type))
|
||||
sched = QLabel(" in " + str(f.scheduled_in) + " minutes")
|
||||
|
||||
self.layout.addWidget(ftype, i, 0)
|
||||
self.layout.addWidget(count, i, 1)
|
||||
self.layout.addWidget(sched, i, 2)
|
||||
|
||||
|
||||
self.setLayout(self.layout)
|
||||
Reference in New Issue
Block a user