From 0586bd4a59ee2ce183db02c995ce60a3b57f1f3e Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Mon, 19 Oct 2009 11:44:42 +0000 Subject: [PATCH] ENH: Using generator instead of thread to update the progressdialog --- invesalius/reader/dicom_reader.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/invesalius/reader/dicom_reader.py b/invesalius/reader/dicom_reader.py index 8c5d4b4..b4a95a8 100644 --- a/invesalius/reader/dicom_reader.py +++ b/invesalius/reader/dicom_reader.py @@ -141,7 +141,7 @@ class ProgressDicomReader: def SetDirectoryPath(self, path,recursive=True): self.running = True self.stoped = False - thread.start_new_thread(self.GetDicomGroups,(path,recursive)) + self.GetDicomGroups(path,recursive) def UpdateLoadFileProgress(self,cont_progress): ps.Publisher().sendMessage("Update dicom load", cont_progress) @@ -155,17 +155,16 @@ class ProgressDicomReader: def GetDicomGroups(self, path, recursive): y = yGetDicomGroups(path, recursive) - while self.running: - value_progress = y.next() + #while self.running: + for value_progress in y: if isinstance(value_progress, tuple): self.UpdateLoadFileProgress(value_progress) else: self.EndLoadFile(value_progress) - self.running = False #Is necessary in the case user cancel #the load, ensure that dicomdialog is closed if(self.stoped): self.UpdateLoadFileProgress(None) self.stoped = False - \ No newline at end of file + -- libgit2 0.21.2