Loading binaryTreeToDyckWordView.py→binaryTreeToDyckWordGui.py +2 −2 Changes for binaryTreeToDyckWordGui.py: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ class BinaryTreeToDyckWordGui(QWidget): self.layout = QHBoxLayout() self.layout.addWidget(self.dyckWordGroupBox, 33) self.layout.addWidget(self.treeView, 66) self.layout.addWidget(self.dyckWordGroupBox, 33) self.setLayout(self.layout) Loading Loading @@ -140,5 +140,5 @@ class BinaryTreeToDyckWordGui(QWidget): def createTreeView(self): self.treeScene = QGraphicsScene() self.treeView = TreeView(self.treeScene, tree=self.level.getTree()) self.treeView = TreeView(self.treeScene, levelGui=self) self.treeView.createTree() dyckWordToBinaryTreeView.py→dyckWordToBinaryTreeGui.py +2 −3 Changes for dyckWordToBinaryTreeGui.py: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ class DyckWordToBinaryTreeGui(QWidget): self.dyckWordLayout = QHBoxLayout() self.globalDyckWordLayout.addLayout(self.dyckWordLayout, 1) self.dyckWordGroupBox.setLayout(self.globalDyckWordLayout) self.dyckWordLayout.addStretch(1) word = self.level.dyckWord newWord = "" for i in range(len(word)): Loading @@ -42,7 +41,9 @@ class DyckWordToBinaryTreeGui(QWidget): newWord += " " label = QLabel(newWord) label.setFont(QFont("Arial", 25)) self.dyckWordLayout.addStretch(1) self.dyckWordLayout.addWidget(label) self.dyckWordLayout.addStretch(1) def finish(self): Loading @@ -53,8 +54,6 @@ class DyckWordToBinaryTreeGui(QWidget): self.msgBox.setDefaultButton(self.okButton) self.msgBox.exec_() """else: self.resultLabel.setText("Essaie encore")""" def createTreeView(self): Loading gui.py +8 −7 Changes for gui.py: 8 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -3,10 +3,10 @@ import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt from binaryTreeToDyckWordView import BinaryTreeToDyckWordGui from binaryTreeToDyckWordGui import BinaryTreeToDyckWordGui from binarytreetodyckword import BinaryTreeToDyckWord from dyckWordToBinaryTree import DyckWordToBinaryTree from dyckWordToBinaryTreeView import DyckWordToBinaryTreeGui from dyckWordToBinaryTreeGui import DyckWordToBinaryTreeGui class MyWindow(QMainWindow): Loading Loading @@ -86,7 +86,7 @@ class Application(): self.centralLayout.removeWidget(self.button) self.button.deleteLater() self.button = None self.level = DyckWordToBinaryTree(1) self.level = BinaryTreeToDyckWord(1) self.play() def nextLevel(self): Loading @@ -97,14 +97,15 @@ class Application(): self.play() def sameLevel(self): """self.centralLayout.removeWidget(self.levelGui) self.centralLayout.removeWidget(self.levelGui) self.levelGui.deleteLater() self.levelGui = None self.play()""" self.levelGui.treeView.createTree() self.level = DyckWordToBinaryTree(self.level.level) self.play() def play(self): self.levelGui = DyckWordToBinaryTreeGui(self.level) self.levelGui = BinaryTreeToDyckWordGui(self.level) print("réponse: " + self.level.dyckWord) self.levelGui.okButton.clicked.connect(self.nextLevel) self.levelGui.cancelButton.clicked.connect(self.sameLevel) Loading node.py +10 −4 Changes for node.py: 10 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -190,10 +190,16 @@ class BinaryNode: def addNode(self, index: int, nodeType: str): """ this method :param nodeType: :param index: :return: this method which permets to add a node child to the node is will add the node of type 'nodeType' at the position 'index' the index is the number of the EmptyNode that we will replace in the node by a new node of type Leaf or BinaryNode the EmptyNode are numbered in the ascending order that they are encountered in the prefix path of the node :param nodeType: a string which indicates if we will add a node or a leaf :param index: the number of the EmptyNode that we will replace in the node by a new node of type Leaf or BinaryNode the EmptyNode are numbered in the ascending order that they are encountered in the prefix path of the node :return: the new index (when we meet an EmptyNode, we decrements the index) """ if index == 0 and isinstance(self, EmptyNode): if nodeType == "node": Loading Loading
binaryTreeToDyckWordView.py→binaryTreeToDyckWordGui.py +2 −2 Changes for binaryTreeToDyckWordGui.py: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ class BinaryTreeToDyckWordGui(QWidget): self.layout = QHBoxLayout() self.layout.addWidget(self.dyckWordGroupBox, 33) self.layout.addWidget(self.treeView, 66) self.layout.addWidget(self.dyckWordGroupBox, 33) self.setLayout(self.layout) Loading Loading @@ -140,5 +140,5 @@ class BinaryTreeToDyckWordGui(QWidget): def createTreeView(self): self.treeScene = QGraphicsScene() self.treeView = TreeView(self.treeScene, tree=self.level.getTree()) self.treeView = TreeView(self.treeScene, levelGui=self) self.treeView.createTree()
dyckWordToBinaryTreeView.py→dyckWordToBinaryTreeGui.py +2 −3 Changes for dyckWordToBinaryTreeGui.py: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ class DyckWordToBinaryTreeGui(QWidget): self.dyckWordLayout = QHBoxLayout() self.globalDyckWordLayout.addLayout(self.dyckWordLayout, 1) self.dyckWordGroupBox.setLayout(self.globalDyckWordLayout) self.dyckWordLayout.addStretch(1) word = self.level.dyckWord newWord = "" for i in range(len(word)): Loading @@ -42,7 +41,9 @@ class DyckWordToBinaryTreeGui(QWidget): newWord += " " label = QLabel(newWord) label.setFont(QFont("Arial", 25)) self.dyckWordLayout.addStretch(1) self.dyckWordLayout.addWidget(label) self.dyckWordLayout.addStretch(1) def finish(self): Loading @@ -53,8 +54,6 @@ class DyckWordToBinaryTreeGui(QWidget): self.msgBox.setDefaultButton(self.okButton) self.msgBox.exec_() """else: self.resultLabel.setText("Essaie encore")""" def createTreeView(self): Loading
gui.py +8 −7 Changes for gui.py: 8 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -3,10 +3,10 @@ import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt from binaryTreeToDyckWordView import BinaryTreeToDyckWordGui from binaryTreeToDyckWordGui import BinaryTreeToDyckWordGui from binarytreetodyckword import BinaryTreeToDyckWord from dyckWordToBinaryTree import DyckWordToBinaryTree from dyckWordToBinaryTreeView import DyckWordToBinaryTreeGui from dyckWordToBinaryTreeGui import DyckWordToBinaryTreeGui class MyWindow(QMainWindow): Loading Loading @@ -86,7 +86,7 @@ class Application(): self.centralLayout.removeWidget(self.button) self.button.deleteLater() self.button = None self.level = DyckWordToBinaryTree(1) self.level = BinaryTreeToDyckWord(1) self.play() def nextLevel(self): Loading @@ -97,14 +97,15 @@ class Application(): self.play() def sameLevel(self): """self.centralLayout.removeWidget(self.levelGui) self.centralLayout.removeWidget(self.levelGui) self.levelGui.deleteLater() self.levelGui = None self.play()""" self.levelGui.treeView.createTree() self.level = DyckWordToBinaryTree(self.level.level) self.play() def play(self): self.levelGui = DyckWordToBinaryTreeGui(self.level) self.levelGui = BinaryTreeToDyckWordGui(self.level) print("réponse: " + self.level.dyckWord) self.levelGui.okButton.clicked.connect(self.nextLevel) self.levelGui.cancelButton.clicked.connect(self.sameLevel) Loading
node.py +10 −4 Changes for node.py: 10 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -190,10 +190,16 @@ class BinaryNode: def addNode(self, index: int, nodeType: str): """ this method :param nodeType: :param index: :return: this method which permets to add a node child to the node is will add the node of type 'nodeType' at the position 'index' the index is the number of the EmptyNode that we will replace in the node by a new node of type Leaf or BinaryNode the EmptyNode are numbered in the ascending order that they are encountered in the prefix path of the node :param nodeType: a string which indicates if we will add a node or a leaf :param index: the number of the EmptyNode that we will replace in the node by a new node of type Leaf or BinaryNode the EmptyNode are numbered in the ascending order that they are encountered in the prefix path of the node :return: the new index (when we meet an EmptyNode, we decrements the index) """ if index == 0 and isinstance(self, EmptyNode): if nodeType == "node": Loading