Gerbview: show a message instead of an error when trying to open a job file as plot file.

Fixes #4844
https://gitlab.com/kicad/code/kicad/issues/4844
This commit is contained in:
jean-pierre charras 2020-07-10 13:59:35 +02:00
parent 7201e9d7eb
commit ef0ae8a8ee
2 changed files with 26 additions and 4 deletions

View File

@ -316,7 +316,17 @@ bool GERBVIEW_FRAME::loadListOfGerberAndDrillFiles( const wxString& aPath,
}
else
{
if( Read_GERBER_File( filename.GetFullPath() ) )
if( filename.GetExt() == GerberJobFileExtension.c_str() )
{
//We cannot read a gerber job file as a gerber plot file: skip it
wxString txt;
txt.Printf(
_( "<b>A gerber job file cannot be loaded as a plot file</b> <i>%s</i>" ),
filename.GetFullName() );
success = false;
reporter.Report( txt, RPT_SEVERITY_ERROR );
}
else if( Read_GERBER_File( filename.GetFullPath() ) )
{
UpdateFileHistory( m_lastFileName );
@ -545,6 +555,18 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
continue;
}
if( curr_ext == GerberJobFileExtension.c_str() )
{
//We cannot read a gerber job file as a gerber plot file: skip it
if( aReporter )
{
msg.Printf( _( "Info: skip file \"%s\" (gerber job file)\n" ), entry->GetName() );
aReporter->Report( msg, RPT_SEVERITY_WARNING );
}
continue;
}
int layer = GetActiveLayer();
if( layer == NO_AVAILABLE_LAYERS )

View File

@ -57,8 +57,8 @@ OPT<TOOL_EVENT> GERBVIEW_ACTIONS::TranslateLegacyId( int aId )
//
TOOL_ACTION GERBVIEW_ACTIONS::openGerber( "gerbview.Control.openGerber",
AS_GLOBAL, 0, "",
_( "Open Gerber File(s)..." ),
_( "Open Gerber file(s) on the current layer. Previous data will be deleted" ),
_( "Open Gerber Plot File(s)..." ),
_( "Open Gerber plot file(s) on the current layer. Previous data will be deleted" ),
load_gerber_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::openDrillFile( "gerbview.Control.openDrillFile",
@ -70,7 +70,7 @@ TOOL_ACTION GERBVIEW_ACTIONS::openDrillFile( "gerbview.Control.openDrillFile",
TOOL_ACTION GERBVIEW_ACTIONS::openJobFile( "gerbview.Control.openJobFile",
AS_GLOBAL, 0, "",
_( "Open Gerber Job File..." ),
_( "Open a Gerber job file and its associated gerber files" ),
_( "Open a Gerber job file and its associated gerber plot files" ),
gerber_job_file_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::openZipFile( "gerbview.Control.openZipFile",