diff -r fb0ef164f536 -r 698ae46f40a4 eric6/Graphics/UMLClassDiagramBuilder.py --- a/eric6/Graphics/UMLClassDiagramBuilder.py Fri Apr 02 11:59:41 2021 +0200 +++ b/eric6/Graphics/UMLClassDiagramBuilder.py Sat May 01 14:27:20 2021 +0200 @@ -32,7 +32,7 @@ @param noAttrs flag indicating, that no attributes should be shown (boolean) """ - super(UMLClassDiagramBuilder, self).__init__(dialog, view, project) + super().__init__(dialog, view, project) self.setObjectName("UMLClassDiagramBuilder") self.file = file @@ -43,11 +43,12 @@ Public method to initialize the object. """ pname = self.project.getProjectName() - if pname and self.project.isProjectSource(self.file): - name = self.tr("Class Diagram {0}: {1}").format( + name = ( + self.tr("Class Diagram {0}: {1}").format( pname, self.project.getRelativePath(self.file)) - else: - name = self.tr("Class Diagram: {0}").format(self.file) + if pname and self.project.isProjectSource(self.file) else + self.tr("Class Diagram: {0}").format(self.file) + ) self.umlView.setDiagramName(name) def __getCurrentShape(self, name): @@ -180,27 +181,27 @@ for rect in generation: if rect.bottom() > currentHeight: currentHeight = rect.bottom() - currentWidth = currentWidth + rect.right() + currentWidth += rect.right() # update totals if currentWidth > width: width = currentWidth - height = height + currentHeight + height += currentHeight # store generation info widths.append(currentWidth) heights.append(currentHeight) # add in some whitespace - width = width * whiteSpaceFactor + width *= whiteSpaceFactor height = height * whiteSpaceFactor - 20 verticalWhiteSpace = 40.0 sceneRect = self.umlView.sceneRect() width += 50.0 height += 50.0 - swidth = width < sceneRect.width() and sceneRect.width() or width - sheight = height < sceneRect.height() and sceneRect.height() or height + swidth = sceneRect.width() if width < sceneRect.width() else width + sheight = sceneRect.height() if height < sceneRect.height() else height self.umlView.setSceneSize(swidth, sheight) # distribute each generation across the width and the @@ -272,13 +273,13 @@ @param routes list of relationsships """ - from .AssociationItem import AssociationItem, Generalisation + from .AssociationItem import AssociationItem, AssociationType for route in routes: if len(route) > 1: assoc = AssociationItem( self.__getCurrentShape(route[1]), self.__getCurrentShape(route[0]), - Generalisation, + AssociationType.GENERALISATION, topToBottom=True, colors=self.umlView.getDrawingColors()) self.scene.addItem(assoc)