diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index e6fbdad856..9bb6ba5b27 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -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 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; } diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index 34eccd06f2..0b5815fa69 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -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; diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 398967ea43..f660ee28ab 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -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 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 ) ) ) { diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index 4014e1011d..69bdee754f 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -426,30 +426,49 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() return; } - wxArrayString libsList; + 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 ); diff --git a/scripting/build_tools/extract_docstrings.py b/scripting/build_tools/extract_docstrings.py old mode 100755 new mode 100644 diff --git a/scripting/build_tools/fix_swig_imports.py b/scripting/build_tools/fix_swig_imports.py old mode 100755 new mode 100644