CvPcb: remove footprint library load failure limit. (fixes lp:1553756)
* Remove the artificial footprint library read error limit to prevent potentially readable libraries from being loaded after the error limit is reached. * Change error message dialog to an HTML dialog so that potentially large error messages can be displayed with scrolling and the ability to copy and paste the error message for bug reporting purposes. * Add busy cursor when loading the footprint libraries so the user has some idea that something is happening while the footprint libraries are being loaded.
This commit is contained in:
parent
0f89576f72
commit
5504c17787
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2011 Jean-Pierre Charras, <jp.charras@wanadoo.fr>
|
||||
* Copyright (C) 2013-2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include <fpid.h>
|
||||
#include <class_module.h>
|
||||
#include <boost/thread.hpp>
|
||||
#include <html_messagebox.h>
|
||||
|
||||
|
||||
/*
|
||||
|
@ -124,19 +125,10 @@ void FOOTPRINT_INFO::load()
|
|||
}
|
||||
|
||||
|
||||
#define NTOLERABLE_ERRORS 4 // max errors before aborting, although threads
|
||||
// in progress will still pile on for a bit. e.g. if 9 threads
|
||||
// expect 9 greater than this.
|
||||
|
||||
void FOOTPRINT_LIST::loader_job( const wxString* aNicknameList, int aJobZ )
|
||||
{
|
||||
DBG(printf( "%s: first:'%s' aJobZ:%d\n", __func__, TO_UTF8( *aNicknameList ), aJobZ );)
|
||||
|
||||
for( int i=0; i<aJobZ; ++i )
|
||||
{
|
||||
if( m_error_count >= NTOLERABLE_ERRORS )
|
||||
break;
|
||||
|
||||
const wxString& nickname = aNicknameList[i];
|
||||
|
||||
try
|
||||
|
@ -231,13 +223,6 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
|
|||
// size() is small, I'll do myself.
|
||||
for( unsigned i=0; i<nicknames.size(); )
|
||||
{
|
||||
if( m_error_count >= NTOLERABLE_ERRORS )
|
||||
{
|
||||
// abort the remaining nicknames.
|
||||
retv = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if( i + jobz >= nicknames.size() ) // on the last iteration of this for(;;)
|
||||
{
|
||||
jobz = nicknames.size() - i;
|
||||
|
@ -306,29 +291,8 @@ bool FOOTPRINT_INFO::InLibrary( const wxString& aLibrary ) const
|
|||
}
|
||||
|
||||
|
||||
#include <confirm.h> // until scaffolding goes.
|
||||
|
||||
void FOOTPRINT_LIST::DisplayErrors( wxTopLevelWindow* aWindow )
|
||||
{
|
||||
#if 1
|
||||
// scaffolding until a better one is written, hopefully below.
|
||||
|
||||
DBG(printf( "m_error_count:%d\n", m_error_count );)
|
||||
|
||||
wxString msg = _( "Errors were encountered loading footprints" );
|
||||
|
||||
msg += wxT( '\n' );
|
||||
|
||||
for( unsigned i = 0; i<m_errors.size(); ++i )
|
||||
{
|
||||
msg += m_errors[i].errorText;
|
||||
msg += wxT( '\n' );
|
||||
}
|
||||
|
||||
DisplayError( aWindow, msg );
|
||||
|
||||
#else // real evolving deal:
|
||||
|
||||
// @todo: go to a more HTML !<table>! ? centric output, possibly with
|
||||
// recommendations for remedy of errors. Add numeric error codes
|
||||
// to PARSE_ERROR, and switch on them for remedies, etc. Full
|
||||
|
@ -336,13 +300,16 @@ void FOOTPRINT_LIST::DisplayErrors( wxTopLevelWindow* aWindow )
|
|||
|
||||
HTML_MESSAGE_BOX dlg( aWindow, _( "Load Error" ) );
|
||||
|
||||
dlg.MessageSet( _( "Errors were encountered loading footprints" ) );
|
||||
dlg.MessageSet( _( "Errors were encountered loading footprints:" ) );
|
||||
|
||||
wxString msg = my html wizardry.
|
||||
wxString msg;
|
||||
|
||||
for( unsigned i = 0; i<m_errors.size(); ++i )
|
||||
{
|
||||
msg += wxT( "<p>" ) + m_errors[i].errorText + wxT( "</p>" );
|
||||
}
|
||||
|
||||
dlg.AddHTML_Text( msg );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -447,6 +447,7 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
|
|||
|
||||
if( tableChanged )
|
||||
{
|
||||
wxBusyCursor dummy;
|
||||
BuildLIBRARY_LISTBOX();
|
||||
m_FootprintsList.ReadFootprintFiles( Prj().PcbFootprintLibs() );
|
||||
}
|
||||
|
@ -724,6 +725,8 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
|||
return false;
|
||||
}
|
||||
|
||||
wxBusyCursor dummy; // Let the user know something is happening.
|
||||
|
||||
m_FootprintsList.ReadFootprintFiles( fptbl );
|
||||
|
||||
if( m_FootprintsList.GetErrorCount() )
|
||||
|
|
Loading…
Reference in New Issue