8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, qVersion |
10 from PyQt4.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, qVersion |
11 from PyQt4.QtGui import QWidget, QPixmap, QColor, QRegion, QApplication, QPainter, \ |
11 from PyQt4.QtGui import QWidget, QPixmap, QColor, QRegion, QApplication, QPainter, \ |
12 QPalette, QToolTip, QPolygon, QPen, QBrush, QPaintEngine |
12 QPalette, QToolTip, QPolygon, QPen, QBrush, QPaintEngine |
13 if qVersion() >= "5.0.0": |
|
14 from PyQt4.QtGui import QScreen |
|
15 |
13 |
16 |
14 |
17 def drawPolygon(painter, polygon, outline, fill=QColor()): |
15 def drawPolygon(painter, polygon, outline, fill=QColor()): |
18 """ |
16 """ |
19 Module function to draw a polygon with the given parameters. |
17 Module function to draw a polygon with the given parameters. |
81 """ |
79 """ |
82 self.__desktop = QApplication.desktop() |
80 self.__desktop = QApplication.desktop() |
83 x = self.__desktop.x() |
81 x = self.__desktop.x() |
84 y = self.__desktop.y() |
82 y = self.__desktop.y() |
85 if qVersion() >= "5.0.0": |
83 if qVersion() >= "5.0.0": |
86 self.__pixmap = QScreen.grabWindow(self.__desktop.winId(), x, y, |
84 self.__pixmap = QApplication.screens()[0].grabWindow( |
|
85 self.__desktop.winId(), x, y, |
87 self.__desktop.width(), self.__desktop.height()) |
86 self.__desktop.width(), self.__desktop.height()) |
88 else: |
87 else: |
89 self.__pixmap = QPixmap.grabWindow(self.__desktop.winId(), x, y, |
88 self.__pixmap = QPixmap.grabWindow(self.__desktop.winId(), x, y, |
90 self.__desktop.width(), self.__desktop.height()) |
89 self.__desktop.width(), self.__desktop.height()) |
91 self.resize(self.__pixmap.size()) |
90 self.resize(self.__pixmap.size()) |