mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix loading overlay messages not wrapping
This commit is contained in:
parent
c6c7400105
commit
2f76e4a540
@ -11,15 +11,19 @@ from calibre.gui2.progress_indicator import ProgressIndicator
|
||||
|
||||
class LoadingOverlay(QWidget):
|
||||
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.l = l = QVBoxLayout(self)
|
||||
self.pi = ProgressIndicator(self, 96, 80)
|
||||
self.setVisible(False)
|
||||
self.label = QLabel(self)
|
||||
self.label.setText('<i>testing')
|
||||
self.label.setText('<i>testing with some long and wrap worthy message that should hopefully still render well')
|
||||
self.label.setTextFormat(Qt.RichText)
|
||||
self.label.setAlignment(Qt.AlignTop | Qt.AlignHCenter)
|
||||
self.label.setWordWrap(True)
|
||||
if parent is None:
|
||||
self.resize(300, 300)
|
||||
else:
|
||||
self.resize(parent.size())
|
||||
self.setAutoFillBackground(True)
|
||||
pal = self.palette()
|
||||
@ -61,3 +65,11 @@ class LoadingOverlay(QWidget):
|
||||
# import time
|
||||
# print(1111111, time.monotonic() - self.st)
|
||||
self.pi.stop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from calibre.gui2 import Application
|
||||
app = Application([])
|
||||
w = LoadingOverlay()
|
||||
w.show()
|
||||
app.exec_()
|
||||
|
Loading…
x
Reference in New Issue
Block a user