mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 17:03:44 +00:00
Load input-specific project; don't use default (blank) project
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19176
This commit is contained in:
parent
a76845d1e6
commit
9e7ffc6ff0
pcbnew
@ -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 )
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user