Commit 8e5e0d4f4aeaa7d141feb1a6f26908dbd736ffa9
1 parent
14306460
Exists in
master
and in
6 other branches
FIX: Import / cancel problem
Showing
4 changed files
with
15 additions
and
23 deletions
Show diff stats
invesalius/control.py
@@ -29,7 +29,7 @@ import project as prj | @@ -29,7 +29,7 @@ import project as prj | ||
29 | import data.imagedata_utils as utils | 29 | import data.imagedata_utils as utils |
30 | import data.surface as surface | 30 | import data.surface as surface |
31 | import data.volume as volume | 31 | import data.volume as volume |
32 | -import reader.dicom_grouper | 32 | +import reader.dicom_grouper as dg |
33 | import gui.dialogs as dialog | 33 | import gui.dialogs as dialog |
34 | import reader.dicom_reader as dcm | 34 | import reader.dicom_reader as dcm |
35 | import reader.analyze_reader as analyze | 35 | import reader.analyze_reader as analyze |
@@ -59,22 +59,20 @@ class Controller(): | @@ -59,22 +59,20 @@ class Controller(): | ||
59 | ps.Publisher().subscribe(self.Progress, "Update dicom load") | 59 | ps.Publisher().subscribe(self.Progress, "Update dicom load") |
60 | ps.Publisher().subscribe(self.OnLoadImportPanel, "End dicom load") | 60 | ps.Publisher().subscribe(self.OnLoadImportPanel, "End dicom load") |
61 | ps.Publisher().subscribe(self.OnCancelImport, 'Cancel DICOM load') | 61 | ps.Publisher().subscribe(self.OnCancelImport, 'Cancel DICOM load') |
62 | - ps.Publisher().subscribe(self.OnLoadImportPanel, "Show import panel in frame") | 62 | + |
63 | 63 | ||
64 | def OnCancelImport(self, pubsub_evt): | 64 | def OnCancelImport(self, pubsub_evt): |
65 | - self.cancel_import = True | 65 | + #self.cancel_import = True |
66 | + ps.Publisher().sendMessage('Hide import panel') | ||
66 | 67 | ||
67 | def StartImportPanel(self, pubsub_evt): | 68 | def StartImportPanel(self, pubsub_evt): |
68 | # path to directory | 69 | # path to directory |
69 | path = pubsub_evt.data | 70 | path = pubsub_evt.data |
70 | - # retrieve DICOM files splited into groups | ||
71 | - | 71 | + |
72 | + # retrieve DICOM files splited into groups | ||
72 | reader = dcm.ProgressDicomReader() | 73 | reader = dcm.ProgressDicomReader() |
73 | reader.SetWindowEvent(self.frame) | 74 | reader.SetWindowEvent(self.frame) |
74 | reader.SetDirectoryPath(path) | 75 | reader.SetDirectoryPath(path) |
75 | - | ||
76 | - #self.frame.Bind(reader.evt_update_progress, self.Progress) | ||
77 | - #self.frame.Bind(reader.evt_end_load_file, self.LoadPanel) | ||
78 | 76 | ||
79 | def Progress(self, evt): | 77 | def Progress(self, evt): |
80 | data = evt.data | 78 | data = evt.data |
@@ -97,16 +95,13 @@ class Controller(): | @@ -97,16 +95,13 @@ class Controller(): | ||
97 | 95 | ||
98 | def OnLoadImportPanel(self, evt): | 96 | def OnLoadImportPanel(self, evt): |
99 | patient_series = evt.data | 97 | patient_series = evt.data |
100 | - if not self.cancel_import: | ||
101 | - self.LoadImportPanel(patient_series) | ||
102 | - ps.Publisher().sendMessage('Show import panel') | ||
103 | - else: | ||
104 | - print "----- hide" | ||
105 | - self.cancel_import = False | ||
106 | - ps.Publisher().sendMessage('Hide import panel') | 98 | + self.LoadImportPanel(patient_series) |
99 | + ps.Publisher().sendMessage('Show import panel') | ||
100 | + ps.Publisher().sendMessage("Show import panel in frame") | ||
101 | + | ||
107 | 102 | ||
108 | def LoadImportPanel(self, patient_series): | 103 | def LoadImportPanel(self, patient_series): |
109 | - if patient_series: | 104 | + if isinstance(patient_series, list): |
110 | ps.Publisher().sendMessage("Load import panel", patient_series) | 105 | ps.Publisher().sendMessage("Load import panel", patient_series) |
111 | first_patient = patient_series[0] | 106 | first_patient = patient_series[0] |
112 | ps.Publisher().sendMessage("Load dicom preview", first_patient) | 107 | ps.Publisher().sendMessage("Load dicom preview", first_patient) |
invesalius/gui/frame.py
@@ -167,8 +167,7 @@ class Frame(wx.Frame): | @@ -167,8 +167,7 @@ class Frame(wx.Frame): | ||
167 | self.aui_manager = aui_manager | 167 | self.aui_manager = aui_manager |
168 | 168 | ||
169 | def ShowImportPanel(self, evt_pubsub): | 169 | def ShowImportPanel(self, evt_pubsub): |
170 | - path = evt_pubsub.data | ||
171 | - ps.Publisher().sendMessage("Load data to import panel", path) | 170 | + #ps.Publisher().sendMessage("Load data to import panel", path) |
172 | 171 | ||
173 | aui_manager = self.aui_manager | 172 | aui_manager = self.aui_manager |
174 | aui_manager.GetPane("Import").Show(1) | 173 | aui_manager.GetPane("Import").Show(1) |
@@ -178,8 +177,6 @@ class Frame(wx.Frame): | @@ -178,8 +177,6 @@ class Frame(wx.Frame): | ||
178 | 177 | ||
179 | def HideImportPanel(self, evt_pubsub): | 178 | def HideImportPanel(self, evt_pubsub): |
180 | print "HideImportPanel" | 179 | print "HideImportPanel" |
181 | - path = evt_pubsub.data | ||
182 | - #ps.Publisher().sendMessage("Load data to import panel", path) | ||
183 | 180 | ||
184 | aui_manager = self.aui_manager | 181 | aui_manager = self.aui_manager |
185 | aui_manager.GetPane("Import").Show(0) | 182 | aui_manager.GetPane("Import").Show(0) |
invesalius/gui/task_importer.py
@@ -149,7 +149,7 @@ class InnerTaskPanel(wx.Panel): | @@ -149,7 +149,7 @@ class InnerTaskPanel(wx.Panel): | ||
149 | 149 | ||
150 | if dlg.ShowModal() == wx.ID_OK: | 150 | if dlg.ShowModal() == wx.ID_OK: |
151 | path = dlg.GetPath() | 151 | path = dlg.GetPath() |
152 | - ps.Publisher().sendMessage("Show import panel in frame", path) | 152 | + ps.Publisher().sendMessage("Load data to import panel", path) |
153 | 153 | ||
154 | # Only destroy a dialog after you're done with it. | 154 | # Only destroy a dialog after you're done with it. |
155 | dlg.Destroy() | 155 | dlg.Destroy() |
invesalius/reader/dicom_reader.py
@@ -141,8 +141,8 @@ class ProgressDicomReader: | @@ -141,8 +141,8 @@ class ProgressDicomReader: | ||
141 | def UpdateLoadFileProgress(self,cont_progress): | 141 | def UpdateLoadFileProgress(self,cont_progress): |
142 | ps.Publisher().sendMessage("Update dicom load", cont_progress) | 142 | ps.Publisher().sendMessage("Update dicom load", cont_progress) |
143 | 143 | ||
144 | - def EndLoadFile(self, grouper): | ||
145 | - ps.Publisher().sendMessage("End dicom load", grouper) | 144 | + def EndLoadFile(self, patient_list): |
145 | + ps.Publisher().sendMessage("End dicom load", patient_list) | ||
146 | 146 | ||
147 | def GetDicomGroups(self, path, recursive): | 147 | def GetDicomGroups(self, path, recursive): |
148 | 148 |