Don't bail out of loading when one library couldn't be found.

Also includes some cleanup to the error dialog (removing
sunken border, fixing OK button, etc.)

Fixes: lp:1749572
* https://bugs.launchpad.net/kicad/+bug/1749572
This commit is contained in:
Jeff Young 2018-02-10 23:10:39 +00:00 committed by Maciej Suminski
parent 570f4dd991
commit 809093acd0
6 changed files with 30 additions and 24 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 2 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -16,12 +16,12 @@ DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent,
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_htmlWindow = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxSUNKEN_BORDER );
m_htmlWindow = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
m_htmlWindow->SetMinSize( wxSize( 400,250 ) );
bMainSizer->Add( m_htmlWindow, 1, wxEXPAND, 5 );
bMainSizer->Add( m_htmlWindow, 1, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonClose->SetDefault();
bMainSizer->Add( m_buttonClose, 0, wxALIGN_RIGHT|wxALL, 5 );

View File

@ -95,7 +95,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxHtmlWindow" expanded="1">
<property name="BottomDockable">1</property>
@ -148,7 +148,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxSUNKEN_BORDER</property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -210,7 +210,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Close</property>
<property name="label">OK</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -228,7 +228,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxBU_EXACTFIT</property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 2 2018)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -35,7 +35,7 @@ HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString& aTitle) :
ListClear();
// Gives a default logical size (the actual size depends on the display definition)
SetSizeInDU( 240, 150 );
SetSizeInDU( 320, 120 );
Center();
}

View File

@ -148,6 +148,12 @@ class FP_CACHE
wxDateTime m_mod_time; /// Footprint library path modified time stamp.
MODULE_MAP m_modules; /// Map of footprint file name per MODULE*.
bool m_represents_non_existant_dir; // Indicates this cache represents a directory
// which does not exist. This forces
// GetLibModificationTime() to return 0 (at least
// until the directory is found, at which point it
// will return Now).
public:
FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath );
@ -204,13 +210,19 @@ FP_CACHE::FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath )
{
m_owner = aOwner;
m_lib_path.SetPath( aLibraryPath );
m_represents_non_existant_dir = false;
}
wxDateTime FP_CACHE::GetLibModificationTime() const
{
if( !m_lib_path.DirExists() )
return wxDateTime::Now();
{
if( m_represents_non_existant_dir )
return wxDateTime( 0.0 );
else
return wxDateTime::Now();
}
return m_lib_path.GetModificationTime();
}
@ -280,10 +292,14 @@ void FP_CACHE::Save()
void FP_CACHE::Load()
{
m_represents_non_existant_dir = false;
wxDir dir( m_lib_path.GetPath() );
if( !dir.IsOpened() )
{
m_represents_non_existant_dir = true;
wxString msg = wxString::Format(
_( "Footprint library path \"%s\" does not exist" ),
GetChars( m_lib_path.GetPath() )
@ -1958,18 +1974,10 @@ void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames,
LOCALE_IO toggle; // toggles on, then off, the C locale.
wxDir dir( aLibraryPath );
if( !dir.IsOpened() )
{
THROW_IO_ERROR( wxString::Format( _( "footprint library path \"%s\" does not exist" ),
GetChars( aLibraryPath ) ) );
}
init( aProperties );
wxString errorMsg;
// Some of the files may have been parsed correctly so we want to add the valid files to
// the library.
try
{
cacheLib( aLibraryPath );
@ -1979,6 +1987,9 @@ void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames,
errorMsg = ioe.What();
}
// Some of the files may have been parsed correctly so we want to add the valid files to
// the library.
const MODULE_MAP& mods = m_cache->GetModules();
for( MODULE_CITER it = mods.begin(); it != mods.end(); ++it )

View File

@ -390,19 +390,14 @@ wxString PCB_BASE_FRAME::SelectFootprint( EDA_DRAW_FRAME* aWindow,
MList.ReadFootprintFiles( aTable, !aLibraryName ? NULL : &aLibraryName );
if( MList.GetErrorCount() )
{
MList.DisplayErrors( this );
return wxEmptyString;
}
if( MList.GetCount() == 0 )
{
wxString tmp;
for( unsigned i = 0; i < libraries.GetCount(); i++ )
{
tmp += libraries[i] + wxT( "\n" );
}
msg.Printf( _( "No footprints could be read from library file(s):\n\n%s\nin any of "
"the library search paths. Verify your system is configured properly "