From 2d967e566698ceae87f2737edc4c6363a807f52a Mon Sep 17 00:00:00 2001 From: Rock Storm Date: Wed, 10 May 2023 15:25:16 +0200 Subject: [PATCH] p/pronterface: Fix unknown wx locale Function `wx.Locale.GetSystemLanguage` returns `wx.LANGUAGE_UNKNOWN` when unable to identify the system's language. And `wx.Locale` constructor does not allow `wx.LANGUAGE_UNKNOWN` as an argument. Fixes #1345 Fixes #1348 --- printrun/pronterface.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/printrun/pronterface.py b/printrun/pronterface.py index 4a3d8c193..ce51e8b87 100644 --- a/printrun/pronterface.py +++ b/printrun/pronterface.py @@ -2578,6 +2578,10 @@ class PronterApp(wx.App): def __init__(self, *args, **kwargs): super(PronterApp, self).__init__(*args, **kwargs) self.SetAppName("Pronterface") - self.locale = wx.Locale(wx.Locale.GetSystemLanguage()) + lang = wx.Locale.GetSystemLanguage() + # Fall back to English if unable to determine language + if lang == wx.LANGUAGE_UNKNOWN: + lang = wx.LANGUAGE_ENGLISH_US + self.locale = wx.Locale(lang) self.mainwindow = PronterWindow(self) self.mainwindow.Show()