Library Editor: fixed an assert after removing libraries with Symbol Library Table dialog
This commit is contained in:
parent
d76f7d7bd2
commit
6b74f8ef48
|
@ -253,6 +253,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
m_canvas->SetEnableBlockCommands( true );
|
m_canvas->SetEnableBlockCommands( true );
|
||||||
|
|
||||||
m_libMgr = new LIB_MANAGER( *this );
|
m_libMgr = new LIB_MANAGER( *this );
|
||||||
|
SyncLibraries();
|
||||||
m_treePane = new CMP_TREE_PANE( this, m_libMgr );
|
m_treePane = new CMP_TREE_PANE( this, m_libMgr );
|
||||||
|
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
|
@ -485,7 +486,6 @@ void LIB_EDIT_FRAME::OnEditSymbolLibTable( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
SCH_BASE_FRAME::OnEditSymbolLibTable( aEvent );
|
SCH_BASE_FRAME::OnEditSymbolLibTable( aEvent );
|
||||||
SyncLibraries();
|
SyncLibraries();
|
||||||
m_treePane->Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1616,14 +1616,21 @@ wxString LIB_EDIT_FRAME::getTargetLib() const
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::SyncLibraries()
|
void LIB_EDIT_FRAME::SyncLibraries()
|
||||||
{
|
{
|
||||||
|
auto tree = m_treePane ? m_treePane->GetCmpTree() : nullptr;
|
||||||
wxBusyCursor cursor;
|
wxBusyCursor cursor;
|
||||||
|
|
||||||
|
if( tree )
|
||||||
|
tree->Freeze();
|
||||||
|
|
||||||
wxProgressDialog progressDlg( _( "Loading symbol libraries" ),
|
wxProgressDialog progressDlg( _( "Loading symbol libraries" ),
|
||||||
wxEmptyString, m_libMgr->GetAdapter()->GetLibrariesCount(), this );
|
wxEmptyString, m_libMgr->GetAdapter()->GetLibrariesCount(), this );
|
||||||
|
|
||||||
m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName ) {
|
m_libMgr->Sync( true, [&]( int progress, int max, const wxString& libName ) {
|
||||||
progressDlg.Update( progress, wxString::Format( _( "Loading library '%s'" ), libName ) );
|
progressDlg.Update( progress, wxString::Format( _( "Loading library '%s'" ), libName ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
if( tree )
|
||||||
|
tree->Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ CMP_TREE_PANE::CMP_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMgr )
|
||||||
// Create widgets
|
// Create widgets
|
||||||
wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_libEditFrame->SyncLibraries();
|
|
||||||
m_tree = new COMPONENT_TREE( this, &SYMBOL_LIB_TABLE::GetGlobalLibTable(),
|
m_tree = new COMPONENT_TREE( this, &SYMBOL_LIB_TABLE::GetGlobalLibTable(),
|
||||||
m_libMgr->GetAdapter(), COMPONENT_TREE::SEARCH );
|
m_libMgr->GetAdapter(), COMPONENT_TREE::SEARCH );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue