Library Manager: select library when none is set for import/create new part

This commit is contained in:
Maciej Suminski 2017-11-13 12:30:03 +01:00
parent bb83b73f76
commit a2b6c8e20a
2 changed files with 17 additions and 2 deletions

View File

@ -49,6 +49,14 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
m_lastDrawItem = NULL;
wxString libName = getTargetLib();
if( !m_libMgr->LibraryExists( libName ) )
{
libName = SelectLibraryFromList();
if( !m_libMgr->LibraryExists( libName ) )
return;
}
wxFileDialog dlg( this, _( "Import Symbol" ), m_mruPath,
wxEmptyString, SchematicLibraryFileWildcard(),
wxFD_OPEN | wxFD_FILE_MUST_EXIST );

View File

@ -319,6 +319,15 @@ void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event )
{
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
m_drawItem = NULL;
wxString lib = getTargetLib();
if( !m_libMgr->LibraryExists( lib ) )
{
lib = SelectLibraryFromList();
if( !m_libMgr->LibraryExists( lib ) )
return;
}
DIALOG_LIB_NEW_COMPONENT dlg( this );
dlg.SetMinSize( dlg.GetSize() );
@ -335,8 +344,6 @@ void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event )
wxString name = dlg.GetName();
name.Replace( " ", "_" );
wxString lib = getTargetLib();
// Test if there is a component with this name already.
if( !lib.empty() && m_libMgr->PartExists( name, lib ) )
{