Commit eac91d7223d3ddf2f0aaa35ff98f32be4b182cf6

Authored by Paulo Henrique Junqueira Amorim
1 parent aef7e95b

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