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