From 1c0d4ac02d9ec2c8bf2e7166a805a5138ce6fbe1 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 18 Dec 2020 00:25:51 +0000 Subject: [PATCH] Simplify some error messages. --- common/fp_lib_table.cpp | 5 ++-- cvpcb/readwrite_dlgs.cpp | 10 ++++---- eeschema/dialogs/panel_sym_lib_table.cpp | 29 +++++++++++++----------- eeschema/symbol_lib_table.cpp | 7 +++--- pcbnew/dialogs/panel_fp_lib_table.cpp | 21 +++++++++-------- pcbnew/footprint_editor_utils.cpp | 14 ++++++------ 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 1b4580a6cf..003884f864 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -290,9 +290,8 @@ const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname ) if( !row ) { - wxString msg = wxString::Format( - _( "fp-lib-table files contain no library with nickname \"%s\"" ), - aNickname ); + wxString msg = wxString::Format( _( "fp-lib-table files contain no library named '%s'." ), + aNickname ); THROW_IO_ERROR( msg ); } diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index 1bf17d4fa0..e45e077237 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -112,12 +112,10 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist ) // Check if footprint links were generated before the footprint library table was implemented. if( hasMissingNicks ) { - msg = _( - "Some of the assigned footprints are legacy entries (are missing lib nicknames). " - "Would you like CvPcb to attempt to convert them to the new required LIB_ID format? " - "(If you answer no, then these assignments will be cleared out and you will " - "have to re-assign these footprints yourself.)" - ); + msg = _( "Some of the assigned footprints are legacy entries with no library names. Would " + "you like Kicad to attempt to convert them to the new required LIB_ID format? " + "(If you answer no, then these assignments will be cleared and you will need to " + "re-assign them manually.)" ); if( IsOK( this, msg ) ) { diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 0bdd9a1ca8..7fff77fddf 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -331,7 +331,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables() } else if( ( illegalCh = LIB_ID::FindIllegalLibraryNameChar( nick ) ) ) { - wxString msg = wxString::Format( _( "Illegal character '%c' in Nickname: \"%s\"" ), + wxString msg = wxString::Format( _( "Illegal character '%c' in nickname '%s'" ), illegalCh, nick ); @@ -342,7 +342,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables() m_cur_grid->MakeCellVisible( r, 0 ); m_cur_grid->SetGridCursor( r, 1 ); - wxMessageDialog errdlg( this, msg, _( "No Colon in Nicknames" ) ); + wxMessageDialog errdlg( this, msg, _( "Library Nickname Error" ) ); errdlg.ShowModal(); return false; } @@ -372,7 +372,9 @@ bool PANEL_SYM_LIB_TABLE::verifyTables() if( nick1 == nick2 ) { - wxString msg = wxString::Format( _( "Duplicate Nickname: \"%s\"." ), nick1 ); + wxString msg = wxString::Format( _( "Multiple libraries cannot share the same " + "nickname ('%s')." ), + nick1 ); // show the tabbed panel holding the grid we have flunked: if( model != cur_model() ) @@ -382,7 +384,7 @@ bool PANEL_SYM_LIB_TABLE::verifyTables() m_cur_grid->MakeCellVisible( r2, 0 ); m_cur_grid->SetGridCursor( r2, 1 ); - wxMessageDialog errdlg( this, msg, _( "Please Delete or Modify One" ) ); + wxMessageDialog errdlg( this, msg, _( "Library Nickname Error" ) ); errdlg.ShowModal(); return false; @@ -460,27 +462,28 @@ void PANEL_SYM_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) bool addDuplicates = false; bool applyToAll = false; wxString warning = _( "Warning: Duplicate Nickname" ); - wxString msg = _( "A library nicknamed \"%s\" already exists." ); - wxString detailedMsg = _( "Please change the library nickname after adding this library." ); + wxString msg = _( "A library nicknamed '%s' already exists." ); + wxString detailedMsg = _( "One of the nicknames will need to be changed after " + "adding this library." ); wxArrayString files; dlg.GetFilenames( files ); - for( const auto& file : files ) + for( const wxString& file : files ) { - wxString filePath = dlg.GetDirectory() + wxFileName::GetPathSeparator() + file; + wxString filePath = dlg.GetDirectory() + wxFileName::GetPathSeparator() + file; wxFileName fn( filePath ); - wxString nickname = LIB_ID::FixIllegalChars( fn.GetName() ); - bool doAdd = true; + wxString nickname = LIB_ID::FixIllegalChars( fn.GetName() ); + bool doAdd = true; if( cur_model()->ContainsNickname( nickname ) ) { if( !applyToAll ) { // The cancel button adds the library to the table anyway - addDuplicates = ( OKOrCancelDialog( this, warning, - wxString::Format( msg, nickname ), - detailedMsg, _( "Skip" ), _( "Add Anyway" ), &applyToAll ) == wxID_CANCEL ); + addDuplicates = OKOrCancelDialog( this, warning, wxString::Format( msg, nickname ), + detailedMsg, _( "Skip" ), _( "Add Anyway" ), + &applyToAll ) == wxID_CANCEL; } doAdd = addDuplicates; diff --git a/eeschema/symbol_lib_table.cpp b/eeschema/symbol_lib_table.cpp index 67a645dd62..6765df3306 100644 --- a/eeschema/symbol_lib_table.cpp +++ b/eeschema/symbol_lib_table.cpp @@ -225,9 +225,10 @@ void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) { delete tmp; // The table did not take ownership of the row. - wxString msg = wxString::Format( - _( "Duplicate library nickname \"%s\" found in symbol library " - "table file line %d" ), nickname, lineNum ); + wxString msg = wxString::Format( _( "Duplicate library nickname '%s' found in symbol " + "library table file line %d" ), + nickname, + lineNum ); if( !errMsg.IsEmpty() ) errMsg << '\n'; diff --git a/pcbnew/dialogs/panel_fp_lib_table.cpp b/pcbnew/dialogs/panel_fp_lib_table.cpp index 3c6e386232..f7009eb7fe 100644 --- a/pcbnew/dialogs/panel_fp_lib_table.cpp +++ b/pcbnew/dialogs/panel_fp_lib_table.cpp @@ -534,7 +534,7 @@ bool PANEL_FP_LIB_TABLE::verifyTables() } else if( ( illegalCh = LIB_ID::FindIllegalLibraryNameChar( nick ) ) ) { - wxString msg = wxString::Format( _( "Illegal character '%c' in Nickname: \"%s\"" ), + wxString msg = wxString::Format( _( "Illegal character '%c' in nickname '%s'." ), illegalCh, nick ); @@ -575,7 +575,9 @@ bool PANEL_FP_LIB_TABLE::verifyTables() if( nick1 == nick2 ) { - wxString msg = wxString::Format( _( "Duplicate nicknames \"%s\"." ), nick1 ); + wxString msg = wxString::Format( _( "Multiple libraries cannot share the same " + "nickname ('%s')." ), + nick1 ); // show the tabbed panel holding the grid we have flunked: if( model != cur_model() ) @@ -840,9 +842,10 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables(); bool addDuplicates = false; bool applyToAll = false; - wxString warning = _( "Warning: Duplicate Nickname" ); - wxString msg = _( "A library nicknamed \"%s\" already exists." ); - wxString detailedMsg = _( "Please change the library nickname after adding this library." ); + wxString warning = _( "Warning: Duplicate Nicknames" ); + wxString msg = _( "A library nicknamed '%s' already exists." ); + wxString detailedMsg = _( "One of the nicknames will need to be changed after " + "adding this library." ); for( const auto& filePath : files ) { @@ -855,11 +858,9 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event ) if( !applyToAll ) { // The cancel button adds the library to the table anyway - addDuplicates = ( OKOrCancelDialog( this, warning, - wxString::Format( msg, nickname ), - detailedMsg, - _( "Skip" ), _( "Add Anyway" ), - &applyToAll ) == wxID_CANCEL ); + addDuplicates = OKOrCancelDialog( this, warning, wxString::Format( msg, nickname ), + detailedMsg, _( "Skip" ), _( "Add Anyway" ), + &applyToAll ) == wxID_CANCEL; } doAdd = addDuplicates; diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 52f016d8bf..f4e13374a8 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -270,16 +270,16 @@ void FOOTPRINT_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) if( !payload.empty() ) { wxFileName fpFileName( payload ); - wxString libNickname; - wxString msg; + wxString libNickname; + wxString msg; FP_LIB_TABLE* libTable = Prj().PcbFootprintLibs(); const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( fpFileName.GetPath() ); if( !libTableRow ) { - msg.Printf( _( "The current configuration does not include the footprint library\n" - "\"%s\".\nUse Manage Footprint Libraries to edit the configuration." ), + msg.Printf( _( "The current configuration does not include a library named '%s'.\n" + "Use Manage Footprint Libraries to edit the configuration." ), fpFileName.GetPath() ); DisplayErrorMessage( this, _( "Library not found in footprint library table." ), msg ); break; @@ -289,9 +289,9 @@ void FOOTPRINT_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) if( !libTable->HasLibrary( libNickname, true ) ) { - msg.Printf( _( "The library with the nickname \"%s\" is not enabled\n" - "in the current configuration. Use Manage Footprint Libraries to\n" - "edit the configuration." ), libNickname ); + msg.Printf( _( "The library '%s' is not enabled in the current configuration.\n" + "Use Manage Footprint Libraries to edit the configuration." ), + libNickname ); DisplayErrorMessage( this, _( "Footprint library not enabled." ), msg ); break; }