Symbol library table remapping fixes.
Use GetPath() instead of GetFullPath() when initializing environment variable table entries KICAD_SYMBOL_DIR and KICAD_PTEMPALTE due to unexpected trailing path separator which was causing find libraries by URI to fail. Don't create a project symbol library table when there are no libraries not found in the global symbol library table. Don't add non-existent libraries to project symbol library table. Clear symbol library table when loading a new schematic. Minor remapping status message improvements.
This commit is contained in:
parent
0cf2df51c6
commit
81e8d8fd89
|
@ -493,7 +493,7 @@ bool PGM_BASE::InitPgm()
|
|||
tmpFileName.AppendDir( wxT( "modules" ) );
|
||||
envVarItem.SetDefinedExternally( false );
|
||||
}
|
||||
envVarItem.SetValue( tmpFileName.GetFullPath() );
|
||||
envVarItem.SetValue( tmpFileName.GetPath() );
|
||||
m_local_env_vars[ envVarName ] = envVarItem;
|
||||
|
||||
// KISYS3DMOD
|
||||
|
@ -524,7 +524,7 @@ bool PGM_BASE::InitPgm()
|
|||
tmpFileName.AppendDir( wxT( "template" ) );
|
||||
envVarItem.SetDefinedExternally( false );
|
||||
}
|
||||
envVarItem.SetValue( tmpFileName.GetFullPath() );
|
||||
envVarItem.SetValue( tmpFileName.GetPath() );
|
||||
m_local_env_vars[ envVarName ] = envVarItem;
|
||||
|
||||
// KICAD_SYMBOLS
|
||||
|
@ -540,7 +540,7 @@ bool PGM_BASE::InitPgm()
|
|||
tmpFileName.AppendDir( wxT( "library" ) );
|
||||
envVarItem.SetDefinedExternally( false );
|
||||
}
|
||||
envVarItem.SetValue( tmpFileName.GetFullPath() );
|
||||
envVarItem.SetValue( tmpFileName.GetPath() );
|
||||
m_local_env_vars[ envVarName ] = envVarItem;
|
||||
|
||||
ReadPdfBrowserInfos(); // needs m_common_settings
|
||||
|
|
|
@ -157,25 +157,43 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
|
|||
if( fullFileName.IsEmpty() )
|
||||
fullFileName = lib->GetFullFileName();
|
||||
|
||||
msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ),
|
||||
libName, fullFileName );
|
||||
aReporter.Report( msg, REPORTER::RPT_INFO );
|
||||
wxFileName tmpFn = fullFileName;
|
||||
|
||||
prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName, pluginType ) );
|
||||
// Don't add symbol libraries that do not exist.
|
||||
if( tmpFn.Normalize() && tmpFn.FileExists() )
|
||||
{
|
||||
msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ),
|
||||
libName, fullFileName );
|
||||
aReporter.Report( msg, REPORTER::RPT_INFO );
|
||||
|
||||
prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName,
|
||||
pluginType ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Library '%s' not found." ), fullFileName );
|
||||
aReporter.Report( msg, REPORTER::RPT_WARNING );
|
||||
}
|
||||
}
|
||||
|
||||
wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||
// Don't save empty project symbol library table.
|
||||
if( !prjLibTable.IsEmpty() )
|
||||
{
|
||||
wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||
|
||||
try
|
||||
{
|
||||
FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
|
||||
prjLibTable.Format( &formatter, 0 );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ),
|
||||
ioe.What() );
|
||||
aReporter.Report( msg, REPORTER::RPT_ERROR );
|
||||
try
|
||||
{
|
||||
FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
|
||||
prjLibTable.Format( &formatter, 0 );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
msg.Printf( _( "Failed to write project symbol library table. Error:\n %s" ),
|
||||
ioe.What() );
|
||||
aReporter.Report( msg, REPORTER::RPT_ERROR );
|
||||
}
|
||||
|
||||
aReporter.Report( _( "Created project symbol library table.\n" ), REPORTER::RPT_INFO );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,6 +153,7 @@ void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
|
|||
// Force a reload of the PART_LIBS
|
||||
prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
|
||||
prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL );
|
||||
prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
|
||||
|
||||
// Update the schematic symbol library links.
|
||||
SCH_SCREENS schematic;
|
||||
|
@ -232,6 +233,7 @@ void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
|
|||
// Force a reload of the PART_LIBS
|
||||
prj->SetElem( PROJECT::ELEM_SCH_PART_LIBS, NULL );
|
||||
prj->SetElem( PROJECT::ELEM_SCH_SEARCH_STACK, NULL );
|
||||
prj->SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL );
|
||||
|
||||
// Update the schematic symbol library links.
|
||||
SCH_SCREENS schematic;
|
||||
|
|
Loading…
Reference in New Issue