--- a/eric6/Graphics/UMLGraphicsView.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/UMLGraphicsView.py Sat Sep 21 17:41:22 2019 +0200 @@ -8,8 +8,9 @@ """ -from PyQt5.QtCore import pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent, \ - QRectF +from PyQt5.QtCore import ( + pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent, QRectF +) from PyQt5.QtWidgets import QGraphicsView, QAction, QToolBar, QDialog from PyQt5.QtPrintSupport import QPrinter, QPrintDialog @@ -75,87 +76,87 @@ self.alignMapper = QSignalMapper(self) self.alignMapper.mapped[int].connect(self.__alignShapes) - self.deleteShapeAct = \ - QAction(UI.PixmapCache.getIcon("deleteShape.png"), - self.tr("Delete shapes"), self) + self.deleteShapeAct = QAction( + UI.PixmapCache.getIcon("deleteShape.png"), + self.tr("Delete shapes"), self) self.deleteShapeAct.triggered.connect(self.__deleteShape) - self.incWidthAct = \ - QAction(UI.PixmapCache.getIcon("sceneWidthInc.png"), - self.tr("Increase width by {0} points").format( - self.deltaSize), - self) + self.incWidthAct = QAction( + UI.PixmapCache.getIcon("sceneWidthInc.png"), + self.tr("Increase width by {0} points").format( + self.deltaSize), + self) self.incWidthAct.triggered.connect(self.__incWidth) - self.incHeightAct = \ - QAction(UI.PixmapCache.getIcon("sceneHeightInc.png"), - self.tr("Increase height by {0} points").format( - self.deltaSize), - self) + self.incHeightAct = QAction( + UI.PixmapCache.getIcon("sceneHeightInc.png"), + self.tr("Increase height by {0} points").format( + self.deltaSize), + self) self.incHeightAct.triggered.connect(self.__incHeight) - self.decWidthAct = \ - QAction(UI.PixmapCache.getIcon("sceneWidthDec.png"), - self.tr("Decrease width by {0} points").format( - self.deltaSize), - self) + self.decWidthAct = QAction( + UI.PixmapCache.getIcon("sceneWidthDec.png"), + self.tr("Decrease width by {0} points").format( + self.deltaSize), + self) self.decWidthAct.triggered.connect(self.__decWidth) - self.decHeightAct = \ - QAction(UI.PixmapCache.getIcon("sceneHeightDec.png"), - self.tr("Decrease height by {0} points").format( - self.deltaSize), - self) + self.decHeightAct = QAction( + UI.PixmapCache.getIcon("sceneHeightDec.png"), + self.tr("Decrease height by {0} points").format( + self.deltaSize), + self) self.decHeightAct.triggered.connect(self.__decHeight) - self.setSizeAct = \ - QAction(UI.PixmapCache.getIcon("sceneSize.png"), - self.tr("Set size"), self) + self.setSizeAct = QAction( + UI.PixmapCache.getIcon("sceneSize.png"), + self.tr("Set size"), self) self.setSizeAct.triggered.connect(self.__setSize) - self.rescanAct = \ - QAction(UI.PixmapCache.getIcon("rescan.png"), - self.tr("Re-Scan"), self) + self.rescanAct = QAction( + UI.PixmapCache.getIcon("rescan.png"), + self.tr("Re-Scan"), self) self.rescanAct.triggered.connect(self.__rescan) - self.relayoutAct = \ - QAction(UI.PixmapCache.getIcon("relayout.png"), - self.tr("Re-Layout"), self) + self.relayoutAct = QAction( + UI.PixmapCache.getIcon("relayout.png"), + self.tr("Re-Layout"), self) self.relayoutAct.triggered.connect(self.__relayout) - self.alignLeftAct = \ - QAction(UI.PixmapCache.getIcon("shapesAlignLeft.png"), - self.tr("Align Left"), self) + self.alignLeftAct = QAction( + UI.PixmapCache.getIcon("shapesAlignLeft.png"), + self.tr("Align Left"), self) self.alignMapper.setMapping(self.alignLeftAct, Qt.AlignLeft) self.alignLeftAct.triggered.connect(self.alignMapper.map) - self.alignHCenterAct = \ - QAction(UI.PixmapCache.getIcon("shapesAlignHCenter.png"), - self.tr("Align Center Horizontal"), self) + self.alignHCenterAct = QAction( + UI.PixmapCache.getIcon("shapesAlignHCenter.png"), + self.tr("Align Center Horizontal"), self) self.alignMapper.setMapping(self.alignHCenterAct, Qt.AlignHCenter) self.alignHCenterAct.triggered.connect(self.alignMapper.map) - self.alignRightAct = \ - QAction(UI.PixmapCache.getIcon("shapesAlignRight.png"), - self.tr("Align Right"), self) + self.alignRightAct = QAction( + UI.PixmapCache.getIcon("shapesAlignRight.png"), + self.tr("Align Right"), self) self.alignMapper.setMapping(self.alignRightAct, Qt.AlignRight) self.alignRightAct.triggered.connect(self.alignMapper.map) - self.alignTopAct = \ - QAction(UI.PixmapCache.getIcon("shapesAlignTop.png"), - self.tr("Align Top"), self) + self.alignTopAct = QAction( + UI.PixmapCache.getIcon("shapesAlignTop.png"), + self.tr("Align Top"), self) self.alignMapper.setMapping(self.alignTopAct, Qt.AlignTop) self.alignTopAct.triggered.connect(self.alignMapper.map) - self.alignVCenterAct = \ - QAction(UI.PixmapCache.getIcon("shapesAlignVCenter.png"), - self.tr("Align Center Vertical"), self) + self.alignVCenterAct = QAction( + UI.PixmapCache.getIcon("shapesAlignVCenter.png"), + self.tr("Align Center Vertical"), self) self.alignMapper.setMapping(self.alignVCenterAct, Qt.AlignVCenter) self.alignVCenterAct.triggered.connect(self.alignMapper.map) - self.alignBottomAct = \ - QAction(UI.PixmapCache.getIcon("shapesAlignBottom.png"), - self.tr("Align Bottom"), self) + self.alignBottomAct = QAction( + UI.PixmapCache.getIcon("shapesAlignBottom.png"), + self.tr("Align Bottom"), self) self.alignMapper.setMapping(self.alignBottomAct, Qt.AlignBottom) self.alignBottomAct.triggered.connect(self.alignMapper.map) @@ -523,19 +524,27 @@ if alignment == Qt.AlignLeft: xOffset = rect.x() - itemrect.x() elif alignment == Qt.AlignRight: - xOffset = (rect.x() + rect.width()) - \ - (itemrect.x() + itemrect.width()) + xOffset = ( + (rect.x() + rect.width()) - + (itemrect.x() + itemrect.width()) + ) elif alignment == Qt.AlignHCenter: - xOffset = (rect.x() + rect.width() // 2) - \ - (itemrect.x() + itemrect.width() // 2) + xOffset = ( + (rect.x() + rect.width() // 2) - + (itemrect.x() + itemrect.width() // 2) + ) elif alignment == Qt.AlignTop: yOffset = rect.y() - itemrect.y() elif alignment == Qt.AlignBottom: - yOffset = (rect.y() + rect.height()) - \ - (itemrect.y() + itemrect.height()) + yOffset = ( + (rect.y() + rect.height()) - + (itemrect.y() + itemrect.height()) + ) elif alignment == Qt.AlignVCenter: - yOffset = (rect.y() + rect.height() // 2) - \ - (itemrect.y() + itemrect.height() // 2) + yOffset = ( + (rect.y() + rect.height() // 2) - + (itemrect.y() + itemrect.height() // 2) + ) item.moveBy(xOffset, yOffset) self.scene().update() @@ -747,9 +756,10 @@ except ValueError: return False, linenum elif key == "association": - srcId, dstId, assocType, topToBottom = \ + srcId, dstId, assocType, topToBottom = ( AssociationItem.parseAssociationItemDataString( value.strip()) + ) assoc = AssociationItem(umlItems[srcId], umlItems[dstId], assocType, topToBottom) self.scene().addItem(assoc)