Loading view/menuWidget.py +69 −63 Changes for view/menuWidget.py: 69 added lines, 63 removed lines. Original line number Diff line number Diff line from math import sqrt, cos, pi, sin from PyQt5.QtGui import QFont, QPen, QColor, QPainterPath, QLinearGradient from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt, QPointF from PyQt5.QtCore import Qt from model.GameEnum import GameEnum from model.node import Leaf, BinaryNode Loading Loading @@ -74,20 +74,17 @@ class MenuView(QGraphicsView): self.drawBinaryTree() self.drawPlanarTree() self.drawDyckWord() beginX = self.c2x + 0.5 * self.circleSize - 0.5 * self.circleSize * sin(pi / 8) beginY = self.c2y + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 8) endX = self.c1x + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 8) endY = self.c1y + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 8) beginX = self.c2x + 0.5 * self.circleSize - 0.5 * self.circleSize * sin(pi / 11) beginY = self.c2y + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 11) endX = self.c1x + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 11) endY = self.c1y + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 11) xLength = endX - beginX yLength = beginY - endY p1x = beginX + 0.1 * xLength p1y = beginY - 0.8 * yLength p2x = beginX + 0.6 * xLength p2y = beginY - 0.95 * yLength p1x = beginX + 0.05 * xLength p1y = beginY - 0.5 * yLength p2x = beginX + 0.35 * xLength p2y = beginY - 0.8 * yLength self.drawArrow(beginX, beginY, endX, endY, p1x, p1y, p2x, p2y, GameEnum.PLANAR_TREE_TO_BINARY_TREE) beginX = self.c1x + 0.5 * self.circleSize + 0.5 * self.circleSize * cos(pi / 11) beginY = self.c1y + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 11) endX = self.c3x + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 11) Loading @@ -109,25 +106,30 @@ class MenuView(QGraphicsView): p2x = beginX - 0.6 * xLength p2y = beginY + 0.1 * self.circleSize self.drawArrow(beginX, beginY, endX, endY, p1x, p1y, p2x, p2y, GameEnum.DYCK_WORD_TO_PLANAR_TREE) beginX = self.c3x + 0.5 * self.circleSize - (sin(pi / 8) * 0.5 * self.circleSize) beginY = self.c3y + 0.5 * self.circleSize - (cos(pi / 8) * 0.5 * self.circleSize) endX = self.c1x + 0.5 * self.circleSize + (sin(pi / 8) * 0.5 * self.circleSize) endY = self.c1y + 0.5 * self.circleSize + (cos(pi / 8) * 0.5 * self.circleSize) beginX = self.c3x + 0.5 * self.circleSize - (sin(pi / 7) * 0.5 * self.circleSize) beginY = self.c3y + 0.5 * self.circleSize - (cos(pi / 7) * 0.5 * self.circleSize) endX = self.c1x + 0.5 * self.circleSize + (sin(pi / 5) * 0.5 * self.circleSize) endY = self.c1y + 0.5 * self.circleSize + (cos(pi / 5) * 0.5 * self.circleSize) xLength = beginX - endX p1x = beginX - 0.2 * xLength p1y = beginY + 0.1 * self.circleSize p2x = beginX - 0.6 * xLength p2y = beginY + 0.1 * self.circleSize yLength = beginY - endY p1x = beginX - 1.2 * xLength p1y = beginY - 0.25 * 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) beginX = self.c1x + 0.5 * self.circleSize - (sin(pi / 8) * 0.5 * self.circleSize) beginY = self.c1y + 0.5 * self.circleSize + (cos(pi / 8) * 0.5 * self.circleSize) endX = self.c2x + 0.5 * self.circleSize + (sin(pi / 8) * 0.5 * self.circleSize) endY = self.c2y + 0.5 * self.circleSize - (cos(pi / 8) * 0.5 * self.circleSize) beginX = self.c1x + 0.5 * self.circleSize - (sin(pi / 5) * 0.5 * self.circleSize) beginY = self.c1y + 0.5 * self.circleSize + (cos(pi / 5) * 0.5 * self.circleSize) endX = self.c2x + 0.5 * self.circleSize + (sin(pi / 7) * 0.5 * self.circleSize) endY = self.c2y + 0.5 * self.circleSize - (cos(pi / 7) * 0.5 * self.circleSize) xLength = beginX - endX p1x = beginX - 0.2 * xLength p1y = beginY + 0.1 * self.circleSize p2x = beginX - 0.6 * xLength p2y = beginY + 0.1 * self.circleSize yLength = endY - beginY p1x = beginX + 0.2 * xLength p1y = beginY + 0.15 * yLength p2x = beginX + 0.1 * 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 + self.circleSize beginY = self.c2y + 0.5 * self.circleSize Loading Loading @@ -159,7 +161,7 @@ class MenuView(QGraphicsView): circle2.setPen(pen) circle3 = QGraphicsEllipseItem(self.c3x, self.c3y, self.circleSize, self.circleSize) circle3.setPen(pen) circle4 = QGraphicsEllipseItem(0.454 * self.w, 0.477 * self.h, 0.68 * self.h, 0.68 * self.h) circle4 = QGraphicsEllipseItem(0.45 * self.w, 0.477 * self.h, 0.68 * self.h, 0.68 * self.h) circle5 = QGraphicsEllipseItem(0.512 * self.w, 0.61 * self.h, 0.4 * self.h, 0.4 * self.h) x1 = QGraphicsEllipseItem(self.c1x + 0.5 * self.circleSize, self.c1y + 0.5 * self.circleSize, 10, 10) x2 = QGraphicsEllipseItem(self.c2x + 0.5 * self.circleSize, self.c2y + 0.5 * self.circleSize, 10, 10) Loading Loading @@ -345,32 +347,33 @@ class Arrow(QGraphicsItemGroup): pen = QPen() pen.setWidth(3) if game == GameEnum.PLANAR_TREE_TO_BINARY_TREE: endLineX = endX endLineX = endX - 0.1 * circleSize endLineY = endY + offset line = QGraphicsPathItem() line.setPen(pen) path = QPainterPath() path.moveTo(beginX - offset, beginY) 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 + offset, beginY) 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 + 1.5 * 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 + 1.5 * offset, endLineX, endLineY + 2.5 * 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.5 * offset, endX, endY) line6.setPen(pen) elif game == GameEnum.BINARY_TREE_TO_DYCK_WORD: Loading Loading @@ -404,88 +407,91 @@ class Arrow(QGraphicsItemGroup): line6.setPen(pen) elif game == GameEnum.DYCK_WORD_TO_PLANAR_TREE: endLineX = endX endLineX = endX + 0.1 * circleSize endLineY = endY + offset 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.moveTo(beginX - offset, beginY) 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.moveTo(beginX + offset, beginY) path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX, endLineY + 1.5 * 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 + 1.5 * offset, endLineX, endLineY + 2.5 * 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.5 * offset, endX, endY) line6.setPen(pen) elif game == GameEnum.DYCK_WORD_TO_BINARY_TREE: endLineX = endX endLineY = endY + 0.1 * 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.moveTo(beginX - offset, beginY) path.cubicTo(p1x - offset, p1y - offset, p2x - offset, p2y - offset, endLineX - offset, endLineY) 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.moveTo(beginX + offset, beginY) path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX + offset, endLineY) 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) elif game == GameEnum.BINARY_TREE_TO_PLANAR_TREE: endLineX = endX endLineX = endX + 0.05 * circleSize endLineY = endY - 0.1 * 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.moveTo(beginX - offset, beginY - offset) path.cubicTo(p1x - offset, p1y - offset, p2x - offset, p2y - offset, endLineX - offset, endLineY) 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.moveTo(beginX + offset, beginY) path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX + 1.5 * offset, endLineY + offset) line2.setPath(path) line3 = QGraphicsLineItem(endLineX, endY - offset, endLineX, endY - 2 * offset) line3 = QGraphicsLineItem(endLineX - offset, endLineY, endLineX - 2 * offset, endLineY) line3.setPen(pen) line4 = QGraphicsLineItem(endLineX, endY + offset, endLineX, endY + 2 * offset) line4 = QGraphicsLineItem(endLineX + 2 * offset, endLineY + offset, endLineX + 2.5 * offset, endLineY + offset) line4.setPen(pen) line5 = QGraphicsLineItem(endLineX, endY - 2 * offset, endX, endY) line5 = QGraphicsLineItem(endLineX - 2 * offset, endLineY, endX, endY) line5.setPen(pen) line6 = QGraphicsLineItem(endLineX, endY + 2 * offset, endX, endY) line6 = QGraphicsLineItem(endLineX + 2.5 * offset, endLineY + offset, endX, endY) line6.setPen(pen) else: endLineX = endX + 0.1 * circleSize Loading Loading
view/menuWidget.py +69 −63 Changes for view/menuWidget.py: 69 added lines, 63 removed lines. Original line number Diff line number Diff line from math import sqrt, cos, pi, sin from PyQt5.QtGui import QFont, QPen, QColor, QPainterPath, QLinearGradient from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt, QPointF from PyQt5.QtCore import Qt from model.GameEnum import GameEnum from model.node import Leaf, BinaryNode Loading Loading @@ -74,20 +74,17 @@ class MenuView(QGraphicsView): self.drawBinaryTree() self.drawPlanarTree() self.drawDyckWord() beginX = self.c2x + 0.5 * self.circleSize - 0.5 * self.circleSize * sin(pi / 8) beginY = self.c2y + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 8) endX = self.c1x + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 8) endY = self.c1y + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 8) beginX = self.c2x + 0.5 * self.circleSize - 0.5 * self.circleSize * sin(pi / 11) beginY = self.c2y + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 11) endX = self.c1x + 0.5 * self.circleSize - 0.5 * self.circleSize * cos(pi / 11) endY = self.c1y + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 11) xLength = endX - beginX yLength = beginY - endY p1x = beginX + 0.1 * xLength p1y = beginY - 0.8 * yLength p2x = beginX + 0.6 * xLength p2y = beginY - 0.95 * yLength p1x = beginX + 0.05 * xLength p1y = beginY - 0.5 * yLength p2x = beginX + 0.35 * xLength p2y = beginY - 0.8 * yLength self.drawArrow(beginX, beginY, endX, endY, p1x, p1y, p2x, p2y, GameEnum.PLANAR_TREE_TO_BINARY_TREE) beginX = self.c1x + 0.5 * self.circleSize + 0.5 * self.circleSize * cos(pi / 11) beginY = self.c1y + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 11) endX = self.c3x + 0.5 * self.circleSize + 0.5 * self.circleSize * sin(pi / 11) Loading @@ -109,25 +106,30 @@ class MenuView(QGraphicsView): p2x = beginX - 0.6 * xLength p2y = beginY + 0.1 * self.circleSize self.drawArrow(beginX, beginY, endX, endY, p1x, p1y, p2x, p2y, GameEnum.DYCK_WORD_TO_PLANAR_TREE) beginX = self.c3x + 0.5 * self.circleSize - (sin(pi / 8) * 0.5 * self.circleSize) beginY = self.c3y + 0.5 * self.circleSize - (cos(pi / 8) * 0.5 * self.circleSize) endX = self.c1x + 0.5 * self.circleSize + (sin(pi / 8) * 0.5 * self.circleSize) endY = self.c1y + 0.5 * self.circleSize + (cos(pi / 8) * 0.5 * self.circleSize) beginX = self.c3x + 0.5 * self.circleSize - (sin(pi / 7) * 0.5 * self.circleSize) beginY = self.c3y + 0.5 * self.circleSize - (cos(pi / 7) * 0.5 * self.circleSize) endX = self.c1x + 0.5 * self.circleSize + (sin(pi / 5) * 0.5 * self.circleSize) endY = self.c1y + 0.5 * self.circleSize + (cos(pi / 5) * 0.5 * self.circleSize) xLength = beginX - endX p1x = beginX - 0.2 * xLength p1y = beginY + 0.1 * self.circleSize p2x = beginX - 0.6 * xLength p2y = beginY + 0.1 * self.circleSize yLength = beginY - endY p1x = beginX - 1.2 * xLength p1y = beginY - 0.25 * 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) beginX = self.c1x + 0.5 * self.circleSize - (sin(pi / 8) * 0.5 * self.circleSize) beginY = self.c1y + 0.5 * self.circleSize + (cos(pi / 8) * 0.5 * self.circleSize) endX = self.c2x + 0.5 * self.circleSize + (sin(pi / 8) * 0.5 * self.circleSize) endY = self.c2y + 0.5 * self.circleSize - (cos(pi / 8) * 0.5 * self.circleSize) beginX = self.c1x + 0.5 * self.circleSize - (sin(pi / 5) * 0.5 * self.circleSize) beginY = self.c1y + 0.5 * self.circleSize + (cos(pi / 5) * 0.5 * self.circleSize) endX = self.c2x + 0.5 * self.circleSize + (sin(pi / 7) * 0.5 * self.circleSize) endY = self.c2y + 0.5 * self.circleSize - (cos(pi / 7) * 0.5 * self.circleSize) xLength = beginX - endX p1x = beginX - 0.2 * xLength p1y = beginY + 0.1 * self.circleSize p2x = beginX - 0.6 * xLength p2y = beginY + 0.1 * self.circleSize yLength = endY - beginY p1x = beginX + 0.2 * xLength p1y = beginY + 0.15 * yLength p2x = beginX + 0.1 * 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 + self.circleSize beginY = self.c2y + 0.5 * self.circleSize Loading Loading @@ -159,7 +161,7 @@ class MenuView(QGraphicsView): circle2.setPen(pen) circle3 = QGraphicsEllipseItem(self.c3x, self.c3y, self.circleSize, self.circleSize) circle3.setPen(pen) circle4 = QGraphicsEllipseItem(0.454 * self.w, 0.477 * self.h, 0.68 * self.h, 0.68 * self.h) circle4 = QGraphicsEllipseItem(0.45 * self.w, 0.477 * self.h, 0.68 * self.h, 0.68 * self.h) circle5 = QGraphicsEllipseItem(0.512 * self.w, 0.61 * self.h, 0.4 * self.h, 0.4 * self.h) x1 = QGraphicsEllipseItem(self.c1x + 0.5 * self.circleSize, self.c1y + 0.5 * self.circleSize, 10, 10) x2 = QGraphicsEllipseItem(self.c2x + 0.5 * self.circleSize, self.c2y + 0.5 * self.circleSize, 10, 10) Loading Loading @@ -345,32 +347,33 @@ class Arrow(QGraphicsItemGroup): pen = QPen() pen.setWidth(3) if game == GameEnum.PLANAR_TREE_TO_BINARY_TREE: endLineX = endX endLineX = endX - 0.1 * circleSize endLineY = endY + offset line = QGraphicsPathItem() line.setPen(pen) path = QPainterPath() path.moveTo(beginX - offset, beginY) 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 + offset, beginY) 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 + 1.5 * 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 + 1.5 * offset, endLineX, endLineY + 2.5 * 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.5 * offset, endX, endY) line6.setPen(pen) elif game == GameEnum.BINARY_TREE_TO_DYCK_WORD: Loading Loading @@ -404,88 +407,91 @@ class Arrow(QGraphicsItemGroup): line6.setPen(pen) elif game == GameEnum.DYCK_WORD_TO_PLANAR_TREE: endLineX = endX endLineX = endX + 0.1 * circleSize endLineY = endY + offset 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.moveTo(beginX - offset, beginY) 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.moveTo(beginX + offset, beginY) path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX, endLineY + 1.5 * 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 + 1.5 * offset, endLineX, endLineY + 2.5 * 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.5 * offset, endX, endY) line6.setPen(pen) elif game == GameEnum.DYCK_WORD_TO_BINARY_TREE: endLineX = endX endLineY = endY + 0.1 * 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.moveTo(beginX - offset, beginY) path.cubicTo(p1x - offset, p1y - offset, p2x - offset, p2y - offset, endLineX - offset, endLineY) 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.moveTo(beginX + offset, beginY) path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX + offset, endLineY) 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) elif game == GameEnum.BINARY_TREE_TO_PLANAR_TREE: endLineX = endX endLineX = endX + 0.05 * circleSize endLineY = endY - 0.1 * 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.moveTo(beginX - offset, beginY - offset) path.cubicTo(p1x - offset, p1y - offset, p2x - offset, p2y - offset, endLineX - offset, endLineY) 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.moveTo(beginX + offset, beginY) path.cubicTo(p1x + offset, p1y + offset, p2x + offset, p2y + offset, endLineX + 1.5 * offset, endLineY + offset) line2.setPath(path) line3 = QGraphicsLineItem(endLineX, endY - offset, endLineX, endY - 2 * offset) line3 = QGraphicsLineItem(endLineX - offset, endLineY, endLineX - 2 * offset, endLineY) line3.setPen(pen) line4 = QGraphicsLineItem(endLineX, endY + offset, endLineX, endY + 2 * offset) line4 = QGraphicsLineItem(endLineX + 2 * offset, endLineY + offset, endLineX + 2.5 * offset, endLineY + offset) line4.setPen(pen) line5 = QGraphicsLineItem(endLineX, endY - 2 * offset, endX, endY) line5 = QGraphicsLineItem(endLineX - 2 * offset, endLineY, endX, endY) line5.setPen(pen) line6 = QGraphicsLineItem(endLineX, endY + 2 * offset, endX, endY) line6 = QGraphicsLineItem(endLineX + 2.5 * offset, endLineY + offset, endX, endY) line6.setPen(pen) else: endLineX = endX + 0.1 * circleSize Loading