11 |
11 |
12 from PyQt5.QtCore import pyqtSignal, Qt, QTimer, QRect |
12 from PyQt5.QtCore import pyqtSignal, Qt, QTimer, QRect |
13 from PyQt5.QtGui import QPainter, QPalette |
13 from PyQt5.QtGui import QPainter, QPalette |
14 from PyQt5.QtWidgets import QWidget, QApplication, QToolTip |
14 from PyQt5.QtWidgets import QWidget, QApplication, QToolTip |
15 |
15 |
|
16 from Globals import qVersionTuple |
16 |
17 |
17 class SnapshotTimer(QWidget): |
18 class SnapshotTimer(QWidget): |
18 """ |
19 """ |
19 Class implementing the snapshot timer widget. |
20 Class implementing the snapshot timer widget. |
20 |
21 |
49 """ |
50 """ |
50 Public method to start the timer. |
51 Public method to start the timer. |
51 |
52 |
52 @param seconds timeout value (integer) |
53 @param seconds timeout value (integer) |
53 """ |
54 """ |
54 screenGeom = QApplication.desktop().screenGeometry() |
55 if qVersionTuple() >= (5, 10, 0): |
|
56 screenGeom = QApplication.screens()[0].geometry() |
|
57 else: |
|
58 screenGeom = QApplication.desktop().screenGeometry() |
55 self.move(screenGeom.width() // 2 - self.size().width() // 2, |
59 self.move(screenGeom.width() // 2 - self.size().width() // 2, |
56 screenGeom.top()) |
60 screenGeom.top()) |
57 self.__toggle = True |
61 self.__toggle = True |
58 self.__time = 0 |
62 self.__time = 0 |
59 self.__length = seconds |
63 self.__length = seconds |
112 """ |
116 """ |
113 Protected method handling the mouse cursor entering the widget. |
117 Protected method handling the mouse cursor entering the widget. |
114 |
118 |
115 @param evt enter event (QEvent) |
119 @param evt enter event (QEvent) |
116 """ |
120 """ |
117 screenGeom = QApplication.desktop().screenGeometry() |
121 if qVersionTuple() >= (5, 10, 0): |
|
122 screenGeom = QApplication.screens()[0].geometry() |
|
123 else: |
|
124 screenGeom = QApplication.desktop().screenGeometry() |
118 if self.x() == screenGeom.left(): |
125 if self.x() == screenGeom.left(): |
119 self.move( |
126 self.move( |
120 screenGeom.x() + |
127 screenGeom.x() + |
121 (screenGeom.width() // 2 - self.size().width() // 2), |
128 (screenGeom.width() // 2 - self.size().width() // 2), |
122 screenGeom.top()) |
129 screenGeom.top()) |