mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Base menu layout improved.
This commit is contained in:
52
qt_ui/widgets/base/QAirportInformation.py
Normal file
52
qt_ui/widgets/base/QAirportInformation.py
Normal file
@@ -0,0 +1,52 @@
|
||||
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)
|
||||
|
||||
|
||||
35
qt_ui/widgets/base/QBaseInformation.py
Normal file
35
qt_ui/widgets/base/QBaseInformation.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout
|
||||
|
||||
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
|
||||
|
||||
stretch = QVBoxLayout()
|
||||
stretch.addStretch()
|
||||
self.layout.addLayout(stretch, len(unit_dict) + 1, 0)
|
||||
self.setLayout(self.layout)
|
||||
29
qt_ui/widgets/base/QPlannedFlightView.py
Normal file
29
qt_ui/widgets/base/QPlannedFlightView.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout, QHBoxLayout
|
||||
|
||||
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)
|
||||
|
||||
stretch = QVBoxLayout()
|
||||
stretch.addStretch()
|
||||
self.layout.addLayout(stretch, len(self.flight_planner.flights)+1, 0)
|
||||
self.setLayout(self.layout)
|
||||
Reference in New Issue
Block a user