diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 54e4c759fa..548131de2d 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -249,12 +249,11 @@ BOARD* PCBNEW_JOBS_HANDLER::getBoard( const wxString& aPath ) if( !Pgm().IsGUI() && Pgm().GetSettingsManager().IsProjectOpen() ) { - PROJECT& project = Pgm().GetSettingsManager().Prj(); - wxString pcbPath = aPath; + if( pcbPath.IsEmpty() ) { - wxFileName path = project.GetProjectFullName(); + wxFileName path = Pgm().GetSettingsManager().Prj().GetProjectFullName(); path.SetExt( FILEEXT::KiCadPcbFileExtension ); path.MakeAbsolute(); pcbPath = path.GetFullPath(); @@ -263,7 +262,7 @@ BOARD* PCBNEW_JOBS_HANDLER::getBoard( const wxString& aPath ) if( !m_cliBoard ) { m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO ); - m_cliBoard = LoadBoard( pcbPath, true, &project ); + m_cliBoard = LoadBoard( pcbPath, true ); } brd = m_cliBoard; @@ -271,7 +270,7 @@ BOARD* PCBNEW_JOBS_HANDLER::getBoard( const wxString& aPath ) else { m_reporter->Report( _( "Loading board\n" ), RPT_SEVERITY_INFO ); - brd = LoadBoard( aPath, true, &Pgm().GetSettingsManager().Prj() ); + brd = LoadBoard( aPath, true ); } if ( !brd ) diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index d795b0a3e7..fb025601ca 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -87,15 +87,15 @@ void ScriptingOnDestructPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame ) } -BOARD* LoadBoard( const wxString& aFileName, bool aSetActive, PROJECT* aProject ) +BOARD* LoadBoard( const wxString& aFileName, bool aSetActive ) { if( aFileName.EndsWith( FILEEXT::KiCadPcbFileExtension ) ) - return LoadBoard( aFileName, PCB_IO_MGR::KICAD_SEXP, aSetActive, aProject ); + return LoadBoard( aFileName, PCB_IO_MGR::KICAD_SEXP, aSetActive ); else if( aFileName.EndsWith( FILEEXT::LegacyPcbFileExtension ) ) - return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive, aProject ); + return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive ); // as fall back for any other kind use the legacy format - return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive, aProject ); + return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive ); } @@ -148,8 +148,7 @@ BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat ) } -BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive, - PROJECT* aProject ) +BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive ) { wxFileName pro = aFileName; pro.SetExt( FILEEXT::ProjectFileExtension ); @@ -166,12 +165,7 @@ BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, boo // It also avoid wxWidget alerts about locale issues, later, when using Python 3 LOCALE_IO dummy; - PROJECT* project = aProject; - - if( !project ) - { - GetSettingsManager()->GetProject( projectPath ); - } + PROJECT* project = GetSettingsManager()->GetProject( projectPath ); if( !project ) { diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.h b/pcbnew/python/scripting/pcbnew_scripting_helpers.h index 7f72a5ebac..ac3a11fb1a 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.h +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.h @@ -63,7 +63,7 @@ BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat ); * * Hidden from SWIG as aSetActive should not be used by python, but cli also leverages this function */ -BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive, PROJECT* aProject = nullptr ); +BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive ); #endif // Default LoadBoard() to load .kicad_pcb files:. @@ -75,7 +75,7 @@ BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, boo * * Hidden from SWIG as aSetActive should not be used by python, but cli also leverages this function */ -BOARD* LoadBoard( const wxString& aFileName, bool aSetActive, PROJECT* aProject = nullptr ); +BOARD* LoadBoard( const wxString& aFileName, bool aSetActive ); #endif /**