Loading controller/menuController.py +5 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,11 @@ class MenuController: self.level = None self.menu = menu self.game = game self.diaplayMenu() def diaplayMenu(self): self.menu.displayGames() self.menu.menuAction.triggered.connect(self.diaplayMenu) for gameButton in self.menu.gameButtons: if gameButton.game == GameEnum.DYCK_WORD_TO_BINARY_TREE: gameButton.clicked.triggered.connect(self.on_DyckWordToBinaryTree_Button_Released) Loading view/menu.py +20 −16 Original line number Diff line number Diff line Loading @@ -17,6 +17,20 @@ class MyWindow(QMainWindow): #print(self.size()) pass def closeEvent(self, event): msgBox = QMessageBox() msgBox.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint) noButton = QPushButton("Non") noButton.clicked.connect(event.ignore) yesButton = QPushButton("Oui") yesButton.clicked.connect(event.accept) msgBox.setWindowTitle("A bientôt!") msgBox.setText("Es-tu certains de vouloir quitter l'application?") msgBox.addButton(yesButton, QMessageBox.NoRole) msgBox.addButton(noButton, QMessageBox.YesRole) msgBox.setDefaultButton(noButton) msgBox.exec() class Menu: def __init__(self): self.launcher = None Loading @@ -32,6 +46,10 @@ class Menu: self.paramWindow(1200, 600, "Initiation au parcours d'arbre") self.addSubMenus() self.displayGames() self.shortCutAction = QAction() self.shortCutAction.setShortcut("Ctrl+W") self.shortCutAction.triggered.connect(self.window.close) self.window.addAction(self.shortCutAction) def resizeEvent(self, e): pass Loading @@ -52,7 +70,7 @@ class Menu: # we add actions to the submenu self.menuAction = QAction("&Menu", self.window) self.leaveAction = QAction("&Quitter", self.window) self.leaveAction.triggered.connect(self.close) self.leaveAction.triggered.connect(self.window.close) self.helpAction = QAction("&Aide", self.window) self.infoAction = QAction("&A propos", self.window) Loading @@ -61,24 +79,10 @@ class Menu: help.addAction(self.helpAction) info.addAction(self.infoAction) def close(self): msgBox = QMessageBox() msgBox.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint) noButton = QPushButton("Non") yesButton = QPushButton("Oui") yesButton.clicked.connect(self.window.close) msgBox.setWindowTitle("A bientôt!") msgBox.setText("Es-tu certains de vouloir quitter l'application?") msgBox.addButton(yesButton, QMessageBox.NoRole) msgBox.addButton(noButton, QMessageBox.YesRole) msgBox.setDefaultButton(noButton) msgBox.exec() def test(self): print("test") # function to put the central widget in the menu def displayGames(self): self.removeCentralLayout() self.gamesWidget = QWidget() self.gamesLayout = QGridLayout() nbSteps = int(sqrt(nbGames())) Loading Loading
controller/menuController.py +5 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,11 @@ class MenuController: self.level = None self.menu = menu self.game = game self.diaplayMenu() def diaplayMenu(self): self.menu.displayGames() self.menu.menuAction.triggered.connect(self.diaplayMenu) for gameButton in self.menu.gameButtons: if gameButton.game == GameEnum.DYCK_WORD_TO_BINARY_TREE: gameButton.clicked.triggered.connect(self.on_DyckWordToBinaryTree_Button_Released) Loading
view/menu.py +20 −16 Original line number Diff line number Diff line Loading @@ -17,6 +17,20 @@ class MyWindow(QMainWindow): #print(self.size()) pass def closeEvent(self, event): msgBox = QMessageBox() msgBox.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint) noButton = QPushButton("Non") noButton.clicked.connect(event.ignore) yesButton = QPushButton("Oui") yesButton.clicked.connect(event.accept) msgBox.setWindowTitle("A bientôt!") msgBox.setText("Es-tu certains de vouloir quitter l'application?") msgBox.addButton(yesButton, QMessageBox.NoRole) msgBox.addButton(noButton, QMessageBox.YesRole) msgBox.setDefaultButton(noButton) msgBox.exec() class Menu: def __init__(self): self.launcher = None Loading @@ -32,6 +46,10 @@ class Menu: self.paramWindow(1200, 600, "Initiation au parcours d'arbre") self.addSubMenus() self.displayGames() self.shortCutAction = QAction() self.shortCutAction.setShortcut("Ctrl+W") self.shortCutAction.triggered.connect(self.window.close) self.window.addAction(self.shortCutAction) def resizeEvent(self, e): pass Loading @@ -52,7 +70,7 @@ class Menu: # we add actions to the submenu self.menuAction = QAction("&Menu", self.window) self.leaveAction = QAction("&Quitter", self.window) self.leaveAction.triggered.connect(self.close) self.leaveAction.triggered.connect(self.window.close) self.helpAction = QAction("&Aide", self.window) self.infoAction = QAction("&A propos", self.window) Loading @@ -61,24 +79,10 @@ class Menu: help.addAction(self.helpAction) info.addAction(self.infoAction) def close(self): msgBox = QMessageBox() msgBox.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint) noButton = QPushButton("Non") yesButton = QPushButton("Oui") yesButton.clicked.connect(self.window.close) msgBox.setWindowTitle("A bientôt!") msgBox.setText("Es-tu certains de vouloir quitter l'application?") msgBox.addButton(yesButton, QMessageBox.NoRole) msgBox.addButton(noButton, QMessageBox.YesRole) msgBox.setDefaultButton(noButton) msgBox.exec() def test(self): print("test") # function to put the central widget in the menu def displayGames(self): self.removeCentralLayout() self.gamesWidget = QWidget() self.gamesLayout = QGridLayout() nbSteps = int(sqrt(nbGames())) Loading