Commit 040d3ec0666228b56fa1e9f181e39d463d0e4d99

Authored by Paulo Henrique Junqueira Amorim
1 parent 254789ee

FIX: Error in the Windows XP. Case import dicom from gui and generate surface.

Showing 1 changed file with 12 additions and 5 deletions   Show diff stats
invesalius/gui/dialogs.py
@@ -135,7 +135,7 @@ WILDCARD_OPEN = "InVesalius 3 project (*.inv3)|*.inv3|"\ @@ -135,7 +135,7 @@ WILDCARD_OPEN = "InVesalius 3 project (*.inv3)|*.inv3|"\
135 135
136 def ShowOpenProjectDialog(): 136 def ShowOpenProjectDialog():
137 # Default system path 137 # Default system path
138 - 138 + current_dir = os.path.abspath(".")
139 dlg = wx.FileDialog(None, message="Open InVesalius 3 project...", 139 dlg = wx.FileDialog(None, message="Open InVesalius 3 project...",
140 defaultDir="", 140 defaultDir="",
141 defaultFile="", wildcard=WILDCARD_OPEN, 141 defaultFile="", wildcard=WILDCARD_OPEN,
@@ -157,9 +157,11 @@ def ShowOpenProjectDialog(): @@ -157,9 +157,11 @@ def ShowOpenProjectDialog():
157 # Destroy the dialog. Don't do this until you are done with it! 157 # Destroy the dialog. Don't do this until you are done with it!
158 # BAD things can happen otherwise! 158 # BAD things can happen otherwise!
159 dlg.Destroy() 159 dlg.Destroy()
  160 + os.chdir(current_dir)
160 return filepath 161 return filepath
161 162
162 def ShowImportDirDialog(): 163 def ShowImportDirDialog():
  164 + current_dir = os.path.abspath(".")
163 dlg = wx.DirDialog(None, "Choose a DICOM folder:", "", 165 dlg = wx.DirDialog(None, "Choose a DICOM folder:", "",
164 style=wx.DD_DEFAULT_STYLE 166 style=wx.DD_DEFAULT_STYLE
165 | wx.DD_DIR_MUST_EXIST 167 | wx.DD_DIR_MUST_EXIST
@@ -171,9 +173,11 @@ def ShowImportDirDialog(): @@ -171,9 +173,11 @@ def ShowImportDirDialog():
171 173
172 # Only destroy a dialog after you're done with it. 174 # Only destroy a dialog after you're done with it.
173 dlg.Destroy() 175 dlg.Destroy()
  176 + os.chdir(current_dir)
174 return path 177 return path
175 178
176 def ShowSaveAsProjectDialog(default_filename=None): 179 def ShowSaveAsProjectDialog(default_filename=None):
  180 + current_dir = os.path.abspath(".")
177 dlg = wx.FileDialog(None, 181 dlg = wx.FileDialog(None,
178 "Save project as...", # title 182 "Save project as...", # title
179 "", # last used directory 183 "", # last used directory
@@ -189,6 +193,8 @@ def ShowSaveAsProjectDialog(default_filename=None): @@ -189,6 +193,8 @@ def ShowSaveAsProjectDialog(default_filename=None):
189 if sys.platform != 'win32': 193 if sys.platform != 'win32':
190 if filename.split(".")[-1] != extension: 194 if filename.split(".")[-1] != extension:
191 filename = filename + "." + extension 195 filename = filename + "." + extension
  196 +
  197 + os.chdir(current_dir)
192 return filename 198 return filename
193 199
194 200
@@ -253,7 +259,7 @@ def SaveChangesDialog__Old(filename): @@ -253,7 +259,7 @@ def SaveChangesDialog__Old(filename):
253 259
254 260
255 def SaveChangesDialog(filename): 261 def SaveChangesDialog(filename):
256 - 262 + current_dir = os.path.abspath(".")
257 if sys.platform == 'darwin': 263 if sys.platform == 'darwin':
258 dlg = wx.MessageDialog(None, "", 264 dlg = wx.MessageDialog(None, "",
259 "Save changes to "+filename+"?", 265 "Save changes to "+filename+"?",
@@ -265,7 +271,8 @@ def SaveChangesDialog(filename): @@ -265,7 +271,8 @@ def SaveChangesDialog(filename):
265 271
266 answer = dlg.ShowModal() 272 answer = dlg.ShowModal()
267 dlg.Destroy() 273 dlg.Destroy()
268 - 274 + os.chdir(current_dir)
  275 +
269 if answer == wx.ID_YES: 276 if answer == wx.ID_YES:
270 return 1 277 return 1
271 elif answer == wx.ID_NO: 278 elif answer == wx.ID_NO:
@@ -274,7 +281,7 @@ def SaveChangesDialog(filename): @@ -274,7 +281,7 @@ def SaveChangesDialog(filename):
274 return -1 281 return -1
275 282
276 def SaveChangesDialog2(filename): 283 def SaveChangesDialog2(filename):
277 - 284 + current_dir = os.path.abspath(".")
278 if sys.platform == 'darwin': 285 if sys.platform == 'darwin':
279 dlg = wx.MessageDialog(None, "", 286 dlg = wx.MessageDialog(None, "",
280 "Save changes to "+filename+"?", 287 "Save changes to "+filename+"?",
@@ -286,7 +293,7 @@ def SaveChangesDialog2(filename): @@ -286,7 +293,7 @@ def SaveChangesDialog2(filename):
286 293
287 answer = dlg.ShowModal() 294 answer = dlg.ShowModal()
288 dlg.Destroy() 295 dlg.Destroy()
289 - 296 + os.chdir(current_dir)
290 if answer == wx.ID_YES: 297 if answer == wx.ID_YES:
291 return 1 298 return 1
292 else:# answer == wx.ID_NO: 299 else:# answer == wx.ID_NO: