def on_attack(self): # TODO: Maintain Convoy list in Game. # The fact that we create these here makes some of the other bookkeeping # complicated. We could instead generate this at the start of the turn (and # update whenever transfers are created or canceled) and also use that time to # precalculate things like the next stop and group names. Dialog.open_new_package_dialog(self.convoy, parent=self.window())
def __init__(self): super(QLiberationWindow, self).__init__() self.game: Optional[Game] = None self.game_model = GameModel() Dialog.set_game(self.game_model) self.ato_panel = QAirTaskingOrderPanel(self.game_model) self.info_panel = QInfoPanel(self.game) self.liberation_map = QLiberationMap(self.game_model) self.setGeometry(300, 100, 270, 100) self.setWindowTitle(f"DCS Liberation - v{VERSION}") self.setWindowIcon(QIcon("./resources/icon.png")) self.statusBar().showMessage('Ready') self.initUi() self.initActions() self.initMenuBar() self.initToolbar() self.connectSignals() screen = QDesktopWidget().screenGeometry() self.setGeometry(0, 0, screen.width(), screen.height()) self.setWindowState(Qt.WindowMaximized) self.onGameGenerated(persistency.restore_game())
def edit_flight(self, index: QModelIndex) -> None: from qt_ui.dialogs import Dialog Dialog.open_edit_flight_dialog( self.package_model, self.package_model.flight_at_index(index), parent=self.window(), )
def __init__(self, game: Optional[Game]) -> None: super(QLiberationWindow, self).__init__() self.game = game self.game_model = GameModel(game) Dialog.set_game(self.game_model) self.ato_panel = QAirTaskingOrderPanel(self.game_model) self.info_panel = QInfoPanel(self.game) self.liberation_map = QLiberationMap(self.game_model, self) self.setGeometry(300, 100, 270, 100) self.updateWindowTitle() self.setWindowIcon(QIcon("./resources/icon.png")) self.statusBar().showMessage("Ready") self.initUi() self.initActions() self.initToolbar() self.initMenuBar() self.connectSignals() screen = QDesktopWidget().screenGeometry() self.setGeometry(0, 0, screen.width(), screen.height()) self.setWindowState(Qt.WindowMaximized) if self.game is None: last_save_file = liberation_install.get_last_save_file() if last_save_file: try: logging.info("Loading last saved game : " + str(last_save_file)) game = persistency.load_game(last_save_file) self.onGameGenerated(game) self.updateWindowTitle(last_save_file if game else None) except: logging.info("Error loading latest save game") else: logging.info("No existing save game") else: self.onGameGenerated(self.game)
def __init__(self, game: Game | None, dev: bool) -> None: super().__init__() self._uncaught_exception_handler = UncaughtExceptionHandler(self) self.game = game self.sim_controller = SimController(self.game) self.sim_controller.sim_update.connect(EventStream.put_nowait) self.game_model = GameModel(game, self.sim_controller) GameContext.set_model(self.game_model) self.new_package_signal.connect( lambda target: Dialog.open_new_package_dialog(target, self)) self.tgo_info_signal.connect(self.open_tgo_info_dialog) self.control_point_info_signal.connect( self.open_control_point_info_dialog) QtContext.set_callbacks( QtCallbacks( lambda target: self.new_package_signal.emit(target), lambda tgo: self.tgo_info_signal.emit(tgo), lambda cp: self.control_point_info_signal.emit(cp), )) Dialog.set_game(self.game_model) self.ato_panel = QAirTaskingOrderPanel(self.game_model) self.info_panel = QInfoPanel(self.game) self.liberation_map = QLiberationMap(self.game_model, dev, self) self.setGeometry(300, 100, 270, 100) self.updateWindowTitle() self.setWindowIcon(QIcon("./resources/icon.png")) self.statusBar().showMessage("Ready") self.initUi() self.initActions() self.initToolbar() self.initMenuBar() self.connectSignals() # Default to maximized on the main display if we don't have any persistent # configuration. screen = QDesktopWidget().screenGeometry() self.setGeometry(0, 0, screen.width(), screen.height()) self.setWindowState(Qt.WindowMaximized) # But override it with the saved configuration if it exists. self._restore_window_geometry() if self.game is None: last_save_file = liberation_install.get_last_save_file() if last_save_file: try: logging.info("Loading last saved game : " + str(last_save_file)) game = persistency.load_game(last_save_file) self.onGameGenerated(game) self.updateWindowTitle(last_save_file if game else None) except: logging.info("Error loading latest save game") else: logging.info("No existing save game") else: self.onGameGenerated(self.game)
def new_package(self) -> None: Dialog.open_new_package_dialog(self.cp, parent=self.window())
def open_new_package_dialog(self) -> None: """Opens the dialog for planning a new mission package.""" Dialog.open_new_package_dialog(self.mission_target)
def onAttack(self): Dialog.open_new_package_dialog(self.ground_object, parent=self.window())
def showPackageDialog(self) -> None: Dialog.open_new_package_dialog(self.front_line)
def showPackageDialog(self) -> None: Dialog.open_new_package_dialog(self.tgo)
def showPackageDialog(self) -> None: Dialog.open_new_package_dialog(self.control_point)
def edit_package(self, index: QModelIndex) -> None: from qt_ui.dialogs import Dialog Dialog.open_edit_package_dialog(self.ato_model.get_package_model(index))