From bf85eb9b4e661c016d118c5ba9b80acb345152bd Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 23 May 2019 10:08:32 +0100 Subject: [PATCH] pcbnew: Fixed listing of 3D libraries in the github wizard Fixes: lp:1830137 * https://bugs.launchpad.net/kicad/+bug/1830137 (cherry picked from commit 0daf14f9c36aa027b52ee27eaeb4d863b2571568) --- .../wizard_3DShape_Libs_downloader.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pcbnew/dialogs/wizard_3DShape_Libs_downloader.cpp b/pcbnew/dialogs/wizard_3DShape_Libs_downloader.cpp index 10d8a71bf1..57f5da49cc 100644 --- a/pcbnew/dialogs/wizard_3DShape_Libs_downloader.cpp +++ b/pcbnew/dialogs/wizard_3DShape_Libs_downloader.cpp @@ -512,10 +512,27 @@ void WIZARD_3DSHAPE_LIBS_DOWNLOADER::setupGithubList() m_checkList3Dlibnames->GetCheckedItems( checkedIndices ); enableNext( checkedIndices.GetCount() > 0 ); - // Update only if necessary - if( m_githubLibs.GetCount() == 0 ) + // Update only if the text has changed or the list is empty + if( m_githubLibs.GetCount() == 0 || m_textCtrlGithubURL->IsModified() ) + { + m_githubLibs.Clear(); getLibsListGithub( m_githubLibs ); + // Populate the list + m_checkList3Dlibnames->Clear(); + for( unsigned int i = 0; i < m_githubLibs.GetCount(); ++i ) + { + const wxString& lib = m_githubLibs[i].AfterLast( '/' ); + m_checkList3Dlibnames->Append( lib ); + } + + m_textCtrlGithubURL->SetModified( 0 ); + } + + if( !m_checkList3Dlibnames->IsEmpty() ) + m_checkList3Dlibnames->EnsureVisible( 0 ); + + // Clear the search box m_searchCtrl3Dlibs->Clear(); // Clear the review list so it will be reloaded