Commit 799862d4c83c558ba6ebb5b5b67c73defe983dbc

Authored by Paulo Henrique Junqueira Amorim
1 parent 2348f76b

FIX: Problem Windows XP 64bits error: wx._core.PyAssertionError

invesalius/gui/dialogs.py
@@ -167,14 +167,17 @@ def ShowImportDirDialog(): @@ -167,14 +167,17 @@ def ShowImportDirDialog():
167 | wx.DD_CHANGE_DIR) 167 | wx.DD_CHANGE_DIR)
168 168
169 path = None 169 path = None
170 - if dlg.ShowModal() == wx.ID_OK:  
171 - # GetPath returns in unicode, if a path has non-ascii characters a  
172 - # UnicodeEncodeError is raised. To avoid this, path is encoded in utf-8  
173 - if sys.platform == "win32":  
174 - path = dlg.GetPath()  
175 - else:  
176 - path = dlg.GetPath().encode('utf-8')  
177 - 170 + try:
  171 + if dlg.ShowModal() == wx.ID_OK:
  172 + # GetPath returns in unicode, if a path has non-ascii characters a
  173 + # UnicodeEncodeError is raised. To avoid this, path is encoded in utf-8
  174 + if sys.platform == "win32":
  175 + path = dlg.GetPath()
  176 + else:
  177 + path = dlg.GetPath().encode('utf-8')
  178 + except(wx._core.PyAssertionError): #TODO: error win64
  179 + path = dlg.GetPath()
  180 +
178 # Only destroy a dialog after you're done with it. 181 # Only destroy a dialog after you're done with it.
179 dlg.Destroy() 182 dlg.Destroy()
180 os.chdir(current_dir) 183 os.chdir(current_dir)
invesalius/invesalius.py
@@ -55,11 +55,17 @@ class SplashScreen(wx.SplashScreen): @@ -55,11 +55,17 @@ class SplashScreen(wx.SplashScreen):
55 if not(lang): 55 if not(lang):
56 56
57 ldlg = lang_dlg.LanguageDialog() 57 ldlg = lang_dlg.LanguageDialog()
58 -  
59 - if (ldlg.ShowModal() == wx.ID_OK):  
60 - lang = ldlg.GetSelectedLanguage()  
61 - session.SetLanguage(lang)  
62 - _ = i18n.InstallLanguage(lang) 58 +
  59 + try:
  60 + if (ldlg.ShowModal() == wx.ID_OK):
  61 + lang = ldlg.GetSelectedLanguage()
  62 + session.SetLanguage(lang)
  63 + _ = i18n.InstallLanguage(lang)
  64 + except(wx._core.PyAssertionError): #TODO: error win64
  65 + lang = ldlg.GetSelectedLanguage()
  66 + session.SetLanguage(lang)
  67 + _ = i18n.InstallLanguage(lang)
  68 +
63 else: 69 else:
64 _ = i18n.InstallLanguage(lang) 70 _ = i18n.InstallLanguage(lang)
65 71