From 3abf18cc6bcd4df3de5f70eaee884a8ad077bfcb Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Fri, 3 Aug 2018 10:03:16 +0200 Subject: [PATCH] owlouvainclustering: Make the task completion handler a single slot The handlers are invoked with the Qt.QueuedConnection semantics and the first (_processing_complete) advertised to the world that the processing has completed, but the actual send would be done later at an unspecified time. This tripped the `TestOWLouvain.test_clusters_ordered_by_size` test. --- Orange/widgets/unsupervised/owlouvainclustering.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Orange/widgets/unsupervised/owlouvainclustering.py b/Orange/widgets/unsupervised/owlouvainclustering.py index 2bd4c923e90..10738c4252e 100644 --- a/Orange/widgets/unsupervised/owlouvainclustering.py +++ b/Orange/widgets/unsupervised/owlouvainclustering.py @@ -265,8 +265,7 @@ def commit(self): # Prepare callbacks queue.on_progress.connect(lambda val: self.progressBarSet(100 * val)) - queue.on_complete.connect(self._processing_complete) - queue.on_complete.connect(self._send_data) + queue.on_complete.connect(self._on_complete) queue.on_exception.connect(self._handle_exceptions) self.__queue = queue @@ -275,6 +274,10 @@ def commit(self): self.setBlocking(True) self.__future = self.__executor.submit(queue.start) + def _on_complete(self): + self._processing_complete() + self._send_data() + def _send_data(self): if self.partition is None or self.data is None: return