Fix Eagle schematic importer incorrect symbol value field and visibility.
Also fix a crash if an XML_PARSER_ERROR exception is thrown when importing Eagle symbol libraries. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18232
This commit is contained in:
parent
66bd0f850a
commit
566fefafc5
|
@ -1842,7 +1842,7 @@ void SCH_IO_EAGLE::loadInstance( wxXmlNode* aInstanceNode )
|
||||||
|
|
||||||
valueField->SetVisible( part->GetFieldById( VALUE_FIELD )->IsVisible() );
|
valueField->SetVisible( part->GetFieldById( VALUE_FIELD )->IsVisible() );
|
||||||
|
|
||||||
if( !userValue && epart->value )
|
if( epart->value )
|
||||||
{
|
{
|
||||||
valueField->SetText( *epart->value );
|
valueField->SetText( *epart->value );
|
||||||
}
|
}
|
||||||
|
@ -1954,11 +1954,8 @@ void SCH_IO_EAGLE::loadInstance( wxXmlNode* aInstanceNode )
|
||||||
// Use the instance attribute to determine the reference and value field visibility.
|
// Use the instance attribute to determine the reference and value field visibility.
|
||||||
if( einstance.smashed && einstance.smashed.Get() )
|
if( einstance.smashed && einstance.smashed.Get() )
|
||||||
{
|
{
|
||||||
if( !valueAttributeFound )
|
symbol->GetField( VALUE_FIELD )->SetVisible( valueAttributeFound );
|
||||||
symbol->GetField( VALUE_FIELD )->SetVisible( false );
|
symbol->GetField( REFERENCE_FIELD )->SetVisible( nameAttributeFound );
|
||||||
|
|
||||||
if( !nameAttributeFound )
|
|
||||||
symbol->GetField( REFERENCE_FIELD )->SetVisible( false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol->AddHierarchicalReference( m_sheetPath.Path(), reference, unit );
|
symbol->AddHierarchicalReference( m_sheetPath.Path(), reference, unit );
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2004-2023, 2024 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
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
#include <string_utils.h>
|
#include <string_utils.h>
|
||||||
|
#include <io/eagle/eagle_parser.h>
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::ImportSymbol()
|
void SYMBOL_EDIT_FRAME::ImportSymbol()
|
||||||
|
@ -108,6 +109,12 @@ void SYMBOL_EDIT_FRAME::ImportSymbol()
|
||||||
DisplayErrorMessage( this, msg, ioe.What() );
|
DisplayErrorMessage( this, msg, ioe.What() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
catch( const XML_PARSER_ERROR& ioe )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Cannot import symbol library '%s'." ), fn.GetFullPath() );
|
||||||
|
DisplayErrorMessage( this, msg, ioe.what() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( symbols.empty() )
|
if( symbols.empty() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue