Mon, 04 Jan 2021 19:34:49 +0100
Snapshot Widget: fixed the modified snapshot function for multiple screens.
--- a/eric6/Snapshot/SnapshotDefaultGrabber.py Mon Jan 04 16:52:56 2021 +0100 +++ b/eric6/Snapshot/SnapshotDefaultGrabber.py Mon Jan 04 19:34:49 2021 +0100 @@ -8,8 +8,8 @@ """ from PyQt5.QtCore import pyqtSignal, Qt, QObject, QTimer, QEvent -from PyQt5.QtGui import QPixmap, QCursor -from PyQt5.QtWidgets import QWidget, QApplication +from PyQt5.QtGui import QPixmap, QCursor, QGuiApplication +from PyQt5.QtWidgets import QWidget from .SnapshotModes import SnapshotModes @@ -147,10 +147,15 @@ self.__grabTimer.stop() if mode == SnapshotModes.Fullscreen: - snapshot = QApplication.screens()[0].grabWindow(0) + screen = QGuiApplication.screens()[0] + vgeom = screen.availableVirtualGeometry() + snapshot = screen.grabWindow( + 0, vgeom.x(), vgeom.y(), vgeom.width(), vgeom.height()) elif mode == SnapshotModes.SelectedScreen: - screen = QApplication.screenAt(QCursor.pos()) - snapshot = screen.grabWindow(0) + screen = QGuiApplication.screenAt(QCursor.pos()) + sgeom = screen.geometry() + snapshot = screen.grabWindow( + 0, sgeom.x(), sgeom.y(), sgeom.width(), sgeom.height()) else: snapshot = QPixmap()
--- a/eric6/Snapshot/SnapshotFreehandGrabber.py Mon Jan 04 16:52:56 2021 +0100 +++ b/eric6/Snapshot/SnapshotFreehandGrabber.py Mon Jan 04 19:34:49 2021 +0100 @@ -10,9 +10,9 @@ from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale from PyQt5.QtGui import ( QPixmap, QColor, QRegion, QPainter, QPalette, QPolygon, QPen, QBrush, - QPaintEngine + QPaintEngine, QGuiApplication, QCursor ) -from PyQt5.QtWidgets import QWidget, QApplication, QToolTip +from PyQt5.QtWidgets import QWidget, QToolTip def drawPolygon(painter, polygon, outline, fill=None): @@ -82,9 +82,14 @@ """ Private slot to initialize the rest of the widget. """ - self.__pixmap = QApplication.screens()[0].grabWindow(0) + screen = QGuiApplication.screens()[0] + self.__virtualGeometrie = screen.availableVirtualGeometry() + screen = QGuiApplication.screenAt(QCursor.pos()) + sgeom = screen.geometry() + self.__pixmap = screen.grabWindow( + 0, sgeom.x(), sgeom.y(), sgeom.width(), sgeom.height()) self.resize(self.__pixmap.size()) - self.move(0, 0) + self.move(sgeom.x(), sgeom.y()) self.setCursor(Qt.CrossCursor) self.show()
--- a/eric6/Snapshot/SnapshotRegionGrabber.py Mon Jan 04 16:52:56 2021 +0100 +++ b/eric6/Snapshot/SnapshotRegionGrabber.py Mon Jan 04 19:34:49 2021 +0100 @@ -9,9 +9,10 @@ from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale from PyQt5.QtGui import ( - QPixmap, QColor, QRegion, QPainter, QPalette, QPaintEngine, QPen, QBrush + QPixmap, QColor, QRegion, QPainter, QPalette, QPaintEngine, QPen, QBrush, + QGuiApplication, QCursor ) -from PyQt5.QtWidgets import QWidget, QApplication, QToolTip +from PyQt5.QtWidgets import QWidget, QToolTip def drawRect(painter, rect, outline, fill=None): @@ -112,9 +113,14 @@ """ Private slot to initialize the rest of the widget. """ - self.__pixmap = QApplication.screens()[0].grabWindow(0) + screen = QGuiApplication.screens()[0] + self.__virtualGeometrie = screen.availableVirtualGeometry() + screen = QGuiApplication.screenAt(QCursor.pos()) + sgeom = screen.geometry() + self.__pixmap = screen.grabWindow( + 0, sgeom.x(), sgeom.y(), sgeom.width(), sgeom.height()) self.resize(self.__pixmap.size()) - self.move(0, 0) + self.move(sgeom.x(), sgeom.y()) self.setCursor(Qt.CrossCursor) self.show()
--- a/eric6/Snapshot/SnapshotWaylandGrabber.py Mon Jan 04 16:52:56 2021 +0100 +++ b/eric6/Snapshot/SnapshotWaylandGrabber.py Mon Jan 04 19:34:49 2021 +0100 @@ -56,22 +56,20 @@ @rtype tuple of SnapshotModes """ if DBusAvailable and Globals.isKdeDesktop(): - modes = ( + return ( SnapshotModes.Fullscreen, SnapshotModes.SelectedScreen, SnapshotModes.SelectedWindow, ) elif DBusAvailable and Globals.isGnomeDesktop(): - modes = ( + return ( SnapshotModes.Fullscreen, SnapshotModes.SelectedScreen, SnapshotModes.SelectedWindow, SnapshotModes.Rectangle, ) else: - modes = () - - return modes + return () def grab(self, mode, delay=0, captureCursor=False, captureDecorations=False):