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

wxLocale on Windows #171

@bozhikovstanislav

Description

@bozhikovstanislav

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions