Пример #1
0
    def closeEvent(self, e):
        """Overridden close event.

        :param e: an instance of type QCloseEvent

        """
        if self._is_new_game:
            if Helpers.raise_question(
                self,
                self.tr("Are you sure you want to quit?")
            ):
                e.accept()
            else:
                e.ignore()
Пример #2
0
    def menuNewGameClick(self):
        """Slot used when the "New Game" menu item is clicked.

        """
        raise_dialog = True
        new_game_dialog = NewGameDialog(self)
        if self._is_new_game:
            if not Helpers.raise_question(
                self,
                self.tr("Are you sure you want to start a new game?")
            ):
                raise_dialog = False
        if raise_dialog:
            self._previous_grid_size = self._grid_size
            new_game_dialog.exec_()