Skip to content

Commit

Permalink
Better fix for QueuedConnection issue
Browse files Browse the repository at this point in the history
I think this works better... for some reason, we need to accept
the progress as part of the QueuedConnection for PySide6.

Signed-off-by: Patrick Avery <[email protected]>
  • Loading branch information
psavery committed Oct 13, 2023
1 parent dac71e3 commit 87ceded
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions hexrd/ui/indexing/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def __init__(self, parent=None):

def setup_connections(self):
self.progress_text.connect(self.progress_dialog.setLabelText)
self.accept_progress_signal.connect(self.progress_dialog.accept,
Qt.QueuedConnection)
self.accept_progress_signal.connect(self.progress_dialog.accept)

def update_progress_text(self, text):
self.progress_text.emit(text)
Expand Down Expand Up @@ -322,9 +321,13 @@ def indexer_finished(self):
worker = AsyncWorker(self.run_cluster_functions)
self.thread_pool.start(worker)

worker.signals.result.connect(self.confirm_indexing_results,
Qt.QueuedConnection)
worker.signals.finished.connect(self.accept_progress)
def on_finished():
# Since this is a QueuedConnection, we must accept the progress
# before proceeding.
self.accept_progress()
self.confirm_indexing_results()

worker.signals.result.connect(on_finished, Qt.QueuedConnection)
worker.signals.error.connect(self.on_async_error)

@property
Expand Down Expand Up @@ -388,8 +391,6 @@ def generate_grains_table(self):
self.grains_table)

def confirm_indexing_results(self):
# FIXME: why is accepting the progress necessary here?
self.accept_progress()
if self.grains_table is None:
msg = 'No grains found'
QMessageBox.critical(self.parent, msg, msg)
Expand Down

0 comments on commit 87ceded

Please sign in to comment.