Don't display busy cursor over remap symbols dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/11648
This commit is contained in:
parent
f87bf3c46d
commit
bcaca947b9
|
@ -85,19 +85,20 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
wxCHECK_RET( parent != nullptr, "Parent window is not type SCH_EDIT_FRAME." );
|
wxCHECK_RET( parent != nullptr, "Parent window is not type SCH_EDIT_FRAME." );
|
||||||
|
|
||||||
wxBusyCursor busy;
|
|
||||||
|
|
||||||
if( !backupProject( m_messagePanel->Reporter() ) )
|
if( !backupProject( m_messagePanel->Reporter() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Ignore the never show rescue setting for one last rescue of legacy symbol
|
// Ignore the never show rescue setting for one last rescue of legacy symbol
|
||||||
// libraries before remapping to the symbol library table. This ensures the
|
// libraries before remapping to the symbol library table. This ensures the
|
||||||
// best remapping results.
|
// best remapping results.
|
||||||
|
|
||||||
LEGACY_RESCUER rescuer( Prj(), &parent->Schematic(), &parent->GetCurrentSheet(),
|
LEGACY_RESCUER rescuer( Prj(), &parent->Schematic(), &parent->GetCurrentSheet(),
|
||||||
parent->GetCanvas()->GetBackend() );
|
parent->GetCanvas()->GetBackend() );
|
||||||
|
|
||||||
if( RESCUER::RescueProject( this, rescuer, false ) )
|
if( RESCUER::RescueProject( this, rescuer, false ) )
|
||||||
{
|
{
|
||||||
|
wxBusyCursor busy;
|
||||||
|
|
||||||
auto viewer = (SYMBOL_VIEWER_FRAME*) parent->Kiway().Player( FRAME_SCH_VIEWER, false );
|
auto viewer = (SYMBOL_VIEWER_FRAME*) parent->Kiway().Player( FRAME_SCH_VIEWER, false );
|
||||||
|
|
||||||
if( viewer )
|
if( viewer )
|
||||||
|
@ -112,14 +113,15 @@ void DIALOG_SYMBOL_REMAP::OnRemapSymbols( wxCommandEvent& aEvent )
|
||||||
// The schematic is fully loaded, any legacy library symbols have been rescued. Now
|
// The schematic is fully loaded, any legacy library symbols have been rescued. Now
|
||||||
// check to see if the schematic has not been converted to the symbol library table
|
// check to see if the schematic has not been converted to the symbol library table
|
||||||
// method for looking up symbols.
|
// method for looking up symbols.
|
||||||
|
|
||||||
|
wxBusyCursor busy;
|
||||||
|
|
||||||
wxFileName prjSymLibTableFileName( Prj().GetProjectPath(),
|
wxFileName prjSymLibTableFileName( Prj().GetProjectPath(),
|
||||||
SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||||
|
|
||||||
// Delete the existing project symbol library table.
|
// Delete the existing project symbol library table.
|
||||||
if( prjSymLibTableFileName.FileExists() )
|
if( prjSymLibTableFileName.FileExists() )
|
||||||
{
|
|
||||||
wxRemoveFile( prjSymLibTableFileName.GetFullPath() );
|
wxRemoveFile( prjSymLibTableFileName.GetFullPath() );
|
||||||
}
|
|
||||||
|
|
||||||
createProjectSymbolLibTable( m_messagePanel->Reporter() );
|
createProjectSymbolLibTable( m_messagePanel->Reporter() );
|
||||||
Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, nullptr );
|
||||||
|
@ -356,139 +358,143 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time stamp to append to file name in case multiple remappings are performed.
|
|
||||||
wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
|
|
||||||
|
|
||||||
// Back up symbol library table.
|
|
||||||
srcFileName.SetPath( Prj().GetProjectPath() );
|
|
||||||
srcFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
|
||||||
destFileName = srcFileName;
|
|
||||||
destFileName.AppendDir( backupFolder );
|
|
||||||
destFileName.SetName( destFileName.GetName() + timeStamp );
|
|
||||||
|
|
||||||
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
|
||||||
srcFileName.GetFullPath(),
|
|
||||||
destFileName.GetFullPath() );
|
|
||||||
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
|
||||||
|
|
||||||
if( wxFileName::Exists( srcFileName.GetFullPath() )
|
|
||||||
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
|
||||||
{
|
{
|
||||||
tmp.Printf( _( "Failed to back up file '%s'.\n" ),
|
wxBusyCursor busy;
|
||||||
srcFileName.GetFullPath() );
|
|
||||||
errorMsg += tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Back up the schematic files.
|
// Time stamp to append to file name in case multiple remappings are performed.
|
||||||
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
|
||||||
{
|
|
||||||
destFileName = screen->GetFileName();
|
// Back up symbol library table.
|
||||||
|
srcFileName.SetPath( Prj().GetProjectPath() );
|
||||||
|
srcFileName.SetName( SYMBOL_LIB_TABLE::GetSymbolLibTableFileName() );
|
||||||
|
destFileName = srcFileName;
|
||||||
|
destFileName.AppendDir( backupFolder );
|
||||||
destFileName.SetName( destFileName.GetName() + timeStamp );
|
destFileName.SetName( destFileName.GetName() + timeStamp );
|
||||||
|
|
||||||
// Check for nest hierarchical schematic paths.
|
|
||||||
if( destFileName.GetPath() != backupPath.GetPath() )
|
|
||||||
{
|
|
||||||
destFileName.SetPath( backupPath.GetPath() );
|
|
||||||
|
|
||||||
wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
|
|
||||||
wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
|
|
||||||
|
|
||||||
for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
|
|
||||||
destFileName.AppendDir( srcDirs[i] );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
destFileName.AppendDir( backupFolder );
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
||||||
screen->GetFileName(),
|
srcFileName.GetFullPath(),
|
||||||
destFileName.GetFullPath() );
|
destFileName.GetFullPath() );
|
||||||
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
||||||
|
|
||||||
if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
|
if( wxFileName::Exists( srcFileName.GetFullPath() )
|
||||||
|
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
||||||
{
|
{
|
||||||
tmp.Printf( _( "Failed to create backup folder '%s'.\n" ), destFileName.GetPath() );
|
tmp.Printf( _( "Failed to back up file '%s'.\n" ),
|
||||||
errorMsg += tmp;
|
srcFileName.GetFullPath() );
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( wxFileName::Exists( screen->GetFileName() )
|
|
||||||
&& !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
|
|
||||||
{
|
|
||||||
tmp.Printf( _( "Failed to back up file '%s'.\n" ), screen->GetFileName() );
|
|
||||||
errorMsg += tmp;
|
errorMsg += tmp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Back up the project file.
|
// Back up the schematic files.
|
||||||
destFileName = Prj().GetProjectFullName();
|
for( SCH_SCREEN* screen = schematic.GetFirst(); screen; screen = schematic.GetNext() )
|
||||||
destFileName.SetName( destFileName.GetName() + timeStamp );
|
{
|
||||||
destFileName.AppendDir( backupFolder );
|
destFileName = screen->GetFileName();
|
||||||
|
destFileName.SetName( destFileName.GetName() + timeStamp );
|
||||||
|
|
||||||
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
// Check for nest hierarchical schematic paths.
|
||||||
Prj().GetProjectFullName(),
|
if( destFileName.GetPath() != backupPath.GetPath() )
|
||||||
destFileName.GetFullPath() );
|
{
|
||||||
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
destFileName.SetPath( backupPath.GetPath() );
|
||||||
|
|
||||||
if( wxFileName::Exists( Prj().GetProjectFullName() )
|
wxArrayString srcDirs = wxFileName( screen->GetFileName() ).GetDirs();
|
||||||
&& !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
|
wxArrayString destDirs = wxFileName( Prj().GetProjectPath() ).GetDirs();
|
||||||
{
|
|
||||||
tmp.Printf( _( "Failed to back up file '%s'.\n" ), Prj().GetProjectFullName() );
|
|
||||||
errorMsg += tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Back up the cache library.
|
for( size_t i = destDirs.GetCount(); i < srcDirs.GetCount(); i++ )
|
||||||
srcFileName.SetPath( Prj().GetProjectPath() );
|
destFileName.AppendDir( srcDirs[i] );
|
||||||
srcFileName.SetName( Prj().GetProjectName() + "-cache" );
|
}
|
||||||
srcFileName.SetExt( LegacySymbolLibFileExtension );
|
else
|
||||||
|
{
|
||||||
|
destFileName.AppendDir( backupFolder );
|
||||||
|
}
|
||||||
|
|
||||||
destFileName = srcFileName;
|
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
||||||
destFileName.SetName( destFileName.GetName() + timeStamp );
|
screen->GetFileName(),
|
||||||
destFileName.AppendDir( backupFolder );
|
destFileName.GetFullPath() );
|
||||||
|
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
||||||
|
|
||||||
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
|
||||||
srcFileName.GetFullPath(),
|
{
|
||||||
destFileName.GetFullPath() );
|
tmp.Printf( _( "Failed to create backup folder '%s'.\n" ), destFileName.GetPath() );
|
||||||
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
errorMsg += tmp;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( srcFileName.Exists()
|
if( wxFileName::Exists( screen->GetFileName() )
|
||||||
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
&& !wxCopyFile( screen->GetFileName(), destFileName.GetFullPath() ) )
|
||||||
{
|
{
|
||||||
tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
|
tmp.Printf( _( "Failed to back up file '%s'.\n" ), screen->GetFileName() );
|
||||||
errorMsg += tmp;
|
errorMsg += tmp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Back up the rescue symbol library if it exists.
|
// Back up the project file.
|
||||||
srcFileName.SetName( Prj().GetProjectName() + "-rescue" );
|
destFileName = Prj().GetProjectFullName();
|
||||||
destFileName.SetName( srcFileName.GetName() + timeStamp );
|
destFileName.SetName( destFileName.GetName() + timeStamp );
|
||||||
|
destFileName.AppendDir( backupFolder );
|
||||||
|
|
||||||
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
||||||
srcFileName.GetFullPath(),
|
Prj().GetProjectFullName(),
|
||||||
destFileName.GetFullPath() );
|
destFileName.GetFullPath() );
|
||||||
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
||||||
|
|
||||||
if( srcFileName.Exists()
|
if( wxFileName::Exists( Prj().GetProjectFullName() )
|
||||||
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
&& !wxCopyFile( Prj().GetProjectFullName(), destFileName.GetFullPath() ) )
|
||||||
{
|
{
|
||||||
tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
|
tmp.Printf( _( "Failed to back up file '%s'.\n" ), Prj().GetProjectFullName() );
|
||||||
errorMsg += tmp;
|
errorMsg += tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back up the rescue symbol library document file if it exists.
|
// Back up the cache library.
|
||||||
srcFileName.SetExt( LegacySymbolDocumentFileExtension );
|
srcFileName.SetPath( Prj().GetProjectPath() );
|
||||||
destFileName.SetExt( srcFileName.GetExt() );
|
srcFileName.SetName( Prj().GetProjectName() + "-cache" );
|
||||||
|
srcFileName.SetExt( LegacySymbolLibFileExtension );
|
||||||
|
|
||||||
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
destFileName = srcFileName;
|
||||||
srcFileName.GetFullPath(),
|
destFileName.SetName( destFileName.GetName() + timeStamp );
|
||||||
destFileName.GetFullPath() );
|
destFileName.AppendDir( backupFolder );
|
||||||
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
|
||||||
|
|
||||||
if( srcFileName.Exists()
|
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
||||||
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
srcFileName.GetFullPath(),
|
||||||
{
|
destFileName.GetFullPath() );
|
||||||
tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
|
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
||||||
errorMsg += tmp;
|
|
||||||
|
if( srcFileName.Exists()
|
||||||
|
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
||||||
|
{
|
||||||
|
tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
|
||||||
|
errorMsg += tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Back up the rescue symbol library if it exists.
|
||||||
|
srcFileName.SetName( Prj().GetProjectName() + "-rescue" );
|
||||||
|
destFileName.SetName( srcFileName.GetName() + timeStamp );
|
||||||
|
|
||||||
|
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
||||||
|
srcFileName.GetFullPath(),
|
||||||
|
destFileName.GetFullPath() );
|
||||||
|
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
||||||
|
|
||||||
|
if( srcFileName.Exists()
|
||||||
|
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
||||||
|
{
|
||||||
|
tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
|
||||||
|
errorMsg += tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Back up the rescue symbol library document file if it exists.
|
||||||
|
srcFileName.SetExt( LegacySymbolDocumentFileExtension );
|
||||||
|
destFileName.SetExt( srcFileName.GetExt() );
|
||||||
|
|
||||||
|
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
||||||
|
srcFileName.GetFullPath(),
|
||||||
|
destFileName.GetFullPath() );
|
||||||
|
aReporter.Report( tmp, RPT_SEVERITY_INFO );
|
||||||
|
|
||||||
|
if( srcFileName.Exists()
|
||||||
|
&& !wxCopyFile( srcFileName.GetFullPath(), destFileName.GetFullPath() ) )
|
||||||
|
{
|
||||||
|
tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
|
||||||
|
errorMsg += tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !errorMsg.IsEmpty() )
|
if( !errorMsg.IsEmpty() )
|
||||||
|
|
Loading…
Reference in New Issue