Fix for win10/qt6 progbar not displaying initially.

This commit is contained in:
Jim Miller 2022-07-28 12:24:35 -05:00
parent fc68c4574a
commit a5832e8d02

View file

@ -662,7 +662,6 @@ class _LoopProgressDialog(QProgressDialog):
self.status_prefix = status_prefix
self.i = 0
self.start_time = datetime.now()
self.first = True
# can't import at file load.
from calibre_plugins.fanficfare_plugin.prefs import prefs
@ -673,7 +672,9 @@ class _LoopProgressDialog(QProgressDialog):
## self.do_loop does QTimer.singleShot on self.do_loop also.
## A weird way to do a loop, but that was the example I had.
QTimer.singleShot(0, self.do_loop)
## 100 instead of 0 on the first go due to Win10(and later
## qt6) not displaying dialog properly.
QTimer.singleShot(100, self.do_loop)
self.exec_()
def updateStatus(self):
@ -689,15 +690,6 @@ class _LoopProgressDialog(QProgressDialog):
def do_loop(self):
if self.first:
## Windows 10 doesn't want to show the prog dialog content
## until after the timer's been called again. Something to
## do with cooperative multi threading maybe?
## So this just trips the timer loop an extra time at the start.
self.first = False
QTimer.singleShot(0, self.do_loop)
return
book = self.book_list[self.i]
try:
## collision spec passed into getadapter by partial from fff_plugin