Snapshot/SnapshotTimer.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3030
4a0a82ddd9d2
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
99 textColor = pal.color(QPalette.Active, QPalette.Base) 99 textColor = pal.color(QPalette.Active, QPalette.Base)
100 painter.setPen(textColor) 100 painter.setPen(textColor)
101 painter.setBrush(textBackgroundColor) 101 painter.setBrush(textBackgroundColor)
102 helpText = self.trUtf8("Snapshot will be taken in %n seconds", "", 102 helpText = self.trUtf8("Snapshot will be taken in %n seconds", "",
103 self.__length - self.__time) 103 self.__length - self.__time)
104 textRect = painter.boundingRect(self.rect().adjusted(2, 2, -2, -2), 104 textRect = painter.boundingRect(
105 self.rect().adjusted(2, 2, -2, -2),
105 Qt.AlignHCenter | Qt.TextSingleLine, helpText) 106 Qt.AlignHCenter | Qt.TextSingleLine, helpText)
106 painter.drawText(textRect, Qt.AlignHCenter | Qt.TextSingleLine, 107 painter.drawText(textRect, Qt.AlignHCenter | Qt.TextSingleLine,
107 helpText) 108 helpText)
108 109
109 def enterEvent(self, evt): 110 def enterEvent(self, evt):
113 @param evt enter event (QEvent) 114 @param evt enter event (QEvent)
114 """ 115 """
115 screenGeom = QApplication.desktop().screenGeometry() 116 screenGeom = QApplication.desktop().screenGeometry()
116 if self.x() == screenGeom.left(): 117 if self.x() == screenGeom.left():
117 self.move( 118 self.move(
118 screenGeom.x() + (screenGeom.width() // 2 - \ 119 screenGeom.x() +
119 self.size().width() // 2), 120 (screenGeom.width() // 2 - self.size().width() // 2),
120 screenGeom.top()) 121 screenGeom.top())
121 else: 122 else:
122 self.move(screenGeom.topLeft()) 123 self.move(screenGeom.topLeft())

eric ide

mercurial