Eeschema: fix broken symbol library links.
Force the symbol library links whenever the symbol library table has been modified. This will use the cache as a fallback when a library has been removed that contains links in the schematic rather than display. Fix the SCH_COMPONENT symbol resolver when falling back to the cache. The resolver was using the LIB_ID ':' notation which was failing. Replacing ':' with '_' fixed this issue. This was also an issue when generating the symbol message panel information. Convert wxLogDebug to wxLogTrace in symbol resolver code path. Add new trace type KICAD_SYM_RESOLVE. Fixes lp:1821606 https://bugs.launchpad.net/kicad/+bug/1821606
This commit is contained in:
parent
4e5a94efb7
commit
7d803437e2
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2018-2019 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -44,6 +44,7 @@ const wxChar* const tracePathsAndFiles = wxT( "KICAD_PATHS_AND_FILES" );
|
||||||
const wxChar* const traceLocale = wxT( "KICAD_LOCALE" );
|
const wxChar* const traceLocale = wxT( "KICAD_LOCALE" );
|
||||||
const wxChar* const traceScreen = wxT( "KICAD_SCREEN" );
|
const wxChar* const traceScreen = wxT( "KICAD_SCREEN" );
|
||||||
const wxChar* const traceZoomScroll = wxT( "KICAD_ZOOM_SCROLL" );
|
const wxChar* const traceZoomScroll = wxT( "KICAD_ZOOM_SCROLL" );
|
||||||
|
const wxChar* const traceSymbolResolver = wxT( "KICAD_SYM_RESOLVE" );
|
||||||
|
|
||||||
|
|
||||||
wxString dump( const wxArrayString& aArray )
|
wxString dump( const wxArrayString& aArray )
|
||||||
|
|
|
@ -35,8 +35,11 @@
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <env_paths.h>
|
#include <env_paths.h>
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
|
#include <sch_edit_frame.h>
|
||||||
#include <viewlib_frame.h>
|
#include <viewlib_frame.h>
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
|
#include <sch_screen.h>
|
||||||
|
|
||||||
#include <widgets/grid_readonly_text_helpers.h>
|
#include <widgets/grid_readonly_text_helpers.h>
|
||||||
#include <widgets/grid_text_button_helpers.h>
|
#include <widgets/grid_text_button_helpers.h>
|
||||||
|
|
||||||
|
@ -740,6 +743,15 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCH_SCREENS schematic;
|
||||||
|
|
||||||
|
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
|
||||||
|
|
||||||
|
SCH_EDIT_FRAME* schEditor = (SCH_EDIT_FRAME*) aKiway->Player( FRAME_SCH, false );
|
||||||
|
|
||||||
|
if( schEditor )
|
||||||
|
schEditor->SyncView();
|
||||||
|
|
||||||
auto editor = (LIB_EDIT_FRAME*) aKiway->Player( FRAME_SCH_LIB_EDITOR, false );
|
auto editor = (LIB_EDIT_FRAME*) aKiway->Player( FRAME_SCH_LIB_EDITOR, false );
|
||||||
|
|
||||||
if( editor )
|
if( editor )
|
||||||
|
|
|
@ -331,7 +331,14 @@ bool SCH_COMPONENT::Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib )
|
||||||
// Fall back to cache library. This is temporary until the new schematic file
|
// Fall back to cache library. This is temporary until the new schematic file
|
||||||
// format is implemented.
|
// format is implemented.
|
||||||
if( !alias && aCacheLib )
|
if( !alias && aCacheLib )
|
||||||
alias = aCacheLib->FindAlias( m_lib_id.Format().wx_str() );
|
{
|
||||||
|
wxString libId = m_lib_id.Format().wx_str();
|
||||||
|
libId.Replace( ":", "_" );
|
||||||
|
alias = aCacheLib->FindAlias( libId );
|
||||||
|
wxLogTrace( traceSymbolResolver,
|
||||||
|
"Library symbol %s not found falling back to cache library.",
|
||||||
|
m_lib_id.Format().wx_str() );
|
||||||
|
}
|
||||||
|
|
||||||
if( alias && alias->GetPart() )
|
if( alias && alias->GetPart() )
|
||||||
{
|
{
|
||||||
|
@ -339,11 +346,17 @@ bool SCH_COMPONENT::Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( const IO_ERROR& )
|
catch( const IO_ERROR& ioe )
|
||||||
{
|
{
|
||||||
wxLogDebug( "Cannot resolve library symbol %s", m_lib_id.Format().wx_str() );
|
wxLogTrace( traceSymbolResolver, "I/O error %s resolving library symbol %s", ioe.What(),
|
||||||
|
m_lib_id.Format().wx_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxLogTrace( traceSymbolResolver, "Cannot resolve library symbol %s",
|
||||||
|
m_lib_id.Format().wx_str() );
|
||||||
|
|
||||||
|
m_part.reset();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,6 +466,11 @@ void SCH_COMPONENT::UpdatePins( SCH_SHEET_PATH* aSheet )
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pins.clear();
|
||||||
|
m_pinMap.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1317,9 +1335,15 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList
|
||||||
LIB_ALIAS* alias = nullptr;
|
LIB_ALIAS* alias = nullptr;
|
||||||
|
|
||||||
if( part->GetLib() && part->GetLib()->IsCache() )
|
if( part->GetLib() && part->GetLib()->IsCache() )
|
||||||
alias = part->GetAlias( GetLibId().Format() );
|
{
|
||||||
|
wxString libId = GetLibId().Format();
|
||||||
|
libId.Replace( ":", "_" );
|
||||||
|
alias = part->GetAlias( libId );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
alias = part->GetAlias( GetLibId().GetLibItemName() );
|
alias = part->GetAlias( GetLibId().GetLibItemName() );
|
||||||
|
}
|
||||||
|
|
||||||
if( !alias )
|
if( !alias )
|
||||||
return;
|
return;
|
||||||
|
@ -1338,8 +1362,9 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList
|
||||||
if( alias->GetName() != part->GetName() )
|
if( alias->GetName() != part->GetName() )
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), part->GetName(), BROWN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), part->GetName(), BROWN ) );
|
||||||
|
|
||||||
if( alias->GetLib() && alias->GetLib()->IsCache() )
|
if( part->GetLib() && part->GetLib()->IsCache() )
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), alias->GetLibNickname(), RED ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Library" ),
|
||||||
|
part->GetLib()->GetLogicalName(), RED ) );
|
||||||
else if( !m_lib_id.GetLibNickname().empty() )
|
else if( !m_lib_id.GetLibNickname().empty() )
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname(),
|
aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname(),
|
||||||
BROWN ) );
|
BROWN ) );
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -245,6 +245,7 @@ public:
|
||||||
* - when loading a schematic file
|
* - when loading a schematic file
|
||||||
* - before creating a netlist (in case a library is modified)
|
* - before creating a netlist (in case a library is modified)
|
||||||
* - whenever a symbol library is modified
|
* - whenever a symbol library is modified
|
||||||
|
* - whenever the symbol library table is modified.
|
||||||
*
|
*
|
||||||
* @param aForce true forces a refresh even if the library modification has hasn't changed.
|
* @param aForce true forces a refresh even if the library modification has hasn't changed.
|
||||||
*/
|
*/
|
||||||
|
@ -622,6 +623,7 @@ public:
|
||||||
* - when loading a schematic file
|
* - when loading a schematic file
|
||||||
* - before creating a netlist (in case a library is modified)
|
* - before creating a netlist (in case a library is modified)
|
||||||
* - whenever any of the libraries are modified.
|
* - whenever any of the libraries are modified.
|
||||||
|
* - whenever the symbol library table is modified.
|
||||||
*/
|
*/
|
||||||
void UpdateSymbolLinks( bool aForce = false );
|
void UpdateSymbolLinks( bool aForce = false );
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2018-2019 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -146,6 +146,13 @@ extern const wxChar* const traceScreen;
|
||||||
*/
|
*/
|
||||||
extern const wxChar* const traceZoomScroll;
|
extern const wxChar* const traceZoomScroll;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to enable debug output of symbol library resolver results
|
||||||
|
*
|
||||||
|
* Use "KICAD_SYM_RESOLVE" to enable.
|
||||||
|
*/
|
||||||
|
extern const wxChar* const traceSymbolResolver;
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue