Пример #1
0
 def on_debriefing_update(self, debriefing: Debriefing) -> None:
     try:
         logging.info("On Debriefing update")
         logging.debug(debriefing)
         DebriefingFileWrittenSignal.get_instance().sendDebriefing(debriefing)
     except Exception:
         logging.exception("Got an error while sending debriefing")
     self.wait_thread = wait_for_debriefing(
         lambda d: self.on_debriefing_update(d), self.game, self.unit_map
     )
Пример #2
0
    def updateLayout(self, debriefing: Debriefing) -> None:
        updateBox = QGroupBox("Mission status")
        update_layout = QGridLayout()
        updateBox.setLayout(update_layout)
        self.debriefing = debriefing

        self.add_update_row(
            "Aircraft destroyed", len(list(debriefing.air_losses.losses)), update_layout
        )
        self.add_update_row(
            "Front line units destroyed",
            len(list(debriefing.front_line_losses)),
            update_layout,
        )
        self.add_update_row(
            "Convoy units destroyed", len(list(debriefing.convoy_losses)), update_layout
        )
        self.add_update_row(
            "Shipping cargo destroyed",
            len(list(debriefing.cargo_ship_losses)),
            update_layout,
        )
        self.add_update_row(
            "Airlift cargo destroyed",
            sum(len(loss.cargo) for loss in debriefing.airlift_losses),
            update_layout,
        )
        self.add_update_row(
            "Ground units lost at objective areas",
            len(list(debriefing.ground_object_losses)),
            update_layout,
        )
        self.add_update_row(
            "Buildings destroyed", len(list(debriefing.building_losses)), update_layout
        )
        self.add_update_row(
            "Base capture events", len(debriefing.base_captures), update_layout
        )

        # Clear previous content of the window
        for i in reversed(range(self.gridLayout.count())):
            try:
                self.gridLayout.itemAt(i).widget().setParent(None)
            except:
                logging.exception("Failed to clear window")

        # Set new window content
        self.gridLayout.addWidget(updateBox, 0, 0)

        if not debriefing.state_data.mission_ended:
            self.gridLayout.addWidget(QLabel("<b>Mission is being played</b>"), 1, 0)
            self.gridLayout.addWidget(self.actions, 2, 0)
        else:
            self.gridLayout.addWidget(QLabel("<b>Mission is over</b>"), 1, 0)
            self.gridLayout.addWidget(self.actions2, 2, 0)
Пример #3
0
    def updateLayout(self, debriefing: Debriefing) -> None:
        updateBox = QGroupBox("Mission status")
        updateLayout = QGridLayout()
        updateBox.setLayout(updateLayout)
        self.debriefing = debriefing

        updateLayout.addWidget(QLabel("<b>Aircraft destroyed</b>"), 0, 0)
        updateLayout.addWidget(
            QLabel(str(len(list(debriefing.air_losses.losses)))), 0, 1)

        updateLayout.addWidget(QLabel("<b>Front line units destroyed</b>"), 1,
                               0)
        updateLayout.addWidget(
            QLabel(str(len(list(debriefing.front_line_losses)))), 1, 1)

        updateLayout.addWidget(QLabel("<b>Other ground units destroyed</b>"),
                               2, 0)
        updateLayout.addWidget(
            QLabel(str(len(list(debriefing.ground_object_losses)))), 2, 1)

        updateLayout.addWidget(QLabel("<b>Buildings destroyed</b>"), 3, 0)
        updateLayout.addWidget(
            QLabel(str(len(list(debriefing.building_losses)))), 3, 1)

        updateLayout.addWidget(QLabel("<b>Base Capture Events</b>"), 4, 0)
        updateLayout.addWidget(
            QLabel(str(len(debriefing.base_capture_events))), 4, 1)

        # Clear previous content of the window
        for i in reversed(range(self.gridLayout.count())):
            try:
                self.gridLayout.itemAt(i).widget().setParent(None)
            except:
                logging.exception("Failed to clear window")

        # Set new window content
        self.gridLayout.addWidget(updateBox, 0, 0)

        if not debriefing.state_data.mission_ended:
            self.gridLayout.addWidget(QLabel("<b>Mission is being played</b>"),
                                      1, 0)
            self.gridLayout.addWidget(self.actions, 2, 0)
        else:
            self.gridLayout.addWidget(QLabel("<b>Mission is over</b>"), 1, 0)
            self.gridLayout.addWidget(self.actions2, 2, 0)