This commit is contained in:
Khopa
2020-08-03 19:43:12 +02:00
parent ccf2cd3425
commit 6f4b7e0f1a
10 changed files with 122 additions and 33 deletions

View File

@@ -21,10 +21,11 @@ from userdata import liberation_install, persistency, liberation_theme
if __name__ == "__main__":
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1" # Potential fix for 4K screens
app = QApplication(sys.argv)
# init the theme and load the stylesheet based on the theme index
liberation_theme.init();
liberation_theme.init()
css = ""
with open("./resources/stylesheets/"+liberation_theme.get_theme_css_file()) as stylesheet:
app.setStyleSheet(stylesheet.read())

View File

@@ -35,8 +35,8 @@ class QBaseMenu2(QDialog):
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.setMinimumSize(300, 200)
self.setMinimumWidth(680)
self.setMaximumWidth(680)
self.setMinimumWidth(800)
self.setMaximumWidth(800)
self.setModal(True)
self.initUi()
@@ -50,7 +50,7 @@ class QBaseMenu2(QDialog):
header = QLabel(self)
header.setGeometry(0, 0, 655, 106)
pixmap = QPixmap("./resources/ui/airbase.png")
pixmap = QPixmap(self.get_base_image())
header.setPixmap(pixmap)
title = QLabel("<b>" + self.cp.name + "</b>")
@@ -75,7 +75,6 @@ class QBaseMenu2(QDialog):
def closeEvent(self, closeEvent:QCloseEvent):
GameUpdateSignal.get_instance().updateGame(self.game)
def get_base_image(self):
if self.cp.cptype == ControlPointType.AIRCRAFT_CARRIER_GROUP:
return "./resources/ui/carrier.png"

View File

@@ -33,10 +33,12 @@ class QMissionPlanning(QDialog):
self.select_airbase = QChooseAirbase(self.game)
self.select_airbase.selected_airbase_changed.connect(self.on_departure_cp_changed)
self.planned_flight_view = QPlannedFlightsView(None)
self.available_aircraft_at_selected_location = {}
if self.captured_cp[0].id in self.game.planners.keys():
self.planner = self.game.planners[self.captured_cp[0].id]
self.planned_flight_view.set_flight_planner(self.planner)
self.selected_cp = self.captured_cp[0]
self.available_aircraft_at_selected_location = self.planner.get_available_aircraft()
self.planned_flight_view.selectionModel().setCurrentIndex(self.planned_flight_view.indexAt(QPoint(1, 1)), QItemSelectionModel.Rows)
self.planned_flight_view.selectionModel().selectionChanged.connect(self.on_flight_selection_change)
@@ -82,8 +84,10 @@ class QMissionPlanning(QDialog):
if len(cps) == 1:
self.selected_cp = cps[0]
self.planner = self.game.planners[cps[0].id]
self.available_aircraft_at_selected_location = self.planner.get_available_aircraft()
self.planned_flight_view.set_flight_planner(self.planner)
else:
self.available_aircraft_at_selected_location = {}
self.planned_flight_view.set_flight_planner(None)
def on_flight_selection_change(self):

View File

@@ -40,7 +40,8 @@ class QFlightCreator(QDialog):
for aircraft_type in self.planner.get_available_aircraft().keys():
print(aircraft_type)
print(aircraft_type.name)
self.select_type_aircraft.addItem(aircraft_type.id, userData=aircraft_type)
if self.available[aircraft_type] > 0:
self.select_type_aircraft.addItem(aircraft_type.id, userData=aircraft_type)
self.select_type_aircraft.setCurrentIndex(0)
self.select_flight_type = QComboBox()
@@ -61,6 +62,11 @@ class QFlightCreator(QDialog):
self.select_count_of_aircraft.setMaximum(4)
self.select_count_of_aircraft.setValue(2)
aircraft_type = self.select_type_aircraft.currentData()
if aircraft_type is not None:
self.select_count_of_aircraft.setValue(min(self.available[aircraft_type], 2))
self.select_count_of_aircraft.setMaximum(min(self.available[aircraft_type], 4))
self.add_button = QPushButton("Add")
self.add_button.clicked.connect(self.create_flight)