Simplify some error messages.

This commit is contained in:
Jeff Young 2020-12-18 00:25:51 +00:00
parent 91ab540d18
commit 1c0d4ac02d
6 changed files with 44 additions and 42 deletions

View File

@ -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 );
}

View File

@ -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 ) )
{

View File

@ -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;

View File

@ -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';

View File

@ -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;

View File

@ -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;
}