fixes to progress window

- make sure _shown reset to False on finish()
- ignore calls to .update() after finish() called, which can happen with
async signals in the sync code
This commit is contained in:
Damien Elmes 2018-01-14 12:16:47 +10:00
parent 9bc0e99e2c
commit 1c390218fc

View file

@ -134,10 +134,12 @@ class ProgressManager:
return return
if maybeShow: if maybeShow:
self._maybeShow() self._maybeShow()
if not self._shown:
return
elapsed = time.time() - self._lastUpdate elapsed = time.time() - self._lastUpdate
if label: if label:
self._win.form.label.setText(label) self._win.form.label.setText(label)
if self._max and self._shown: if self._max:
self._counter = value or (self._counter+1) self._counter = value or (self._counter+1)
self._win.form.progressBar.setValue(self._counter) self._win.form.progressBar.setValue(self._counter)
if process and elapsed >= 0.2: if process and elapsed >= 0.2:
@ -187,6 +189,7 @@ class ProgressManager:
self.app.processEvents(QEventLoop.ExcludeUserInputEvents) self.app.processEvents(QEventLoop.ExcludeUserInputEvents)
self._win.cancel() self._win.cancel()
self._win = None self._win = None
self._shown = False
self._unsetBusy() self._unsetBusy()
def _setBusy(self): def _setBusy(self):