Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions PyReconstruct/modules/backend/threading/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Signal,
QObject,
QThreadPool,
QEventLoop,
Qt
)

Expand Down Expand Up @@ -140,13 +141,19 @@ def startAll(self, text="", status_bar=None):

counter = MemoryInt()
for worker in self.workers:
QApplication.processEvents()
QApplication.processEvents(QEventLoop.ExcludeUserInputEvents)
worker.signals.finished.connect(counter.inc)
worker.signals.finished.connect(lambda : progbar.setValue(counter.n))
self.start(worker)

# Hold keyboard and mouse input until the workers finish. The workers
# read section files and series attributes while this loop runs; an
# undo, redo or any other edit let through here rewrites those files
# under them, and the result is built from a mix of old and new data.
# Posted events (worker signals, repaints) still get through, so the
# progress indicator keeps moving. Held input is delivered afterwards.
while counter.n < final_value:
QApplication.processEvents()
QApplication.processEvents(QEventLoop.ExcludeUserInputEvents)

if maximum == 0:
progbar.close()
Expand Down
Loading