Commit b1b06e56 authored by Aurélien's avatar Aurélien
Browse files

amelioration du design du menu

parent fabb4b0f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ from PyQt5.QtWidgets import *

from view.levelGui import LevelGui
from view.treeView import TreeView
from PyQt5.QtCore import Qt


class DyckWordToBinaryTreeGui(LevelGui):
+29 −28
Original line number Diff line number Diff line
@@ -112,8 +112,8 @@ class MenuView(QGraphicsView):
        endY = self.c1y + 0.5 * self.circleSize + (cos(pi / 5) * 0.5 * self.circleSize)
        xLength = beginX - endX
        yLength = beginY - endY
        p1x = beginX - 1.2 * xLength
        p1y = beginY - 0.25 * yLength
        p1x = beginX - 0.6 * xLength
        p1y = beginY - 0.1 * yLength
        p2x = beginX - 1 * xLength
        p2y = beginY - 0.45 * yLength
        self.drawArrow(beginX, beginY, endX, endY, p1x, p1y, p2x, p2y, GameEnum.DYCK_WORD_TO_BINARY_TREE)
@@ -123,20 +123,20 @@ class MenuView(QGraphicsView):
        endY = self.c2y + 0.5 * self.circleSize - (cos(pi / 7) * 0.5 * self.circleSize)
        xLength = beginX - endX
        yLength = endY - beginY
        p1x = beginX + 0.2 * xLength
        p1x = beginX + 0.35 * xLength
        p1y = beginY + 0.15 * yLength
        p2x = beginX + 0.1 * xLength
        p2x = beginX + 0.25 * xLength
        p2y = beginY + 0.25 * yLength
        self.drawArrow(beginX, beginY, endX, endY, p1x, p1y, p2x, p2y, GameEnum.BINARY_TREE_TO_PLANAR_TREE)
        beginX = self.c2x + 0.5 * self.circleSize + (cos(pi / 7) * 0.5 * self.circleSize)
        beginY = self.c2y + 0.5 * self.circleSize - (sin(pi / 7) * 0.5 * self.circleSize)
        endX = self.c3x + 0.5 * self.circleSize - (cos(pi / 7) * 0.5 * self.circleSize)
        endY = self.c3y + 0.5 * self.circleSize - (sin(pi / 7) * 0.5 * self.circleSize)
        beginX = self.c2x + self.circleSize
        beginY = self.c2y + 0.5 * self.circleSize
        endX = self.c3x
        endY = self.c3y + 0.5 * self.circleSize
        xLength = endX - beginX
        p1x = beginX + 0.2 * xLength
        p1y = beginY - 0.1 * self.circleSize
        p2x = beginX + 0.6 * xLength
        p2y = beginY - 0.1 * self.circleSize
        p1y = beginY - 0.07 * self.circleSize
        p2x = beginX + 0.5 * xLength
        p2y = beginY - 0.07 * self.circleSize
        self.drawArrow(beginX, beginY, endX, endY, p1x, p1y, p2x, p2y, GameEnum.PLANAR_TREE_TO_DYCK_WORD)

        self.scene().addItem(self.itemsGroup)
@@ -165,11 +165,11 @@ class MenuView(QGraphicsView):
        self.itemsGroup.addToGroup(circle1)
        self.itemsGroup.addToGroup(circle2)
        self.itemsGroup.addToGroup(circle3)
        self.itemsGroup.addToGroup(circle4)
        """self.itemsGroup.addToGroup(circle4)
        self.itemsGroup.addToGroup(circle5)
        self.itemsGroup.addToGroup(x1)
        self.itemsGroup.addToGroup(x2)
        self.itemsGroup.addToGroup(x3)
        self.itemsGroup.addToGroup(x3)"""

    def drawDyckWord(self):
        word = get_model_tree().dyckWord
@@ -180,8 +180,8 @@ class MenuView(QGraphicsView):
                newWord += " "
        dyckWord = QGraphicsTextItem(newWord)
        dyckWord.setTextWidth(self.circleSize)
        dyckWord.setX(self.c3x + 0.15 * self.circleSize)
        dyckWord.setY(self.c3y + 0.4 * self.circleSize)
        dyckWord.setX(self.c3x + 0.06 * self.circleSize)
        dyckWord.setY(self.c3y + 0.37 * self.circleSize)
        """dyckWord.setX(0.75 * self.w - 0.95 * self.circleSize)
        dyckWord.setY(0.33 * self.h)"""
        size = int(self.circleSize / 8)
@@ -438,14 +438,14 @@ class Arrow(QGraphicsItemGroup):
            line = QGraphicsPathItem()
            line.setPen(pen)
            path = QPainterPath()
            path.moveTo(beginX - offset, beginY)
            path.cubicTo(p1x - offset, p1y - offset, p2x - offset, p2y - offset, endLineX - offset, endLineY)
            path.moveTo(beginX - 1.5 * offset, beginY + offset)
            path.cubicTo(p1x - 2 * offset, p1y - offset, p2x - offset, p2y - offset, endLineX - offset, endLineY)
            line.setPath(path)

            line2 = QGraphicsPathItem()
            line2.setPen(pen)
            path = QPainterPath()
            path.moveTo(beginX + offset, beginY)
            path.moveTo(beginX, beginY)
            path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX + offset, endLineY)
            line2.setPath(path)

@@ -461,14 +461,14 @@ class Arrow(QGraphicsItemGroup):
            line6 = QGraphicsLineItem(endLineX + 2 * offset, endLineY, endX, endY)
            line6.setPen(pen)
        elif game == GameEnum.BINARY_TREE_TO_PLANAR_TREE:
            endLineX = endX + 0.05 * circleSize
            endLineX = endX + 0.07 * circleSize
            endLineY = endY - 0.1 * circleSize

            line = QGraphicsPathItem()
            line.setPen(pen)
            path = QPainterPath()
            path.moveTo(beginX - offset, beginY - offset)
            path.cubicTo(p1x - offset, p1y - offset, p2x - offset, p2y - offset, endLineX - offset, endLineY)
            path.cubicTo(p1x - offset, p1y - offset, p2x, p2y - offset, endLineX - 0.3 * offset, endLineY)
            line.setPath(path)

            line2 = QGraphicsPathItem()
@@ -478,44 +478,45 @@ class Arrow(QGraphicsItemGroup):
            path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX + 1.5 * offset, endLineY + offset)
            line2.setPath(path)

            line3 = QGraphicsLineItem(endLineX - offset, endLineY, endLineX - 2 * offset, endLineY)
            line3 = QGraphicsLineItem(endLineX - 0.3 * offset, endLineY, endLineX - 1.3 * offset, endLineY)
            line3.setPen(pen)

            line4 = QGraphicsLineItem(endLineX + 2 * offset, endLineY + offset, endLineX + 2.5 * offset, endLineY + offset)
            line4.setPen(pen)

            line5 = QGraphicsLineItem(endLineX - 2 * offset, endLineY, endX, endY)
            line5 = QGraphicsLineItem(endLineX - 1.3 * offset, endLineY, endX, endY)
            line5.setPen(pen)

            line6 = QGraphicsLineItem(endLineX + 2.5 * offset, endLineY + offset, endX, endY)
            line6.setPen(pen)
        else:
            endLineX = endX - 0.1 * circleSize
            endLineY = endY - 0.03 * circleSize

            line = QGraphicsPathItem()
            line.setPen(pen)
            path = QPainterPath()
            path.moveTo(beginX, beginY - offset)
            path.cubicTo(p1x - offset, p1y - offset, p2x + offset, p2y - offset, endLineX, endY - offset)
            path.cubicTo(p1x - offset, p1y - offset, p2x + offset, p2y - offset, endLineX, endLineY - offset)
            line.setPath(path)

            line2 = QGraphicsPathItem()
            line2.setPen(pen)
            path = QPainterPath()
            path.moveTo(beginX, beginY + offset)
            path.cubicTo(p1x - offset, p1y + offset, p2x - offset, p2y + offset, endLineX, endY + offset)
            path.cubicTo(p1x - offset, p1y + offset, p2x - offset, p2y + offset, endLineX, endLineY + offset)
            line2.setPath(path)

            line3 = QGraphicsLineItem(endLineX, endY - offset, endLineX, endY - 2 * offset)
            line3 = QGraphicsLineItem(endLineX, endLineY - offset, endLineX, endLineY - 2 * offset)
            line3.setPen(pen)

            line4 = QGraphicsLineItem(endLineX, endY + offset, endLineX, endY + 2 * offset)
            line4 = QGraphicsLineItem(endLineX, endLineY + offset, endLineX, endLineY + 2 * offset)
            line4.setPen(pen)

            line5 = QGraphicsLineItem(endLineX, endY - 2 * offset, endX, endY)
            line5 = QGraphicsLineItem(endLineX, endLineY - 2 * offset, endX, endY)
            line5.setPen(pen)

            line6 = QGraphicsLineItem(endLineX, endY + 2 * offset, endX, endY)
            line6 = QGraphicsLineItem(endLineX, endLineY + 2 * offset, endX, endY)
            line6.setPen(pen)

        self.addToGroup(line)