Fix some issues related to python scripts:

- make PadArray.py compatible python2/3
- fix a wxWidgets warning in pcbnew_scripting_helpers.cpp shown in some cases
This commit is contained in:
jean-pierre charras 2021-04-28 14:02:47 +02:00
parent 78b555afa2
commit 4d9829ec8b
2 changed files with 11 additions and 1 deletions

View File

@ -212,7 +212,11 @@ class PadGridArray(PadArray):
@param py: pitch in y-direction
@param centre: array centre point
"""
super(PadGridArray, self).__init__(pad)
try:
super().__init__(pad)
except TypeError:
super(PadGridArray, self).__init__(pad)
self.nx = int(nx)
self.ny = int(ny)

View File

@ -45,6 +45,8 @@
#include <settings/settings_manager.h>
#include <project/project_local_settings.h>
#include <wildcards_and_files_ext.h>
#include <locale_io.h>
static PCB_EDIT_FRAME* s_PcbEditFrame = NULL;
@ -124,6 +126,10 @@ BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat )
pro.MakeAbsolute();
wxString projectPath = pro.GetFullPath();
// Ensure the "C" locale is temporary set, before reading any file
// It also avoid wxWidget alerts about locale issues, later, when using Python 3
LOCALE_IO dummy;
PROJECT* project = GetSettingsManager()->GetProject( projectPath );
if( !project )