Base menu layout improved.

This commit is contained in:
Khopa
2019-10-16 22:22:16 +02:00
parent 48748bbc39
commit fee959940a
5 changed files with 157 additions and 64 deletions

View 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)

View File

@@ -1,6 +1,5 @@
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout
from game import db
from theater import ControlPoint, Airport
@@ -30,4 +29,7 @@ class QBaseInformation(QGroupBox):
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)

View File

@@ -1,4 +1,4 @@
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox
from PySide2.QtWidgets import QGridLayout, QLabel, QGroupBox, QVBoxLayout, QHBoxLayout
from game import db
from gen.flights.ai_flight_planner import FlightPlanner
@@ -16,12 +16,14 @@ class QPlannedFlightView(QGroupBox):
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))
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)