Quote:
Originally Posted by kovidgoyal
I'm surprised this ever worked. In Qt the "correct" way to update the UI while also busy looping in the GUI thread is to periodically call QApplication.processEvents(ExcludeUserInputEvents)
You can do that after every call to update the status bar. Repainting it directly should also work provided you are careful to ensure no recursion occurs. I wont accept a PR to have show_message() repaint directly because this is dangeroud, if a user of show_message() happens to call it froma paintEvent, it can lead to infinite recursion and a crash.
|
Thanks. I figured there was probably a better way, but I didn't know what it was.
For the record, this appears to work from Calibre 2.85.1 forward:
Code:
from PyQt5.Qt import (QApplication, QEventLoop)
#...
self.gui.status_bar.show_message('message')
QApplication.processEvents(QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
timeout param still doesn't work, but since to whole point (for me) is "Doing" ... "Done", that's fine.
BTW, I went back and checked--it definitely worked in 2.85.1.