Pcbnew footprint library table fixes.

* Make footprint viewer work properly with library table.
* Fix bug in Eagle plugin when enumerating footprints.
* Add missing P-CAD plugin from footprint library table editing dialog.
* Fix bug in FOOTPRINT_INFO::LoadLibraries when error occur loading footprints
  from libraries.
This commit is contained in:
Wayne Stambaugh 2013-09-21 20:28:02 -04:00
parent 5e53232f0c
commit 0f4ba09545
6 changed files with 59 additions and 17 deletions

View File

@ -46,6 +46,8 @@
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
{
bool retv = true;
// Clear data before reading files
m_filesNotFound.Empty();
m_filesInvalid.Empty();
@ -77,9 +79,10 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
wxLogDebug( wxT( "Path <%s> -> <%s>." ), GetChars( aFootprintsLibNames[ii] ),
GetChars( filename.GetFullPath() ) );
if( !filename.FileExists() )
if( !filename.IsOk() || !filename.FileExists() )
{
m_filesNotFound << aFootprintsLibNames[ii] << wxT( "\n" );
retv = false;
continue;
}
@ -110,6 +113,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
catch( IO_ERROR ioe )
{
m_filesInvalid << ioe.errorText << wxT( "\n" );
retv = false;
}
}
}
@ -124,12 +128,14 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
m_List.sort();
return true;
return retv;
}
bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
{
bool retv = true;
// Clear data before reading files
m_filesNotFound.Empty();
m_filesInvalid.Empty();
@ -152,6 +158,9 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
wxString path = FP_LIB_TABLE::ExpandSubstitutions( row->GetFullURI() );
wxArrayString fpnames = pi->FootprintEnumerate( path );
wxLogDebug( wxT( "Load footprint library type %s from path <%s>" ),
GetChars( row->GetType() ), GetChars( path ) );
for( unsigned i=0; i<fpnames.GetCount(); ++i )
{
std::auto_ptr<MODULE> m( pi->FootprintLoad( path, fpnames[i] ) );
@ -174,12 +183,13 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
catch( IO_ERROR ioe )
{
m_filesInvalid << ioe.errorText << wxT( "\n" );
retv = false;
}
}
m_List.sort();
return true;
return retv;
}

View File

@ -630,6 +630,7 @@ public:
choices.Add( IO_MGR::ShowType( IO_MGR::KICAD ) );
choices.Add( IO_MGR::ShowType( IO_MGR::LEGACY ) );
choices.Add( IO_MGR::ShowType( IO_MGR::EAGLE ) );
choices.Add( IO_MGR::ShowType( IO_MGR::PCAD ) );
choices.Add( IO_MGR::ShowType( IO_MGR::GEDA_PCB ) );
wxGridCellAttr* attr;

View File

@ -1058,8 +1058,8 @@ static inline unsigned long timeStamp( CPTREE& aTree )
EAGLE_PLUGIN::EAGLE_PLUGIN() :
m_rules( new ERULES() ),
m_xpath( new XPATH() )
// m_mod_time( wxDateTime::Now() )
m_xpath( new XPATH() ),
m_mod_time( wxDateTime::Now() )
{
init( NULL );
@ -1271,6 +1271,9 @@ void EAGLE_PLUGIN::loadDesignRules( CPTREE& aDesignRules )
void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
{
if( m_board == NULL )
return;
typedef std::vector<ELAYER> ELAYERS;
typedef ELAYERS::const_iterator EITER;
@ -1289,6 +1292,7 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
// establish cu layer map:
int ki_layer_count = 0;
for( EITER it = cu.begin(); it != cu.end(); ++it, ++ki_layer_count )
{
if( ki_layer_count == 0 )
@ -2674,7 +2678,7 @@ LAYER_NUM EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
case 95: kiLayer = ECO1_N; break;
case 96: kiLayer = ECO2_N; break;
default:
D( printf( "unsupported eagle layer: %d\n", aEagleLayer );)
// D( printf( "unsupported eagle layer: %d\n", aEagleLayer );)
kiLayer = -1; break; // some layers do not map to KiCad
}
}
@ -2714,7 +2718,12 @@ wxDateTime EAGLE_PLUGIN::getModificationTime( const wxString& aPath )
m_writable = fn.IsFileWritable();
*/
return fn.GetModificationTime();
wxDateTime modTime = fn.GetModificationTime();
if( !modTime.IsValid() )
modTime.Now();
return modTime;
}
@ -2724,6 +2733,9 @@ void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath )
{
wxDateTime modtime;
if( !m_mod_time.IsValid() )
m_mod_time.Now();
if( aLibPath != m_lib_path ||
m_mod_time != ( modtime = getModificationTime( aLibPath ) ) )
{

View File

@ -426,30 +426,49 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
return;
}
bool libLoaded = false;
FOOTPRINT_LIST fp_info_list;
wxArrayString libsList;
wxBusyCursor busyCursor;
#if !defined( USE_FP_LIB_TABLE )
libsList.Add( m_libraryName );
libLoaded = fp_info_list.ReadFootprintFiles( libsList );
#else
wxString uri = m_footprintLibTable->FindRow( m_libraryName )->GetFullURI();
const FP_LIB_TABLE::ROW* row = m_footprintLibTable->FindRow( m_libraryName );
if( uri.IsEmpty() )
if( row == NULL )
{
wxString msg;
msg.Format( _( "Footprint library table entry <%s> not found." ),
GetChars( m_libraryName ) );
DisplayError( this, msg );
return;
}
uri = FP_LIB_TABLE::ExpandSubstitutions( uri );
wxLogDebug( wxT( "Footprint library <%s> selected." ), GetChars( uri ) );
libsList.Add( uri );
FP_LIB_TABLE tmp;
tmp.InsertRow( *row );
libLoaded = fp_info_list.ReadFootprintFiles( tmp );
#endif
FOOTPRINT_LIST fp_info_list;
fp_info_list.ReadFootprintFiles( libsList );
if( !libLoaded )
{
wxString msg;
msg.Format( _( "Error occurred attempting to load footprint library <%s>:\n\n"
"Files not found:\n\n%s\n\nFile load errors:\n\n%s" ),
GetChars( m_libraryName ), GetChars( fp_info_list.m_filesNotFound ),
GetChars( fp_info_list.m_filesInvalid ) );
DisplayError( this, msg );
return;
}
wxArrayString fpList;
BOOST_FOREACH( FOOTPRINT_INFO& footprint, fp_info_list.m_List )
{
fpList.Add(( footprint.m_Module ) );
fpList.Add( footprint.m_Module );
}
m_FootprintList->Append( fpList );
int index = m_FootprintList->FindString( m_footprintName );

0
scripting/build_tools/extract_docstrings.py Executable file → Normal file
View File

0
scripting/build_tools/fix_swig_imports.py Executable file → Normal file
View File