Closed cutright closed 3 years ago
fixed in v0.9.4
This locale issue needs to be fixed to be able to write time stamps to the SQL database (maybe only for SQLite?)
The code in the previous commit appears to avoid errors, however timestamps from DICOM (e.g., plan timestamp) are not being determined. Timestamps from SQL (e.g., import timestamps) work fine. So think with the above fix, this issue amounts to a minor issue. Dates appear to be OK (e.g., Sim Study Date).
I tried the following, but no dice.
This code produced the following error and hard crash on MSW7:
def InitLocale(self):
if is_windows():
self.ResetLocale()
try:
import locale
lang, enc = locale.getdefaultlocale()
lang = lang.replace('_', '-')
self._initial_locale = wx.Locale(lang, lang[:2], lang)
# locale.setlocale(locale.LC_ALL, lang)
except Exception as e:
print(e)
else:
super().InitLocale()
ERROR: Unhandled exception: Traceback (most recent call last):
File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\main.py", line 1853, in OnInit
self.frame = DVHAMainFrame(None, wx.ID_ANY, "")
File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\main.py", line 218, in __init__
self.__add_tool_bar()
File "C:\Users\dcutright\PycharmProjects\DVH-Analytics\dvha\main.py", line 308, in __add_tool_bar
bitmap = wx.Bitmap(ICONS[key], wx.BITMAP_TYPE_ANY)
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(0, 0), "C") == 0" failed at ..\..\src\common\intl.cpp(1694) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a misma
tch between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale objects to avoid this!
Changing to 'bug: minor'
Will release new InitLocale
with v0.9.5
later today
Changing locale caused a hard crash when trying to access an icon from DVHA local storage. Commenting out the following function resolved the issue. This code was just to avoid a message in the terminal abut an unknown locale, so not worth keeping it.
https://github.com/cutright/DVH-Analytics/blob/a0e29af70b5703e6b41c6251dd9da9a72310efd3/dvha/main.py#L1857-L1861