diff -r aff39db4dacc -r 7c017076c12e eric6/Snapshot/SnapshotFreehandGrabber.py --- a/eric6/Snapshot/SnapshotFreehandGrabber.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Snapshot/SnapshotFreehandGrabber.py Mon Sep 23 19:22:12 2019 +0200 @@ -9,8 +9,10 @@ from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale -from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \ - QPolygon, QPen, QBrush, QPaintEngine +from PyQt5.QtGui import ( + QPixmap, QColor, QRegion, QPainter, QPalette, QPolygon, QPen, QBrush, + QPaintEngine +) from PyQt5.QtWidgets import QWidget, QApplication, QToolTip @@ -168,17 +170,21 @@ boundingRect = textRect.adjusted(-4, 0, 0, 0) polBoundingRect = pol.boundingRect() - if (textRect.width() < - polBoundingRect.width() - 2 * self.__handleSize) and \ - (textRect.height() < - polBoundingRect.height() - 2 * self.__handleSize) and \ - polBoundingRect.width() > 100 and \ - polBoundingRect.height() > 100: + if ( + (textRect.width() < + polBoundingRect.width() - 2 * self.__handleSize) and + (textRect.height() < + polBoundingRect.height() - 2 * self.__handleSize) and + polBoundingRect.width() > 100 and + polBoundingRect.height() > 100 + ): # center, unsuitable for small selections boundingRect.moveCenter(polBoundingRect.center()) textRect.moveCenter(polBoundingRect.center()) - elif polBoundingRect.y() - 3 > textRect.height() and \ - polBoundingRect.x() + textRect.width() < self.rect().width(): + elif ( + polBoundingRect.y() - 3 > textRect.height() and + polBoundingRect.x() + textRect.width() < self.rect().width() + ): # on top, left aligned boundingRect.moveBottomLeft( QPoint(polBoundingRect.x(), polBoundingRect.y() - 3)) @@ -190,17 +196,21 @@ QPoint(polBoundingRect.x() - 3, polBoundingRect.y())) textRect.moveTopRight( QPoint(polBoundingRect.x() - 5, polBoundingRect.y())) - elif (polBoundingRect.bottom() + 3 + textRect.height() < - self.rect().bottom()) and \ - polBoundingRect.right() > textRect.width(): + elif ( + (polBoundingRect.bottom() + 3 + textRect.height() < + self.rect().bottom()) and + polBoundingRect.right() > textRect.width() + ): # at bottom, right aligned boundingRect.moveTopRight( QPoint(polBoundingRect.right(), polBoundingRect.bottom() + 3)) textRect.moveTopRight( QPoint(polBoundingRect.right() - 2, polBoundingRect.bottom() + 3)) - elif polBoundingRect.right() + textRect.width() + 3 < \ - self.rect().width(): + elif ( + polBoundingRect.right() + textRect.width() + 3 < + self.rect().width() + ): # right, bottom aligned boundingRect.moveBottomLeft( QPoint(polBoundingRect.right() + 3, polBoundingRect.bottom())) @@ -212,9 +222,11 @@ drawPolygon(painter, boundingRect, textColor, textBackgroundColor) painter.drawText(textRect, Qt.AlignHCenter, txt) - if (polBoundingRect.height() > self.__handleSize * 2 and - polBoundingRect.width() > self.__handleSize * 2) or \ - not self.__mouseDown: + if ( + (polBoundingRect.height() > self.__handleSize * 2 and + polBoundingRect.width() > self.__handleSize * 2) or + not self.__mouseDown + ): painter.setBrush(Qt.transparent) painter.setClipRegion(QRegion(pol)) painter.drawPolygon(QPolygon(self.rect()))