mirror of
https://github.com/ankitects/anki.git
synced 2025-11-09 06:07:11 -05:00
prevent recursive progress dialog invocations
This commit is contained in:
parent
1cfef7a295
commit
bd532500ef
1 changed files with 13 additions and 7 deletions
|
|
@ -2566,23 +2566,29 @@ it to your friends.
|
|||
if self.mainThread != QThread.currentThread():
|
||||
return
|
||||
self.setBusy()
|
||||
if not self.progressWins:
|
||||
parent = self.progressParent or self.app.activeWindow() or self
|
||||
if self.progressWins:
|
||||
parent = self.progressWins[-1].diag
|
||||
p = ui.utils.ProgressWin(parent, max, min, title)
|
||||
else:
|
||||
p = None
|
||||
self.progressWins.append(p)
|
||||
|
||||
def updateProgress(self, label=None, value=None, process=True):
|
||||
if self.mainThread != QThread.currentThread():
|
||||
return
|
||||
if self.progressWins:
|
||||
self.progressWins[-1].update(label, value, process)
|
||||
if len(self.progressWins) == 1:
|
||||
self.progressWins[0].update(label, value, process)
|
||||
else:
|
||||
# just redraw
|
||||
if process:
|
||||
self.app.processEvents()
|
||||
|
||||
def finishProgress(self):
|
||||
if self.mainThread != QThread.currentThread():
|
||||
return
|
||||
if self.progressWins:
|
||||
p = self.progressWins.pop()
|
||||
if p:
|
||||
p.finish()
|
||||
if not self.progressWins:
|
||||
self.unsetBusy()
|
||||
|
|
|
|||
Loading…
Reference in a new issue