def init_ui(self): self.mainLayout = QVBoxLayout() self.budget = QBudgetBox(self.game) self.budget.setGame(self.game) self.doLayout() if isinstance(self.ground_object, BuildingGroundObject): self.mainLayout.addWidget(self.buildingBox) if self.cp.captured: self.mainLayout.addWidget(self.financesBox) else: self.mainLayout.addWidget(self.intelBox) self.actionLayout = QHBoxLayout() self.sell_all_button = QPushButton("Disband (+" + str(self.total_value) + "M)") self.sell_all_button.clicked.connect(self.sell_all) self.sell_all_button.setProperty("style", "btn-danger") self.buy_replace = QPushButton("Buy/Replace") self.buy_replace.clicked.connect(self.buy_group) self.buy_replace.setProperty("style", "btn-success") if self.ground_object.purchasable: if self.total_value > 0: self.actionLayout.addWidget(self.sell_all_button) self.actionLayout.addWidget(self.buy_replace) if self.cp.captured and self.ground_object.purchasable: self.mainLayout.addLayout(self.actionLayout) self.setLayout(self.mainLayout)
def init_ui(self): self.turnCounter = QTurnCounter() self.budgetBox = QBudgetBox(self.game) self.passTurnButton = QPushButton("Pass Turn") self.passTurnButton.setIcon(CONST.ICONS["PassTurn"]) self.passTurnButton.setProperty("style", "btn-primary") self.passTurnButton.clicked.connect(self.passTurn) self.proceedButton = QPushButton("Take off") self.proceedButton.setIcon(CONST.ICONS["Proceed"]) self.proceedButton.setProperty("style", "start-button") self.proceedButton.clicked.connect(self.launch_mission) if self.game and self.game.turn == 0: self.proceedButton.setEnabled(False) self.factionsInfos = QFactionsInfos(self.game) self.settings = QPushButton("Settings") self.settings.setIcon(CONST.ICONS["Settings"]) self.settings.setProperty("style", "btn-primary") self.settings.clicked.connect(self.openSettings) self.statistics = QPushButton("Statistics") self.statistics.setIcon(CONST.ICONS["Statistics"]) self.statistics.setProperty("style", "btn-primary") self.statistics.clicked.connect(self.openStatisticsWindow) self.buttonBox = QGroupBox("Misc") self.buttonBoxLayout = QHBoxLayout() self.buttonBoxLayout.addWidget(self.settings) self.buttonBoxLayout.addWidget(self.statistics) self.buttonBox.setLayout(self.buttonBoxLayout) self.proceedBox = QGroupBox("Proceed") self.proceedBoxLayout = QHBoxLayout() self.proceedBoxLayout.addLayout( MaxPlayerCount(self.game_model.ato_model)) self.proceedBoxLayout.addWidget(self.passTurnButton) self.proceedBoxLayout.addWidget(self.proceedButton) self.proceedBox.setLayout(self.proceedBoxLayout) self.layout = QHBoxLayout() self.layout.addWidget(self.factionsInfos) self.layout.addWidget(self.turnCounter) self.layout.addWidget(self.budgetBox) self.layout.addWidget(self.buttonBox) self.layout.addStretch(1) self.layout.addWidget(self.proceedBox) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout)
def init_ui(self): self.mainLayout = QVBoxLayout() self.budget = QBudgetBox(self.game) self.budget.setGame(self.game) self.doLayout() if self.ground_object.dcs_identifier == "AA": self.mainLayout.addWidget(self.intelBox) else: self.mainLayout.addWidget(self.buildingBox) self.setLayout(self.mainLayout)
def init_ui(self): self.conditionsWidget = QConditionsWidget() self.budgetBox = QBudgetBox(self.game) pass_turn_text = "Pass Turn" if not self.game or self.game.turn == 0: pass_turn_text = "Begin Campaign" self.passTurnButton = QPushButton(pass_turn_text) self.passTurnButton.setIcon(CONST.ICONS["PassTurn"]) self.passTurnButton.setProperty("style", "btn-primary") self.passTurnButton.clicked.connect(self.passTurn) if not self.game: self.passTurnButton.setEnabled(False) self.proceedButton = QPushButton("Take off") self.proceedButton.setIcon(CONST.ICONS["Proceed"]) self.proceedButton.setProperty("style", "start-button") self.proceedButton.clicked.connect(self.launch_mission) if not self.game or self.game.turn == 0: self.proceedButton.setEnabled(False) self.factionsInfos = QFactionsInfos(self.game) self.air_wing = QPushButton("Air Wing") self.air_wing.setDisabled(True) self.air_wing.setProperty("style", "btn-primary") self.air_wing.clicked.connect(self.open_air_wing) self.transfers = QPushButton("Transfers") self.transfers.setDisabled(True) self.transfers.setProperty("style", "btn-primary") self.transfers.clicked.connect(self.open_transfers) self.intel_box = QIntelBox(self.game) self.buttonBox = QGroupBox("Misc") self.buttonBoxLayout = QHBoxLayout() self.buttonBoxLayout.addWidget(self.air_wing) self.buttonBoxLayout.addWidget(self.transfers) self.buttonBox.setLayout(self.buttonBoxLayout) self.proceedBox = QGroupBox("Proceed") self.proceedBoxLayout = QHBoxLayout() self.proceedBoxLayout.addLayout(MaxPlayerCount(self.game_model.ato_model)) self.proceedBoxLayout.addWidget(self.passTurnButton) self.proceedBoxLayout.addWidget(self.proceedButton) self.proceedBox.setLayout(self.proceedBoxLayout) self.layout = QHBoxLayout() self.layout.addWidget(self.factionsInfos) self.layout.addWidget(self.conditionsWidget) self.layout.addWidget(self.budgetBox) self.layout.addWidget(self.intel_box) self.layout.addWidget(self.buttonBox) self.layout.addStretch(1) self.layout.addWidget(self.proceedBox) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout)
def __init__(self, game_model: GameModel, sim_controller: SimController) -> None: super(QTopPanel, self).__init__() self.game_model = game_model self.sim_controller = sim_controller self.dialog: Optional[QDialog] = None self.setMaximumHeight(70) self.conditionsWidget = QConditionsWidget(sim_controller) self.budgetBox = QBudgetBox(self.game) pass_turn_text = "Pass Turn" if not self.game or self.game.turn == 0: pass_turn_text = "Begin Campaign" self.passTurnButton = QPushButton(pass_turn_text) self.passTurnButton.setIcon(CONST.ICONS["PassTurn"]) self.passTurnButton.setProperty("style", "btn-primary") self.passTurnButton.clicked.connect(self.passTurn) if not self.game: self.passTurnButton.setEnabled(False) self.proceedButton = QPushButton("Take off") self.proceedButton.setIcon(CONST.ICONS["Proceed"]) self.proceedButton.setProperty("style", "start-button") self.proceedButton.clicked.connect(self.launch_mission) if not self.game or self.game.turn == 0: self.proceedButton.setEnabled(False) self.factionsInfos = QFactionsInfos(self.game) self.air_wing = QPushButton("Air Wing") self.air_wing.setDisabled(True) self.air_wing.setProperty("style", "btn-primary") self.air_wing.clicked.connect(self.open_air_wing) self.transfers = QPushButton("Transfers") self.transfers.setDisabled(True) self.transfers.setProperty("style", "btn-primary") self.transfers.clicked.connect(self.open_transfers) self.intel_box = QIntelBox(self.game) self.buttonBox = QGroupBox("Misc") self.buttonBoxLayout = QHBoxLayout() self.buttonBoxLayout.addWidget(self.air_wing) self.buttonBoxLayout.addWidget(self.transfers) self.buttonBox.setLayout(self.buttonBoxLayout) self.proceedBox = QGroupBox("Proceed") self.proceedBoxLayout = QHBoxLayout() self.proceedBoxLayout.addLayout(SimSpeedControls(sim_controller)) self.proceedBoxLayout.addLayout( MaxPlayerCount(self.game_model.ato_model)) self.proceedBoxLayout.addWidget(self.passTurnButton) self.proceedBoxLayout.addWidget(self.proceedButton) self.proceedBox.setLayout(self.proceedBoxLayout) self.layout = QHBoxLayout() self.layout.addWidget(self.factionsInfos) self.layout.addWidget(self.conditionsWidget) self.layout.addWidget(self.budgetBox) self.layout.addWidget(self.intel_box) self.layout.addWidget(self.buttonBox) self.layout.addStretch(1) self.layout.addWidget(self.proceedBox) self.layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.layout) GameUpdateSignal.get_instance().gameupdated.connect(self.setGame) GameUpdateSignal.get_instance().budgetupdated.connect( self.budget_update)