IdleMessage moved to Frames
This commit is contained in:
@@ -209,7 +209,8 @@ class PyQt5Gui(Gui):
|
||||
|
||||
self._p.handleKeypressEvent = self.handleKeypressEvent
|
||||
self._lastState = self.showIdle
|
||||
self._p.setCentralWidget(PyQt5IdleMessage())
|
||||
self._p.setCentralWidget(Frames.IdleMessage())
|
||||
# self._p.setCentralWidget(PyQt5IdleMessage())
|
||||
|
||||
|
||||
def showError(self, title, message):
|
||||
@@ -312,35 +313,6 @@ class PyQt5MainWindow(QtWidgets.QMainWindow):
|
||||
|
||||
|
||||
|
||||
|
||||
class PyQt5IdleMessage(QtWidgets.QFrame):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
super().__init__()
|
||||
|
||||
self.initFrame()
|
||||
|
||||
|
||||
def initFrame(self):
|
||||
|
||||
self.setStyleSheet('background-color: black; color: white;')
|
||||
|
||||
|
||||
def paintEvent(self, event):
|
||||
|
||||
painter = QtGui.QPainter(self)
|
||||
|
||||
f = self.font()
|
||||
f.setPixelSize(self.height() / 5)
|
||||
painter.setFont(f)
|
||||
|
||||
painter.drawText(event.rect(), QtCore.Qt.AlignCenter, 'Hit the button!')
|
||||
|
||||
painter.end()
|
||||
|
||||
|
||||
|
||||
class PyQt5GreeterMessage(QtWidgets.QFrame):
|
||||
|
||||
def __init__(self, num_x, num_y):
|
||||
|
||||
@@ -40,6 +40,30 @@ class Start(QtWidgets.QFrame):
|
||||
self.setLayout(lay)
|
||||
|
||||
|
||||
class IdleMessage(QtWidgets.QFrame):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
super().__init__()
|
||||
|
||||
self._message = 'Hit the button!'
|
||||
|
||||
def _paintMessage(self, painter):
|
||||
|
||||
f = self.font()
|
||||
f.setPixelSize(self.height() / 5)
|
||||
painter.setFont(f)
|
||||
|
||||
rect = self.rect()
|
||||
painter.drawText(rect, QtCore.Qt.AlignCenter, self._message)
|
||||
|
||||
def paintEvent(self, event):
|
||||
|
||||
painter = QtGui.QPainter(self)
|
||||
self._paintMessage(painter)
|
||||
painter.end()
|
||||
|
||||
|
||||
class WaitMessage(QtWidgets.QFrame):
|
||||
# With spinning wait clock, inspired by
|
||||
# https://wiki.python.org/moin/PyQt/A%20full%20widget%20waiting%20indicator
|
||||
|
||||
Reference in New Issue
Block a user