### eric6/Graphics/AssociationItem.py

changeset 7254
f00d825fbdb3
parent 7229
53054eb5b15a
child 7360
9190402e4505
```--- a/eric6/Graphics/AssociationItem.py	Sat Sep 21 16:04:17 2019 +0200
+++ b/eric6/Graphics/AssociationItem.py	Sat Sep 21 17:41:22 2019 +0200
@@ -74,8 +74,9 @@
self.setFlag(QGraphicsItem.ItemIsSelectable, False)

if topToBottom:
-            self.calculateEndingPoints = \
+            self.calculateEndingPoints = (
self.__calculateEndingPoints_topToBottom
+            )
else:
## self.calculateEndingPoints = self.__calculateEndingPoints_center
self.calculateEndingPoints = self.__calculateEndingPoints_rectangle
@@ -154,8 +155,12 @@
startP = self.__findRectIntersectionPoint(self.itemA, midA, midB)
endP = self.__findRectIntersectionPoint(self.itemB, midB, midA)

-        if startP.x() != -1 and startP.y() != -1 and \
-           endP.x() != -1 and endP.y() != -1:
+        if (
+            startP.x() != -1 and
+            startP.y() != -1 and
+            endP.x() != -1 and
+            endP.y() != -1
+        ):
self.setPoints(startP.x(), startP.y(), endP.x(), endP.y())

def __calculateEndingPoints_rectangle(self):
@@ -167,21 +172,23 @@
For each item the diagram is divided in four Regions by its diagonals
as indicated below
<pre>
-                   \  Region 2  /
-                    \          /
-                     |--------|
-                     | \    / |
-                     |  \  /  |
-                     |   \/   |
-            Region 1 |   /\   | Region 3
-                     |  /  \  |
-                     | /    \ |
-                     |--------|
-                    /          \
-                   /  Region 4  \
+            +------------------------------+
+            |        \  Region 2  /        |
+            |         \          /         |
+            |          |--------|          |
+            |          | \    / |          |
+            |          |  \  /  |          |
+            |          |   \/   |          |
+            | Region 1 |   /\   | Region 3 |
+            |          |  /  \  |          |
+            |          | /    \ |          |
+            |          |--------|          |
+            |         /          \         |
+            |        /  Region 4  \        |
+            +------------------------------+
</pre>

-        Each diagonal is defined by two corners of the bounding rectangle
+        Each diagonal is defined by two corners of the bounding rectangle.

To calculate the start point  we have to find out in which
region (defined by itemA's diagonals) is itemB's TopLeft corner
@@ -371,8 +378,10 @@
intersectLine = QLineF(p1, p2)
intersectPoint = QPointF(0, 0)
for line in lines:
-            if intersectLine.intersect(line, intersectPoint) == \
-               QLineF.BoundedIntersection:
+            if (
+                intersectLine.intersect(line, intersectPoint) ==
+                QLineF.BoundedIntersection
+            ):
return intersectPoint
return QPointF(-1.0, -1.0)
```