eric6/Snapshot/SnapshotTimer.py

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

eric ide

mercurial