Improve sheet schematic import messages and simplify code.
There was also a logic bug when the selected schematic was in a different
path than the current project and was already part of the current project.
The symbol library table reconciliation code was still run which was wrong.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11075
(cherry picked from commit e336a0e403
)
This commit is contained in:
parent
6127ae92a5
commit
7d9cf00fd9
|
@ -206,8 +206,9 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
wxMessageDialog::ButtonLabel okButtonLabel( _( "Continue Load" ) );
|
||||
wxMessageDialog::ButtonLabel cancelButtonLabel( _( "Cancel Load" ) );
|
||||
|
||||
if( fileName.GetPathWithSep() == Prj().GetProjectPath()
|
||||
&& !prjScreens.HasSchematic( fullFilename ) )
|
||||
if( !prjScreens.HasSchematic( fullFilename ) )
|
||||
{
|
||||
if( fileName.GetPathWithSep() == Prj().GetProjectPath() )
|
||||
{
|
||||
// A schematic in the current project path that isn't part of the current project.
|
||||
// It's possible the user copied this schematic from another project so the library
|
||||
|
@ -221,9 +222,10 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
|
||||
if( !newLibNames.IsEmpty() )
|
||||
{
|
||||
msg = _( "There are library names in the loaded schematic that are missing "
|
||||
"from the project library table. This may result in broken symbol "
|
||||
"library links for the loaded schematic. Do you wish to continue?" );
|
||||
msg = _( "There are library names in the selected schematic that are missing "
|
||||
"from the current project library table. This may result in broken "
|
||||
"symbol library references for the loaded schematic.\n\n"
|
||||
"Do you wish to continue?" );
|
||||
wxMessageDialog msgDlg3( this, msg, _( "Continue Load Schematic" ),
|
||||
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
|
||||
wxCENTER | wxICON_QUESTION );
|
||||
|
@ -261,10 +263,10 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
{
|
||||
if( !symLibTableFn.Exists() || !symLibTableFn.IsFileReadable() )
|
||||
{
|
||||
msg.Printf( _( "The project library table '%s' does not exist or cannot "
|
||||
"be read. This may result in broken symbol links for the "
|
||||
"schematic. Do you wish to continue?" ),
|
||||
symLibTableFn.GetFullPath() );
|
||||
msg = _( "The selected file was created as part of a different project. "
|
||||
"Linking the file to this project may result in missing or "
|
||||
"incorrect symbol library references.\n\n"
|
||||
"Do you wish to continue?" );
|
||||
wxMessageDialog msgDlg4( this, msg, _( "Continue Load Schematic" ),
|
||||
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
|
||||
wxCENTER | wxICON_QUESTION );
|
||||
|
@ -310,9 +312,9 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
|
||||
if( missingLibNames )
|
||||
{
|
||||
msg = _( "There are library names in the loaded schematic that are missing "
|
||||
"from the loaded schematic project library table. This may result "
|
||||
"in broken symbol library links for the schematic. "
|
||||
msg = _( "There are symbol library names in the selected schematic that "
|
||||
"are missing from the selected schematic project library table. "
|
||||
"This may result in broken symbol library references.\n\n"
|
||||
"Do you wish to continue?" );
|
||||
wxMessageDialog msgDlg5( this, msg, _( "Continue Load Schematic" ),
|
||||
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
|
||||
|
@ -353,7 +355,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
wxString thisURI = thisRow->GetFullURI( true );
|
||||
wxString otherURI = otherRow->GetFullURI( false);
|
||||
|
||||
if( otherURI.Contains( wxT( "${KIPRJMOD}" ) ) || otherURI.Contains( wxT( "$(KIPRJMOD)" ) ) )
|
||||
if( otherURI.Contains( "${KIPRJMOD}" ) || otherURI.Contains( "$(KIPRJMOD)" ) )
|
||||
{
|
||||
// Cannot use relative paths here, "${KIPRJMOD}../path-to-cache-lib" does
|
||||
// not expand to a valid symbol library path.
|
||||
|
@ -373,7 +375,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
{
|
||||
msg = _( "A duplicate library name that references a different library exists "
|
||||
"in the current library table. This conflict cannot be resolved and "
|
||||
"may result in broken symbol library links for the schematic. "
|
||||
"may result in broken symbol library references.\n\n"
|
||||
"Do you wish to continue?" );
|
||||
wxMessageDialog msgDlg6( this, msg, _( "Continue Load Schematic" ),
|
||||
wxOK | wxCANCEL | wxCANCEL_DEFAULT |
|
||||
|
@ -403,7 +405,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
wxString uri = table.GetFullURI( libName, false );
|
||||
wxFileName newLib;
|
||||
|
||||
if( uri.Contains( wxT( "${KIPRJMOD}" ) ) || uri.Contains( wxT( "$(KIPRJMOD)" ) ) )
|
||||
if( uri.Contains( "${KIPRJMOD}" ) || uri.Contains( "$(KIPRJMOD)" ) )
|
||||
{
|
||||
// Cannot use relative paths here, "${KIPRJMOD}../path-to-cache-lib" does
|
||||
// not expand to a valid symbol library path.
|
||||
|
@ -432,6 +434,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCH_SCREEN* newScreen = newSheet->GetScreen();
|
||||
wxCHECK_MSG( newScreen, false, wxT( "No screen defined for sheet." ) );
|
||||
|
|
Loading…
Reference in New Issue