Commit eac91d7223d3ddf2f0aaa35ff98f32be4b182cf6
1 parent
aef7e95b
Exists in
master
and in
6 other branches
FIX: Resolved problem change window and level to "default" in 2D preset in the pt_BR, #FIX: 105
Showing
1 changed file
with
31 additions
and
31 deletions
Show diff stats
invesalius/control.py
... | ... | @@ -78,7 +78,7 @@ class Controller(): |
78 | 78 | |
79 | 79 | ########################### |
80 | 80 | ########################### |
81 | - | |
81 | + | |
82 | 82 | def OnShowDialogImportDirectory(self, pubsub_evt): |
83 | 83 | self.ShowDialogImportDirectory() |
84 | 84 | |
... | ... | @@ -96,8 +96,8 @@ class Controller(): |
96 | 96 | |
97 | 97 | def ShowDialogImportDirectory(self): |
98 | 98 | # Offer to save current project if necessary |
99 | - session = ses.Session() | |
100 | - st = session.project_status | |
99 | + session = ses.Session() | |
100 | + st = session.project_status | |
101 | 101 | if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE): |
102 | 102 | filename = session.project_path[1] |
103 | 103 | answer = dialog.SaveChangesDialog2(filename) |
... | ... | @@ -113,11 +113,11 @@ class Controller(): |
113 | 113 | elif dirpath: |
114 | 114 | self.StartImportPanel(dirpath) |
115 | 115 | ps.Publisher().sendMessage("Load data to import panel", dirpath) |
116 | - | |
116 | + | |
117 | 117 | def ShowDialogOpenProject(self): |
118 | 118 | # Offer to save current project if necessary |
119 | - session = ses.Session() | |
120 | - st = session.project_status | |
119 | + session = ses.Session() | |
120 | + st = session.project_status | |
121 | 121 | if (st == const.PROJ_NEW) or (st == const.PROJ_CHANGE): |
122 | 122 | filename = session.project_path[1] |
123 | 123 | answer = dialog.SaveChangesDialog2(filename) |
... | ... | @@ -137,15 +137,15 @@ class Controller(): |
137 | 137 | filepath = dialog.ShowSaveAsProjectDialog(proj.name) |
138 | 138 | if filepath: |
139 | 139 | #session.RemoveTemp() |
140 | - session.OpenProject(filepath) | |
140 | + session.OpenProject(filepath) | |
141 | 141 | else: |
142 | 142 | return |
143 | 143 | else: |
144 | 144 | dirpath, filename = session.project_path |
145 | 145 | filepath = os.path.join(dirpath, filename) |
146 | - | |
146 | + | |
147 | 147 | self.SaveProject(filepath) |
148 | - | |
148 | + | |
149 | 149 | |
150 | 150 | def ShowDialogCloseProject(self): |
151 | 151 | print "ShowDialogCloseProject" |
... | ... | @@ -168,7 +168,7 @@ class Controller(): |
168 | 168 | print "Cancel" |
169 | 169 | else: |
170 | 170 | self.CloseProject() |
171 | - | |
171 | + | |
172 | 172 | ########################### |
173 | 173 | def OnOpenProject(self, pubsub_evt): |
174 | 174 | path = pubsub_evt.data |
... | ... | @@ -210,7 +210,7 @@ class Controller(): |
210 | 210 | proj = prj.Project() |
211 | 211 | proj.Close() |
212 | 212 | |
213 | - ps.Publisher().sendMessage('Hide content panel') | |
213 | + ps.Publisher().sendMessage('Hide content panel') | |
214 | 214 | ps.Publisher().sendMessage('Close project data') |
215 | 215 | |
216 | 216 | session = ses.Session() |
... | ... | @@ -218,19 +218,19 @@ class Controller(): |
218 | 218 | |
219 | 219 | ########################### |
220 | 220 | |
221 | - | |
221 | + | |
222 | 222 | def StartImportPanel(self, path): |
223 | 223 | |
224 | - # retrieve DICOM files splited into groups | |
224 | + # retrieve DICOM files splited into groups | |
225 | 225 | reader = dcm.ProgressDicomReader() |
226 | 226 | reader.SetWindowEvent(self.frame) |
227 | 227 | reader.SetDirectoryPath(path) |
228 | - | |
228 | + | |
229 | 229 | def Progress(self, evt): |
230 | 230 | data = evt.data |
231 | 231 | if (data): |
232 | 232 | message = "Loading file %d of %d"%(data[0],data[1]) |
233 | - | |
233 | + | |
234 | 234 | if (data): |
235 | 235 | if not(self.progress_dialog): |
236 | 236 | self.progress_dialog = dialog.ProgressDialog( |
... | ... | @@ -238,12 +238,12 @@ class Controller(): |
238 | 238 | else: |
239 | 239 | if not(self.progress_dialog.Update(data[0],message)): |
240 | 240 | self.progress_dialog.Close() |
241 | - self.progress_dialog = None | |
241 | + self.progress_dialog = None | |
242 | 242 | else: |
243 | 243 | #Is None if user canceled the load |
244 | 244 | self.progress_dialog.Close() |
245 | 245 | self.progress_dialog = None |
246 | - | |
246 | + | |
247 | 247 | def OnLoadImportPanel(self, evt): |
248 | 248 | patient_series = evt.data |
249 | 249 | ok = self.LoadImportPanel(patient_series) |
... | ... | @@ -251,7 +251,7 @@ class Controller(): |
251 | 251 | ps.Publisher().sendMessage('Show import panel') |
252 | 252 | ps.Publisher().sendMessage("Show import panel in frame") |
253 | 253 | |
254 | - | |
254 | + | |
255 | 255 | def LoadImportPanel(self, patient_series): |
256 | 256 | if patient_series and isinstance(patient_series, list): |
257 | 257 | ps.Publisher().sendMessage("Load import panel", patient_series) |
... | ... | @@ -261,15 +261,15 @@ class Controller(): |
261 | 261 | else: |
262 | 262 | dialog.ImportInvalidFiles() |
263 | 263 | return False |
264 | - | |
264 | + | |
265 | 265 | def OnImportMedicalImages(self, pubsub_evt): |
266 | 266 | directory = pubsub_evt.data |
267 | 267 | self.ImportMedicalImages(directory) |
268 | 268 | |
269 | - def ImportMedicalImages(self, directory): | |
269 | + def ImportMedicalImages(self, directory): | |
270 | 270 | # OPTION 1: DICOM? |
271 | 271 | patients_groups = dcm.GetDicomGroups(directory) |
272 | - | |
272 | + | |
273 | 273 | if len(patients_groups): |
274 | 274 | group = dcm.SelectLargerDicomGroup(patients_groups) |
275 | 275 | imagedata, dicom = self.OpenDicomGroup(group, gui=True) |
... | ... | @@ -290,8 +290,8 @@ class Controller(): |
290 | 290 | |
291 | 291 | const.THRESHOLD_OUTVALUE = proj.threshold_range[0] |
292 | 292 | const.THRESHOLD_INVALUE = proj.threshold_range[1] |
293 | - const.WINDOW_LEVEL['Default'] = (proj.window, proj.level) | |
294 | - const.WINDOW_LEVEL['Manual'] = (proj.window, proj.level) | |
293 | + const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level) | |
294 | + const.WINDOW_LEVEL[_('Manual')] = (proj.window, proj.level) | |
295 | 295 | |
296 | 296 | |
297 | 297 | ps.Publisher().sendMessage('Set project name', proj.name) |
... | ... | @@ -342,12 +342,12 @@ class Controller(): |
342 | 342 | ###### |
343 | 343 | session = ses.Session() |
344 | 344 | filename = proj.name+".inv3" |
345 | - | |
345 | + | |
346 | 346 | filename = filename.replace("/", "") #Fix problem case other/Skull_DICOM |
347 | - | |
347 | + | |
348 | 348 | dirpath = session.CreateProject(filename) |
349 | 349 | proj.SavePlistProject(dirpath, filename) |
350 | - | |
350 | + | |
351 | 351 | |
352 | 352 | |
353 | 353 | def OnOpenDicomGroup(self, pubsub_evt): |
... | ... | @@ -355,7 +355,7 @@ class Controller(): |
355 | 355 | imagedata, dicom = self.OpenDicomGroup(group, gui=True) |
356 | 356 | self.CreateDicomProject(imagedata, dicom) |
357 | 357 | self.LoadProject() |
358 | - | |
358 | + | |
359 | 359 | def OpenDicomGroup(self, dicom_group, gui=True): |
360 | 360 | |
361 | 361 | # Retrieve general DICOM headers |
... | ... | @@ -369,7 +369,7 @@ class Controller(): |
369 | 369 | zspacing = dicom_group.zspacing |
370 | 370 | size = dicom.image.size |
371 | 371 | bits = dicom.image.bits_allocad |
372 | - | |
372 | + | |
373 | 373 | imagedata = utils.CreateImageData(filelist, zspacing, size, bits) |
374 | 374 | |
375 | 375 | # 1(a): Fix gantry tilt, if any |
... | ... | @@ -405,7 +405,7 @@ class Controller(): |
405 | 405 | if label in const.RAYCASTING_FILES.keys(): |
406 | 406 | path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, |
407 | 407 | const.RAYCASTING_FILES[label]) |
408 | - else: | |
408 | + else: | |
409 | 409 | try: |
410 | 410 | path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, |
411 | 411 | label+".plist") |
... | ... | @@ -423,7 +423,7 @@ class Controller(): |
423 | 423 | ps.Publisher().sendMessage("Hide raycasting volume") |
424 | 424 | |
425 | 425 | def SaveRaycastingPreset(self, pubsub_evt): |
426 | - preset_name = pubsub_evt.data | |
426 | + preset_name = pubsub_evt.data | |
427 | 427 | preset = prj.Project().raycasting_preset |
428 | 428 | preset['name'] = preset_name |
429 | 429 | preset_dir = os.path.join(const.USER_RAYCASTING_PRESETS_DIRECTORY, |
... | ... | @@ -433,4 +433,4 @@ class Controller(): |
433 | 433 | |
434 | 434 | |
435 | 435 | |
436 | - | |
436 | + | ... | ... |