Don't display busy cursor over remap symbols dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/11648
This commit is contained in:
Jeff Young 2022-09-10 09:30:35 +01:00
parent f87bf3c46d
commit bcaca947b9
1 changed files with 120 additions and 114 deletions

View File

@ -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,6 +358,9 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
} }
} }
{
wxBusyCursor busy;
// Time stamp to append to file name in case multiple remappings are performed. // Time stamp to append to file name in case multiple remappings are performed.
wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" ); wxString timeStamp = wxDateTime::Now().Format( "-%Y-%m-%d-%H-%M-%S" );
@ -490,6 +495,7 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() ); tmp.Printf( _( "Failed to back up file '%s'.\n" ), srcFileName.GetFullPath() );
errorMsg += tmp; errorMsg += tmp;
} }
}
if( !errorMsg.IsEmpty() ) if( !errorMsg.IsEmpty() )
{ {