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