File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,9 @@ def main_real():
237
237
# action='store_true',
238
238
# help='Run KiCost on terminal using the parameters in the GUI memory, all passed parameters from'
239
239
# ' terminal take priority.')
240
+ parser .add_argument ('--force_en_us' ,
241
+ action = 'store_true' ,
242
+ help = 'Workaround for broken wxWidgets locale on some Windows systems.' )
240
243
parser .add_argument ('--setup' ,
241
244
action = 'store_true' ,
242
245
help = 'Run KiCost integration (with KiCad and OS) configuration script.' )
@@ -316,13 +319,13 @@ def main_real():
316
319
if args .gui :
317
320
if not GUI_ENABLED :
318
321
kicost_gui_notdependences ()
319
- kicost_gui ([os .path .abspath (fileName ) for fileName in args .gui ])
322
+ kicost_gui (args . force_en_us , [os .path .abspath (fileName ) for fileName in args .gui ])
320
323
sys .exit (0 )
321
324
322
325
if args .input is None :
323
326
if not GUI_ENABLED :
324
327
kicost_gui_notdependences ()
325
- kicost_gui () # Use the user gui if no input is given.
328
+ kicost_gui (args . force_en_us ) # Use the user gui if no input is given.
326
329
sys .exit (0 )
327
330
else :
328
331
# Match the EDA tool formats with the input files.
Original file line number Diff line number Diff line change @@ -1158,25 +1158,20 @@ def close(self):
1158
1158
pass
1159
1159
1160
1160
1161
- def kicost_gui (files = None ):
1161
+ def kicost_gui (force_en_us = False , files = None ):
1162
1162
''' @brief Load the graphical interface.
1163
1163
@param String file file names or list.
1164
1164
(it will be used for plugin implementation on future KiCad6-Eeschema).
1165
1165
'''
1166
1166
app = wx .App (redirect = False )
1167
- loc = wx .Locale (wx .LANGUAGE_DEFAULT )
1168
- locale_retry = False
1167
+ loc = wx .Locale (wx .LANGUAGE_DEFAULT if not force_en_us else wx .LANGUAGE_ENGLISH_US )
1169
1168
if not loc .IsOk ():
1170
- logger .warning (W_LOCFAIL + "Failed to set the default locale" )
1171
- locale_retry = True
1169
+ if not force_en_us :
1170
+ logger .warning (W_LOCFAIL + "Failed to set the default locale, try using `--force_en_us`" )
1171
+ else :
1172
+ logger .warning (W_LOCFAIL + "`--force_en_us` doesn't seem to help" )
1172
1173
elif not loc .GetLocale () and not loc .GetName ():
1173
- logger .warning (W_LOCFAIL + "Unsupported locale" )
1174
- locale_retry = True
1175
- if locale_retry :
1176
- loc = wx .Locale (wx .LANGUAGE_ENGLISH_US )
1177
- logger .warning (W_LOCFAIL + "Trying with US english locale" )
1178
- if not loc .IsOk ():
1179
- logger .warning (W_LOCFAIL + "Failed to set the en_US locale" )
1174
+ logger .warning (W_LOCFAIL + "Unsupported locale" + (", try using `--force_en_us`" if not force_en_us else "" ))
1180
1175
else :
1181
1176
logger .debug ('wxWidgets locale {} ({}) system: {}' .format (loc .GetLocale (), loc .GetName (), locale .getlocale ()))
1182
1177
frame = formKiCost (None )
You can’t perform that action at this time.
0 commit comments