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:
Wayne Stambaugh 2017-09-06 09:21:50 -04:00
parent 0cf2df51c6
commit 81e8d8fd89
3 changed files with 38 additions and 18 deletions

View File

@ -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

View File

@ -157,13 +157,28 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
if( fullFileName.IsEmpty() )
fullFileName = lib->GetFullFileName();
wxFileName tmpFn = fullFileName;
// 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 ) );
prjLibTable.InsertRow( new SYMBOL_LIB_TABLE_ROW( libName, fullFileName,
pluginType ) );
}
else
{
msg.Printf( _( "Library '%s' not found." ), fullFileName );
aReporter.Report( msg, REPORTER::RPT_WARNING );
}
}
// Don't save empty project symbol library table.
if( !prjLibTable.IsEmpty() )
{
wxFileName fn( Prj().GetProjectPath(), SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
try
@ -177,6 +192,9 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
ioe.What() );
aReporter.Report( msg, REPORTER::RPT_ERROR );
}
aReporter.Report( _( "Created project symbol library table.\n" ), REPORTER::RPT_INFO );
}
}
}

View File

@ -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;