Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

wxLocale on Windows #171

Open
bozhikovstanislav opened this issue Dec 14, 2021 · 0 comments
Open

wxLocale on Windows #171

bozhikovstanislav opened this issue Dec 14, 2021 · 0 comments

Comments

@bozhikovstanislav
Copy link

Hi
I have some way of solving the Locale issues for windows
please review the code.

May Be it is OK for Windows but it works

class MainApp(wx.App):
def OnInit(self):
locale = wx.Locale(wx.LANGUAGE_ENGLISH)
initialize_directories()
if is_windows():
from dvha.tools.windows_reg_edit import (
set_ie_emulation_level,
set_ie_lockdown_level,
)

        set_ie_emulation_level()
        set_ie_lockdown_level()

    self.SetAppName("DVH Analytics")
    self.frame = DVHAMainFrame(None, wx.ID_ANY, "")
    set_frame_icon(self.frame)
    self.SetTopWindow(self.frame)
    self.frame.Show()
    return True

def OnExit(self):
    self.frame.options.save()
    for window in wx.GetTopLevelWindows():
        wx.CallAfter(window.Close)
    return super().OnExit()

# May cause crash, another solution needed?
def InitLocale(self):
    # https://docs.wxpython.org/MigrationGuide.html#possible-locale-mismatch-on-windows
    if is_windows():
        try:
            self.ResetLocale()
        except Exception as e:
            logger.warning(str(e))
            try:
                **self.locale=wx.Locale(wx.LANGUAGE_ENGLISH)**
            except Exception as e:
                logger.warning(str(e))
        return
    super().InitLocale()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant