mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 21:24:36 +00:00
Fixed progress under Qt which always cancelled the job
This commit is contained in:
parent
21c64545e5
commit
2fe5cdcf02
@ -22,9 +22,8 @@ class ProgressWindow(QProgressDialog):
|
|||||||
self.setModal(True)
|
self.setModal(True)
|
||||||
self.setAutoReset(False)
|
self.setAutoReset(False)
|
||||||
self.setAutoClose(False)
|
self.setAutoClose(False)
|
||||||
self._timer = QTimer()
|
self._timer = QTimer(self)
|
||||||
self._timer.timeout.connect(self.model.pulse)
|
self._timer.timeout.connect(self.model.pulse)
|
||||||
self.canceled.connect(self.model.cancel)
|
|
||||||
|
|
||||||
# --- Callbacks
|
# --- Callbacks
|
||||||
def refresh(self): # Labels
|
def refresh(self): # Labels
|
||||||
@ -35,10 +34,15 @@ class ProgressWindow(QProgressDialog):
|
|||||||
self.setValue(last_progress)
|
self.setValue(last_progress)
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
|
self.reset()
|
||||||
QProgressDialog.show(self)
|
QProgressDialog.show(self)
|
||||||
|
self.canceled.connect(self.model.cancel)
|
||||||
self._timer.start(500)
|
self._timer.start(500)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self._timer.stop()
|
self._timer.stop()
|
||||||
|
# For some weird reason, canceled() signal is sent upon close, whether the user canceled
|
||||||
|
# or not. If we don't want a false cancellation, we have to disconnect it.
|
||||||
|
self.canceled.disconnect()
|
||||||
QProgressDialog.close(self)
|
QProgressDialog.close(self)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user