diff --git a/Orange/widgets/data/owcsvimport.py b/Orange/widgets/data/owcsvimport.py index b50c07200d0..4b99ede35c9 100644 --- a/Orange/widgets/data/owcsvimport.py +++ b/Orange/widgets/data/owcsvimport.py @@ -831,8 +831,8 @@ def commit(self): task = state = TaskState() state.future = ... state.watcher = qconcurrent.FutureWatcher() - state.progressChanged.connect(self.__set_read_progress, - Qt.QueuedConnection) + state.progressChanged.connect( + self.__set_read_progress, Qt.DirectConnection) def progress_(i, j): task.emitProgressChangedOrCancel(i, j) @@ -1298,9 +1298,16 @@ class UserCancelException(BaseException): #: progress state, second value is the total progress to complete #: (-1 if unknown) progressChanged = Signal('qint64', 'qint64') + __progressChanged = Signal('qint64', 'qint64') #: Was cancel requested. cancel = False + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # route the signal via this object's queue + self.__progressChanged.connect( + self.progressChanged, Qt.QueuedConnection) + def emitProgressChangedOrCancel(self, current, total): # type: (int, int) -> None """ @@ -1309,7 +1316,7 @@ def emitProgressChangedOrCancel(self, current, total): if self.cancel: raise TaskState.UserCancelException() else: - self.progressChanged.emit(current, total) + self.__progressChanged.emit(current, total) class TextReadWrapper(io.TextIOWrapper):