Sat, 21 Sep 2019 17:41:22 +0200
Continued to resolve code style issue M841.
--- a/eric6/Graphics/ApplicationDiagramBuilder.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/ApplicationDiagramBuilder.py Sat Sep 21 17:41:22 2019 +0200 @@ -53,8 +53,11 @@ @return dictionary of modules contained in the application. """ import Utilities.ModuleParser - extensions = Preferences.getPython("PythonExtensions") + \ - Preferences.getPython("Python3Extensions") + ['.rb'] + extensions = ( + Preferences.getPython("PythonExtensions") + + Preferences.getPython("Python3Extensions") + + ['.rb'] + ) moduleDict = {} mods = self.project.pdata["SOURCES"] modules = [] @@ -94,8 +97,10 @@ """ Public method to build the packages shapes of the diagram. """ - project = os.path.splitdrive(self.project.getProjectPath())[1]\ + project = ( + os.path.splitdrive(self.project.getProjectPath())[1] .replace(os.sep, '.')[1:] + ) packages = {} shapes = {} p = 10 @@ -152,8 +157,10 @@ ppath = os.path.dirname(ppath) hasInit = len(glob.glob(os.path.join( ppath, '__init__.*'))) > 0 - shortPackage = packagePath.replace(ppath, '')\ + shortPackage = ( + packagePath.replace(ppath, '') .replace(os.sep, '.')[1:] + ) packageList = shortPackage.split('.')[1:] packageListLen = len(packageList) i = '.'.join( @@ -180,8 +187,10 @@ impLst.append(n) for imp in impLst: impPackage = '.'.join(imp.split('.')[:-1]) - if impPackage not in packages[package][1] and \ - not impPackage == package: + if ( + impPackage not in packages[package][1] and + not impPackage == package + ): packages[package][1].append(impPackage) sortedkeys = sorted(packages.keys()) @@ -271,9 +280,11 @@ @return flag indicating success (boolean) """ parts = data.split(", ") - if len(parts) != 2 or \ - not parts[0].startswith("project=") or \ - not parts[1].startswith("no_modules="): + if ( + len(parts) != 2 or + not parts[0].startswith("project=") or + not parts[1].startswith("no_modules=") + ): return False projectFile = parts[0].split("=", 1)[1].strip()
--- 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)
--- a/eric6/Graphics/ClassItem.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/ClassItem.py Sat Sep 21 17:41:22 2019 +0200 @@ -186,8 +186,10 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == \ - QStyle.State(QStyle.State_Selected): + if ( + (option.state & QStyle.State_Selected) == + QStyle.State(QStyle.State_Selected) + ): pen.setWidth(2) else: pen.setWidth(1)
--- a/eric6/Graphics/ImportsDiagramBuilder.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/ImportsDiagramBuilder.py Sat Sep 21 17:41:22 2019 +0200 @@ -78,12 +78,16 @@ @return dictionary of modules contained in the package. """ import Utilities.ModuleParser - extensions = Preferences.getPython("PythonExtensions") + \ + extensions = ( + Preferences.getPython("PythonExtensions") + Preferences.getPython("Python3Extensions") + ) moduleDict = {} modules = [] - for ext in Preferences.getPython("PythonExtensions") + \ - Preferences.getPython("Python3Extensions"): + for ext in ( + Preferences.getPython("PythonExtensions") + + Preferences.getPython("Python3Extensions") + ): modules.extend(glob.glob(Utilities.normjoinpath( self.packagePath, '*{0}'.format(ext)))) @@ -273,9 +277,11 @@ @return flag indicating success (boolean) """ parts = data.split(", ") - if len(parts) != 2 or \ - not parts[0].startswith("package=") or \ - not parts[1].startswith("show_external="): + if ( + len(parts) != 2 or + not parts[0].startswith("package=") or + not parts[1].startswith("show_external=") + ): return False self.packagePath = parts[0].split("=", 1)[1].strip()
--- a/eric6/Graphics/ModuleItem.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/ModuleItem.py Sat Sep 21 17:41:22 2019 +0200 @@ -138,8 +138,10 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == \ - QStyle.State(QStyle.State_Selected): + if ( + (option.state & QStyle.State_Selected) == + QStyle.State(QStyle.State_Selected) + ): pen.setWidth(2) else: pen.setWidth(1)
--- a/eric6/Graphics/PackageDiagramBuilder.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/PackageDiagramBuilder.py Sat Sep 21 17:41:22 2019 +0200 @@ -73,14 +73,18 @@ """ import Utilities.ModuleParser - supportedExt = \ + supportedExt = ( ['*{0}'.format(ext) for ext in - Preferences.getPython("PythonExtensions")] + \ + Preferences.getPython("PythonExtensions")] + ['*{0}'.format(ext) for ext in - Preferences.getPython("Python3Extensions")] + \ + Preferences.getPython("Python3Extensions")] + ['*.rb'] - extensions = Preferences.getPython("PythonExtensions") + \ - Preferences.getPython("Python3Extensions") + ['.rb'] + ) + extensions = ( + Preferences.getPython("PythonExtensions") + + Preferences.getPython("Python3Extensions") + + ['.rb'] + ) moduleDict = {} modules = [] @@ -125,23 +129,31 @@ """ import Utilities.ModuleParser - supportedExt = \ + supportedExt = ( ['*{0}'.format(ext) for ext in - Preferences.getPython("PythonExtensions")] + \ + Preferences.getPython("PythonExtensions")] + ['*{0}'.format(ext) for ext in - Preferences.getPython("Python3Extensions")] + \ + Preferences.getPython("Python3Extensions")] + ['*.rb'] - extensions = Preferences.getPython("PythonExtensions") + \ - Preferences.getPython("Python3Extensions") + ['.rb'] + ) + extensions = ( + Preferences.getPython("PythonExtensions") + + Preferences.getPython("Python3Extensions") + + ['.rb'] + ) subpackagesDict = {} subpackagesList = [] for subpackage in os.listdir(self.package): subpackagePath = os.path.join(self.package, subpackage) - if os.path.isdir(subpackagePath) and \ - subpackage != "__pycache__" and \ - len(glob.glob(os.path.join(subpackagePath, "__init__.*"))) != 0: + if ( + os.path.isdir(subpackagePath) and + subpackage != "__pycache__" and + len(glob.glob( + os.path.join(subpackagePath, "__init__.*") + )) != 0 + ): subpackagesList.append(subpackagePath) tot = 0 @@ -349,12 +361,15 @@ # distribute each generation across the width and the # generations across height y = 10.0 - for currentWidth, currentHeight, generation in \ - zip_longest(widths, heights, generations): + for currentWidth, currentHeight, generation in ( + zip_longest(widths, heights, generations) + ): x = 10.0 # whiteSpace is the space between any two elements - whiteSpace = (width - currentWidth - 20) / \ + whiteSpace = ( + (width - currentWidth - 20) / (len(generation) - 1.0 or 2.0) + ) for className in generation: cw = self.__getCurrentShape(className) cw.setPos(x, y) @@ -450,9 +465,11 @@ @return flag indicating success (boolean) """ parts = data.split(", ") - if len(parts) != 2 or \ - not parts[0].startswith("package=") or \ - not parts[1].startswith("no_attributes="): + if ( + len(parts) != 2 or + not parts[0].startswith("package=") or + not parts[1].startswith("no_attributes=") + ): return False self.package = parts[0].split("=", 1)[1].strip()
--- a/eric6/Graphics/PackageItem.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/PackageItem.py Sat Sep 21 17:41:22 2019 +0200 @@ -157,8 +157,10 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == \ - QStyle.State(QStyle.State_Selected): + if ( + (option.state & QStyle.State_Selected) == + QStyle.State(QStyle.State_Selected) + ): pen.setWidth(2) else: pen.setWidth(1)
--- a/eric6/Graphics/PixmapDiagram.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/PixmapDiagram.py Sat Sep 21 17:41:22 2019 +0200 @@ -10,8 +10,9 @@ from PyQt5.QtCore import Qt, QSize, QEvent from PyQt5.QtGui import QPalette, QImage, QPixmap, QPainter, QFont, QColor -from PyQt5.QtWidgets import QLabel, QSizePolicy, QScrollArea, QAction, QMenu, \ - QToolBar +from PyQt5.QtWidgets import ( + QLabel, QSizePolicy, QScrollArea, QAction, QMenu, QToolBar +) from PyQt5.QtPrintSupport import QPrinter, QPrintDialog from E5Gui import E5MessageBox @@ -90,19 +91,19 @@ """ Private method to initialize the view actions. """ - self.closeAct = \ - QAction(UI.PixmapCache.getIcon("close.png"), - self.tr("Close"), self) + self.closeAct = QAction( + UI.PixmapCache.getIcon("close.png"), + self.tr("Close"), self) self.closeAct.triggered.connect(self.close) - self.printAct = \ - QAction(UI.PixmapCache.getIcon("print.png"), - self.tr("Print"), self) + self.printAct = QAction( + UI.PixmapCache.getIcon("print.png"), + self.tr("Print"), self) self.printAct.triggered.connect(self.__printDiagram) - self.printPreviewAct = \ - QAction(UI.PixmapCache.getIcon("printPreview.png"), - self.tr("Print Preview"), self) + self.printPreviewAct = QAction( + UI.PixmapCache.getIcon("printPreview.png"), + self.tr("Print Preview"), self) self.printPreviewAct.triggered.connect(self.__printPreviewDiagram) def __initContextMenu(self): @@ -366,18 +367,26 @@ fm = painter.fontMetrics() fontHeight = fm.lineSpacing() marginX = printer.pageRect().x() - printer.paperRect().x() - marginX = Preferences.getPrinter("LeftMargin") * \ + marginX = ( + Preferences.getPrinter("LeftMargin") * int(printer.resolution() / 2.54) - marginX + ) marginY = printer.pageRect().y() - printer.paperRect().y() - marginY = Preferences.getPrinter("TopMargin") * \ + marginY = ( + Preferences.getPrinter("TopMargin") * int(printer.resolution() / 2.54) - marginY + ) - width = printer.width() - marginX - \ - Preferences.getPrinter("RightMargin") * \ + width = ( + printer.width() - marginX - + Preferences.getPrinter("RightMargin") * int(printer.resolution() / 2.54) - height = printer.height() - fontHeight - 4 - marginY - \ - Preferences.getPrinter("BottomMargin") * \ + ) + height = ( + printer.height() - fontHeight - 4 - marginY - + Preferences.getPrinter("BottomMargin") * int(printer.resolution() / 2.54) + ) # write a foot note s = self.tr("Diagram: {0}").format(self.getDiagramName())
--- a/eric6/Graphics/SvgDiagram.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/SvgDiagram.py Sat Sep 21 17:41:22 2019 +0200 @@ -89,19 +89,19 @@ """ Private method to initialize the view actions. """ - self.closeAct = \ - QAction(UI.PixmapCache.getIcon("close.png"), - self.tr("Close"), self) + self.closeAct = QAction( + UI.PixmapCache.getIcon("close.png"), + self.tr("Close"), self) self.closeAct.triggered.connect(self.close) - self.printAct = \ - QAction(UI.PixmapCache.getIcon("print.png"), - self.tr("Print"), self) + self.printAct = QAction( + UI.PixmapCache.getIcon("print.png"), + self.tr("Print"), self) self.printAct.triggered.connect(self.__printDiagram) - self.printPreviewAct = \ - QAction(UI.PixmapCache.getIcon("printPreview.png"), - self.tr("Print Preview"), self) + self.printPreviewAct = QAction( + UI.PixmapCache.getIcon("printPreview.png"), + self.tr("Print Preview"), self) self.printPreviewAct.triggered.connect(self.__printPreviewDiagram) def __initContextMenu(self): @@ -338,18 +338,26 @@ fm = painter.fontMetrics() fontHeight = fm.lineSpacing() marginX = printer.pageRect().x() - printer.paperRect().x() - marginX = Preferences.getPrinter("LeftMargin") * \ + marginX = ( + Preferences.getPrinter("LeftMargin") * int(printer.resolution() / 2.54) - marginX + ) marginY = printer.pageRect().y() - printer.paperRect().y() - marginY = Preferences.getPrinter("TopMargin") * \ + marginY = ( + Preferences.getPrinter("TopMargin") * int(printer.resolution() / 2.54) - marginY + ) - width = printer.width() - marginX - \ - Preferences.getPrinter("RightMargin") * \ + width = ( + printer.width() - marginX - + Preferences.getPrinter("RightMargin") * int(printer.resolution() / 2.54) - height = printer.height() - fontHeight - 4 - marginY - \ - Preferences.getPrinter("BottomMargin") * \ + ) + height = ( + printer.height() - fontHeight - 4 - marginY - + Preferences.getPrinter("BottomMargin") * int(printer.resolution() / 2.54) + ) # write a foot note s = self.tr("Diagram: {0}").format(self.getDiagramName())
--- a/eric6/Graphics/UMLClassDiagramBuilder.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/UMLClassDiagramBuilder.py Sat Sep 21 17:41:22 2019 +0200 @@ -72,8 +72,11 @@ self.allModules = {} try: - extensions = Preferences.getPython("PythonExtensions") + \ - Preferences.getPython("Python3Extensions") + ['.rb'] + extensions = ( + Preferences.getPython("PythonExtensions") + + Preferences.getPython("Python3Extensions") + + ['.rb'] + ) module = Utilities.ModuleParser.readModule( self.file, extensions=extensions, caching=False) except ImportError: @@ -205,12 +208,15 @@ # distribute each generation across the width and the # generations across height y = 10.0 - for currentWidth, currentHeight, generation in \ - zip_longest(widths, heights, generations): + for currentWidth, currentHeight, generation in ( + zip_longest(widths, heights, generations) + ): x = 10.0 # whiteSpace is the space between any two elements - whiteSpace = (width - currentWidth - 20) / \ + whiteSpace = ( + (width - currentWidth - 20) / (len(generation) - 1.0 or 2.0) + ) for className in generation: cw = self.__getCurrentShape(className) cw.setPos(x, y) @@ -293,9 +299,11 @@ @return flag indicating success (boolean) """ parts = data.split(", ") - if len(parts) != 2 or \ - not parts[0].startswith("file=") or \ - not parts[1].startswith("no_attributes="): + if ( + len(parts) != 2 or + not parts[0].startswith("file=") or + not parts[1].startswith("no_attributes=") + ): return False self.file = parts[0].split("=", 1)[1].strip()
--- a/eric6/Graphics/UMLDialog.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/UMLDialog.py Sat Sep 21 17:41:22 2019 +0200 @@ -73,39 +73,39 @@ """ Private slot to initialize the actions. """ - self.closeAct = \ - QAction(UI.PixmapCache.getIcon("close.png"), - self.tr("Close"), self) + self.closeAct = QAction( + UI.PixmapCache.getIcon("close.png"), + self.tr("Close"), self) self.closeAct.triggered.connect(self.close) - self.openAct = \ - QAction(UI.PixmapCache.getIcon("open.png"), - self.tr("Load"), self) + self.openAct = QAction( + UI.PixmapCache.getIcon("open.png"), + self.tr("Load"), self) self.openAct.triggered.connect(self.load) - self.saveAct = \ - QAction(UI.PixmapCache.getIcon("fileSave.png"), - self.tr("Save"), self) + self.saveAct = QAction( + UI.PixmapCache.getIcon("fileSave.png"), + self.tr("Save"), self) self.saveAct.triggered.connect(self.__save) - self.saveAsAct = \ - QAction(UI.PixmapCache.getIcon("fileSaveAs.png"), - self.tr("Save As..."), self) + self.saveAsAct = QAction( + UI.PixmapCache.getIcon("fileSaveAs.png"), + self.tr("Save As..."), self) self.saveAsAct.triggered.connect(self.__saveAs) - self.saveImageAct = \ - QAction(UI.PixmapCache.getIcon("fileSavePixmap.png"), - self.tr("Save as Image"), self) + self.saveImageAct = QAction( + UI.PixmapCache.getIcon("fileSavePixmap.png"), + self.tr("Save as Image"), self) self.saveImageAct.triggered.connect(self.umlView.saveImage) - self.printAct = \ - QAction(UI.PixmapCache.getIcon("print.png"), - self.tr("Print"), self) + self.printAct = QAction( + UI.PixmapCache.getIcon("print.png"), + self.tr("Print"), self) self.printAct.triggered.connect(self.umlView.printDiagram) - self.printPreviewAct = \ - QAction(UI.PixmapCache.getIcon("printPreview.png"), - self.tr("Print Preview"), self) + self.printPreviewAct = QAction( + UI.PixmapCache.getIcon("printPreview.png"), + self.tr("Print Preview"), self) self.printPreviewAct.triggered.connect( self.umlView.printPreviewDiagram) @@ -306,8 +306,10 @@ # step 1: check version linenum = 0 key, value = lines[linenum].split(": ", 1) - if key.strip() != "version" or \ - value.strip() not in UMLDialog.FileVersions: + if ( + key.strip() != "version" or + value.strip() not in UMLDialog.FileVersions + ): self.__showInvalidDataMessage(filename, linenum) return False else:
--- 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)
--- a/eric6/Graphics/UMLItem.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/Graphics/UMLItem.py Sat Sep 21 17:41:22 2019 +0200 @@ -184,8 +184,10 @@ @param widget optional reference to the widget painted on (QWidget) """ pen = self.pen() - if (option.state & QStyle.State_Selected) == \ - QStyle.State(QStyle.State_Selected): + if ( + (option.state & QStyle.State_Selected) == + QStyle.State(QStyle.State_Selected) + ): pen.setWidth(2) else: pen.setWidth(1)
--- a/eric6/HexEdit/HexEditChunks.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/HexEdit/HexEditChunks.py Sat Sep 21 17:41:22 2019 +0200 @@ -147,8 +147,8 @@ maxSize -= count pos += count if highlighted is not None: - highlighted += \ - chunk.dataChanged[chunkOfs:chunkOfs + count] + highlighted += chunk.dataChanged[ + chunkOfs:chunkOfs + count] if maxSize > 0 and pos < chunk.absPos: # In this section, we read data from the original source. This @@ -417,8 +417,10 @@ for idx in range(len(self.__chunks)): chunk = self.__chunks[idx] - if absPos >= chunk.absPos and \ - absPos < (chunk.absPos + len(chunk.data)): + if ( + absPos >= chunk.absPos and + absPos < (chunk.absPos + len(chunk.data)) + ): foundIdx = idx break
--- a/eric6/HexEdit/HexEditMainWindow.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/HexEdit/HexEditMainWindow.py Sat Sep 21 17:41:22 2019 +0200 @@ -10,11 +10,13 @@ import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFile, QFileInfo, QSize, \ - QCoreApplication, QLocale +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QFile, QFileInfo, QSize, QCoreApplication, QLocale +) from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import QWhatsThis, QLabel, QWidget, QVBoxLayout, \ - QDialog, QAction, QFrame, QMenu +from PyQt5.QtWidgets import ( + QWhatsThis, QLabel, QWidget, QVBoxLayout, QDialog, QAction, QFrame, QMenu +) from E5Gui.E5Action import E5Action from E5Gui.E5MainWindow import E5MainWindow
--- a/eric6/HexEdit/HexEditSearchReplaceWidget.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/HexEdit/HexEditSearchReplaceWidget.py Sat Sep 21 17:41:22 2019 +0200 @@ -246,14 +246,18 @@ if len(ba) > 0: startIndex = self.__editor.cursorPosition() // 2 if prev: - if self.__editor.hasSelection() and \ - startIndex == self.__editor.getSelectionEnd(): + if ( + self.__editor.hasSelection() and + startIndex == self.__editor.getSelectionEnd() + ): # skip to the selection start startIndex = self.__editor.getSelectionBegin() idx = self.__editor.lastIndexOf(ba, startIndex) else: - if self.__editor.hasSelection() and \ - startIndex == self.__editor.getSelectionBegin() - 1: + if ( + self.__editor.hasSelection() and + startIndex == self.__editor.getSelectionBegin() - 1 + ): # skip to the selection end startIndex = self.__editor.getSelectionEnd() idx = self.__editor.indexOf(ba, startIndex) @@ -336,8 +340,10 @@ @type bool """ # Check enabled status due to dual purpose usage of this method - if not self.__ui.replaceButton.isEnabled() and \ - not self.__ui.replaceSearchButton.isEnabled(): + if ( + not self.__ui.replaceButton.isEnabled() and + not self.__ui.replaceSearchButton.isEnabled() + ): return fba, ftxt = self.__getContent(False)
--- a/eric6/HexEdit/HexEditWidget.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/HexEdit/HexEditWidget.py Sat Sep 21 17:41:22 2019 +0200 @@ -9,10 +9,12 @@ import math -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray, QTimer, QRect, \ - QBuffer, QIODevice -from PyQt5.QtGui import QBrush, QPen, QColor, QFont, QPalette, QKeySequence, \ - QPainter +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, Qt, QByteArray, QTimer, QRect, QBuffer, QIODevice +) +from PyQt5.QtGui import ( + QBrush, QPen, QColor, QFont, QPalette, QKeySequence, QPainter +) from PyQt5.QtWidgets import QAbstractScrollArea, QApplication from .HexEditChunks import HexEditChunks @@ -727,11 +729,15 @@ if (point.x() >= self.__pxPosHexX) and ( point.x() < (self.__pxPosHexX + (1 + self.HEXCHARS_PER_LINE) * self.__pxCharWidth)): - x = (point.x() - self.__pxPosHexX - self.__pxCharWidth // 2) // \ + x = ( + (point.x() - self.__pxPosHexX - self.__pxCharWidth // 2) // self.__pxCharWidth + ) x = (x // 3) * 2 + x % 3 - y = ((point.y() - 3) // self.__pxCharHeight) * 2 * \ + y = ( + ((point.y() - 3) // self.__pxCharHeight) * 2 * self.BYTES_PER_LINE + ) result = self.__bPosFirst * 2 + x + y return result @@ -997,9 +1003,11 @@ """ Public method to extend the selection to the end of line. """ - pos = self.__cursorPosition - \ - (self.__cursorPosition % (2 * self.BYTES_PER_LINE)) + \ + pos = ( + self.__cursorPosition - + (self.__cursorPosition % (2 * self.BYTES_PER_LINE)) + 2 * self.BYTES_PER_LINE + ) self.setCursorPosition(pos) self.__setSelection(pos) @@ -1007,8 +1015,10 @@ """ Public method to extend the selection to the start of line. """ - pos = self.__cursorPosition - \ + pos = ( + self.__cursorPosition - (self.__cursorPosition % (2 * self.BYTES_PER_LINE)) + ) self.setCursorPosition(pos) self.__setSelection(pos) @@ -1032,9 +1042,11 @@ """ Public method to extend the selection one page down. """ - pos = self.__cursorPosition + \ - ((self.viewport().height() // self.__pxCharHeight) - 1) * \ + pos = ( + self.__cursorPosition + + ((self.viewport().height() // self.__pxCharHeight) - 1) * 2 * self.BYTES_PER_LINE + ) self.setCursorPosition(pos) self.__setSelection(pos) @@ -1042,9 +1054,11 @@ """ Public method to extend the selection one page up. """ - pos = self.__cursorPosition - \ - ((self.viewport().height() // self.__pxCharHeight) - 1) * \ + pos = ( + self.__cursorPosition - + ((self.viewport().height() // self.__pxCharHeight) - 1) * 2 * self.BYTES_PER_LINE + ) self.setCursorPosition(pos) self.__setSelection(pos) @@ -1226,8 +1240,10 @@ # Edit commands elif evt.matches(QKeySequence.Copy): self.copy() - elif evt.key() == Qt.Key_Insert and \ - evt.modifiers() == Qt.NoModifier: + elif ( + evt.key() == Qt.Key_Insert and + evt.modifiers() == Qt.NoModifier + ): self.setOverwriteMode(not self.overwriteMode()) self.setCursorPosition(self.__cursorPosition) @@ -1238,8 +1254,10 @@ self.paste() elif evt.matches(QKeySequence.Delete): self.deleteByte() - elif evt.key() == Qt.Key_Backspace and \ - evt.modifiers() == Qt.NoModifier: + elif ( + evt.key() == Qt.Key_Backspace and + evt.modifiers() == Qt.NoModifier + ): self.deleteByteBack() elif evt.matches(QKeySequence.Undo): self.undo() @@ -1333,8 +1351,10 @@ """ painter = QPainter(self.viewport()) - if evt.rect() != self.__cursorRect and \ - evt.rect() != self.__cursorRectAscii: + if ( + evt.rect() != self.__cursorRect and + evt.rect() != self.__cursorRectAscii + ): pxOfsX = self.horizontalScrollBar().value() pxPosStartY = self.__pxCharHeight @@ -1387,14 +1407,18 @@ bPosLine = row * self.BYTES_PER_LINE colIdx = 0 - while bPosLine + colIdx < len(self.__dataShown) and \ - colIdx < self.BYTES_PER_LINE: + while ( + bPosLine + colIdx < len(self.__dataShown) and + colIdx < self.BYTES_PER_LINE + ): c = self.viewport().palette().color(QPalette.Base) painter.setPen(colStandard) posBa = self.__bPosFirst + bPosLine + colIdx - if self.getSelectionBegin() <= posBa and \ - self.getSelectionEnd() > posBa: + if ( + self.getSelectionBegin() <= posBa and + self.getSelectionEnd() > posBa + ): c = self.__selectionBrush.color() painter.setPen(self.__selectionPen) elif self.__highlighting: @@ -1420,9 +1444,10 @@ 3 * self.__pxCharWidth, self.__pxCharHeight) painter.fillRect(r, c) - hexStr = \ - chr(self.__hexDataShown[(bPosLine + colIdx) * 2]) + \ + hexStr = ( + chr(self.__hexDataShown[(bPosLine + colIdx) * 2]) + chr(self.__hexDataShown[(bPosLine + colIdx) * 2 + 1]) + ) painter.drawText(pxPosX, pxPosY, hexStr) pxPosX += 3 * self.__pxCharWidth @@ -1650,8 +1675,11 @@ else: self.__pxPosHexX = self.__pxGapAdrHex self.__pxPosAdrX = self.__pxGapAdr - self.__pxPosAsciiX = self.__pxPosHexX + \ - self.HEXCHARS_PER_LINE * self.__pxCharWidth + self.__pxGapHexAscii + self.__pxPosAsciiX = ( + self.__pxPosHexX + + self.HEXCHARS_PER_LINE * self.__pxCharWidth + + self.__pxGapHexAscii + ) # set horizontal scrollbar pxWidth = self.__pxPosAsciiX @@ -1662,8 +1690,9 @@ self.horizontalScrollBar().setPageStep(self.viewport().width()) # set vertical scrollbar - self.__rowsShown = \ + self.__rowsShown = ( (self.viewport().height() - 4) // self.__pxCharHeight + ) lineCount = (self.__chunks.size() // self.BYTES_PER_LINE) + 1 self.verticalScrollBar().setRange(0, lineCount - self.__rowsShown) self.verticalScrollBar().setPageStep(self.__rowsShown) @@ -1671,8 +1700,9 @@ # do the rest value = self.verticalScrollBar().value() self.__bPosFirst = value * self.BYTES_PER_LINE - self.__bPosLast = \ + self.__bPosLast = ( self.__bPosFirst + self.__rowsShown * self.BYTES_PER_LINE - 1 + ) if self.__bPosLast >= self.__chunks.size(): self.__bPosLast = self.__chunks.size() - 1 self.__readBuffers()
--- a/eric6/IconEditor/IconEditorGrid.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/IconEditor/IconEditorGrid.py Sat Sep 21 17:41:22 2019 +0200 @@ -9,10 +9,12 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPoint, QRect, QSize -from PyQt5.QtGui import QImage, QColor, QPixmap, qRgba, QPainter, QCursor, \ - QBrush, qGray, qAlpha -from PyQt5.QtWidgets import QUndoCommand, QWidget, QSizePolicy, QUndoStack, \ - QApplication, QDialog +from PyQt5.QtGui import ( + QImage, QColor, QPixmap, qRgba, QPainter, QCursor, QBrush, qGray, qAlpha +) +from PyQt5.QtWidgets import ( + QUndoCommand, QWidget, QSizePolicy, QUndoStack, QApplication, QDialog +) from E5Gui import E5MessageBox @@ -711,9 +713,11 @@ @param doUpdate flag indicating an update is requested (boolean) (used for speed optimizations) """ - if not self.__image.rect().contains(i, j) or \ - self.__image.pixel(i, j) != oldColor.rgba() or \ - self.__image.pixel(i, j) == self.penColor().rgba(): + if ( + not self.__image.rect().contains(i, j) or + self.__image.pixel(i, j) != oldColor.rgba() or + self.__image.pixel(i, j) == self.penColor().rgba() + ): return self.__image.setPixel(i, j, self.penColor().rgba()) @@ -893,8 +897,10 @@ """ img, ok = self.__clipboardImage() if ok: - if img.width() > self.__image.width() or \ - img.height() > self.__image.height(): + if ( + img.width() > self.__image.width() or + img.height() > self.__image.height() + ): res = E5MessageBox.yesNo( self, self.tr("Paste"), @@ -982,8 +988,10 @@ res = dlg.exec_() if res == QDialog.Accepted: newWidth, newHeight = dlg.getData() - if newWidth != self.__image.width() or \ - newHeight != self.__image.height(): + if ( + newWidth != self.__image.width() or + newHeight != self.__image.height() + ): cmd = IconEditCommand(self, self.tr("Resize Image"), self.__image) img = self.__image.scaled(
--- a/eric6/IconEditor/IconEditorPalette.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/IconEditor/IconEditorPalette.py Sat Sep 21 17:41:22 2019 +0200 @@ -10,9 +10,10 @@ from PyQt5.QtCore import pyqtSignal, Qt from PyQt5.QtGui import QColor, QPainter, QPixmap -from PyQt5.QtWidgets import QWidget, QBoxLayout, QLabel, QFrame, QPushButton, \ - QSpinBox, QGroupBox, QVBoxLayout, QRadioButton, QSpacerItem, QSizePolicy, \ - QColorDialog +from PyQt5.QtWidgets import ( + QWidget, QBoxLayout, QLabel, QFrame, QPushButton, QSpinBox, QGroupBox, + QVBoxLayout, QRadioButton, QSpacerItem, QSizePolicy, QColorDialog +) class IconEditorPalette(QWidget):
--- a/eric6/IconEditor/IconEditorWindow.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/IconEditor/IconEditorWindow.py Sat Sep 21 17:41:22 2019 +0200 @@ -10,10 +10,12 @@ import os -from PyQt5.QtCore import pyqtSignal, Qt, QSize, QSignalMapper, QFileInfo, \ - QFile, QEvent -from PyQt5.QtGui import QPalette, QImage, QImageReader, QImageWriter, \ - QKeySequence +from PyQt5.QtCore import ( + pyqtSignal, Qt, QSize, QSignalMapper, QFileInfo, QFile, QEvent +) +from PyQt5.QtGui import ( + QPalette, QImage, QImageReader, QImageWriter, QKeySequence +) from PyQt5.QtWidgets import QScrollArea, QLabel, QDockWidget, QWhatsThis from E5Gui.E5Action import E5Action, createActionGroup
--- a/eric6/MultiProject/MultiProject.py Sat Sep 21 16:04:17 2019 +0200 +++ b/eric6/MultiProject/MultiProject.py Sat Sep 21 17:41:22 2019 +0200 @@ -11,8 +11,9 @@ import os import shutil -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QFileInfo, QFile, \ - QIODevice, QObject, QUuid +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, Qt, QFileInfo, QFile, QIODevice, QObject, QUuid +) from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import QMenu, QApplication, QDialog, QToolBar @@ -201,8 +202,10 @@ Private slot to extract the categories used in the project definitions. """ for project in self.__projects.values(): - if project['category'] and \ - project['category'] not in self.categories: + if ( + project['category'] and + project['category'] not in self.categories + ): self.categories.append(project['category']) def getCategories(self): @@ -271,8 +274,9 @@ if f.open(QIODevice.WriteOnly): from E5XML.MultiProjectWriter import MultiProjectWriter MultiProjectWriter( - f, self, os.path.splitext(os.path.basename(fn))[0])\ - .writeXML() + f, + self, os.path.splitext(os.path.basename(fn))[0] + ).writeXML() res = True else: E5MessageBox.critical( @@ -321,8 +325,9 @@ dlg = AddProjectDialog(self.ui, startdir=startdir, categories=self.categories, category=category) if dlg.exec_() == QDialog.Accepted: - name, filename, isMaster, description, category, uid = \ + name, filename, isMaster, description, category, uid = ( dlg.getData() + ) # step 1: check, if project was already added for project in self.__projects.values(): @@ -375,8 +380,11 @@ path=srcProjectDirectory, defaultDirectory=startdir, ) - if ok and dstProjectDirectory and \ - not os.path.exists(dstProjectDirectory): + if ( + ok and + dstProjectDirectory and + not os.path.exists(dstProjectDirectory) + ): try: shutil.copytree(srcProjectDirectory, dstProjectDirectory) except shutil.Error: @@ -594,8 +602,10 @@ if self.ppath: defaultPath = self.ppath else: - defaultPath = Preferences.getMultiProject("Workspace") or \ + defaultPath = ( + Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + ) fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( self.parent(), self.tr("Save multiproject as"), @@ -977,9 +987,11 @@ """ for project in self.__projects.values(): if project['master']: - if reopen or \ - not self.projectObject.isOpen() or \ - self.projectObject.getProjectFile() != project['file']: + if ( + reopen or + not self.projectObject.isOpen() or + self.projectObject.getProjectFile() != project['file'] + ): self.openProject(project['file']) return