WIZARD_3DSHAPE_LIBS_DOWNLOADER: make it compatible with last url packages3D changes in kicad github repo
This commit is contained in:
parent
0633d90ae4
commit
22e95aab8b
|
@ -158,7 +158,7 @@ void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnSourceCheck( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnGridLibReviewSize( wxSizeEvent& event )
|
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnGridLibReviewSize( wxSizeEvent& event )
|
||||||
{
|
{
|
||||||
// Adjust the width of the column 1 afo m_gridLibReview (library names) to the
|
// Adjust the width of the column 1 of m_gridLibReview (library names) to the
|
||||||
// max available width.
|
// max available width.
|
||||||
int gridwidth = m_gridLibReview->GetClientSize().x;
|
int gridwidth = m_gridLibReview->GetClientSize().x;
|
||||||
gridwidth -= m_gridLibReview->GetColSize( 0 ) + m_gridLibReview->GetColLabelSize();
|
gridwidth -= m_gridLibReview->GetColSize( 0 ) + m_gridLibReview->GetColLabelSize();
|
||||||
|
@ -262,7 +262,7 @@ void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnChangeSearch( wxCommandEvent& aEvent )
|
||||||
bool wasChecked = ( checkedStrings.Index( lib ) != wxNOT_FOUND );
|
bool wasChecked = ( checkedStrings.Index( lib ) != wxNOT_FOUND );
|
||||||
int insertedIdx = -1;
|
int insertedIdx = -1;
|
||||||
|
|
||||||
if( !searchPhrase.IsEmpty() && lib.Lower().Contains( searchPhrase ) )
|
if( !searchPhrase.IsEmpty() && lib.Lower().BeforeLast( '.' ).Contains( searchPhrase ) )
|
||||||
{
|
{
|
||||||
insertedIdx = m_checkList3Dlibnames->Insert( lib, matching++ );
|
insertedIdx = m_checkList3Dlibnames->Insert( lib, matching++ );
|
||||||
m_checkList3Dlibnames->SetSelection( insertedIdx );
|
m_checkList3Dlibnames->SetSelection( insertedIdx );
|
||||||
|
@ -359,15 +359,28 @@ bool WIZARD_3DSHAPE_LIBS_DOWNLOADER::downloadGithubLibsFromList( wxArrayString&
|
||||||
aUrlList.GetCount(), GetParent(),
|
aUrlList.GetCount(), GetParent(),
|
||||||
wxPD_CAN_ABORT | wxPD_APP_MODAL | wxPD_AUTO_HIDE );
|
wxPD_CAN_ABORT | wxPD_APP_MODAL | wxPD_AUTO_HIDE );
|
||||||
|
|
||||||
wxString url_base = GetGithubURL();
|
// Built the full server name string:
|
||||||
|
wxURI repo( GetGithubURL() );
|
||||||
|
wxString server = repo.GetScheme() + "://" + repo.GetServer();
|
||||||
|
|
||||||
// Download libs:
|
// Download libs:
|
||||||
for( unsigned ii = 0; ii < aUrlList.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < aUrlList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
wxString& libsrc_name = aUrlList[ii];
|
wxString& libsrc_name = aUrlList[ii];
|
||||||
|
|
||||||
// Extract the lib name from the full URL:
|
// Recover the full URL lib from short name:
|
||||||
wxString url = GetGithubURL() + wxT( "/" ) + libsrc_name;
|
// (note: m_githubLibs stores the URL relative to the server name)
|
||||||
|
wxString url;
|
||||||
|
|
||||||
|
for( unsigned jj = 0; jj < m_githubLibs.GetCount(); jj++ )
|
||||||
|
{
|
||||||
|
if( m_githubLibs[jj].EndsWith( libsrc_name ) )
|
||||||
|
{
|
||||||
|
url = server + m_githubLibs[jj];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxFileName fn( libsrc_name );
|
wxFileName fn( libsrc_name );
|
||||||
// Set our local path
|
// Set our local path
|
||||||
fn.SetPath( getDownloadDir() );
|
fn.SetPath( getDownloadDir() );
|
||||||
|
|
|
@ -68,7 +68,12 @@ public:
|
||||||
void OnPageChanged( wxWizardEvent& aEvent ) override;
|
void OnPageChanged( wxWizardEvent& aEvent ) override;
|
||||||
void OnSelectAll3Dlibs( wxCommandEvent& aEvent ) override;
|
void OnSelectAll3Dlibs( wxCommandEvent& aEvent ) override;
|
||||||
void OnUnselectAll3Dlibs( wxCommandEvent& aEvent ) override;
|
void OnUnselectAll3Dlibs( wxCommandEvent& aEvent ) override;
|
||||||
|
|
||||||
|
/** Called when the content of m_searchCtrl3Dlibs has changed.
|
||||||
|
* Rebuild the list of libraries, lib cacdidate first
|
||||||
|
*/
|
||||||
void OnChangeSearch( wxCommandEvent& aEvent ) override;
|
void OnChangeSearch( wxCommandEvent& aEvent ) override;
|
||||||
|
|
||||||
void OnWizardFinished( wxWizardEvent& aEvent ) override;
|
void OnWizardFinished( wxWizardEvent& aEvent ) override;
|
||||||
void OnBrowseButtonClick( wxCommandEvent& aEvent ) override;
|
void OnBrowseButtonClick( wxCommandEvent& aEvent ) override;
|
||||||
void OnCheckSaveCopy( wxCommandEvent& aEvent );
|
void OnCheckSaveCopy( wxCommandEvent& aEvent );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
// C++ code generated with wxFormBuilder (version Jul 2 2017)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -36,7 +36,7 @@ WIZARD_3DSHAPE_LIBS_DOWNLOADER_BASE::WIZARD_3DSHAPE_LIBS_DOWNLOADER_BASE( wxWind
|
||||||
m_staticText8->Wrap( -1 );
|
m_staticText8->Wrap( -1 );
|
||||||
bSizer19->Add( m_staticText8, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
bSizer19->Add( m_staticText8, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_textCtrlGithubURL = new wxTextCtrl( m_wizPage1, wxID_ANY, _("http://github.com/KiCad"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_textCtrlGithubURL = new wxTextCtrl( m_wizPage1, wxID_ANY, _("https://github.com/KiCad/packages3d"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_textCtrlGithubURL->SetMinSize( wxSize( 300,-1 ) );
|
m_textCtrlGithubURL->SetMinSize( wxSize( 300,-1 ) );
|
||||||
|
|
||||||
bSizer19->Add( m_textCtrlGithubURL, 0, wxALL|wxEXPAND, 5 );
|
bSizer19->Add( m_textCtrlGithubURL, 0, wxALL|wxEXPAND, 5 );
|
||||||
|
|
|
@ -378,7 +378,7 @@
|
||||||
<property name="validator_style">wxFILTER_NONE</property>
|
<property name="validator_style">wxFILTER_NONE</property>
|
||||||
<property name="validator_type">wxDefaultValidator</property>
|
<property name="validator_type">wxDefaultValidator</property>
|
||||||
<property name="validator_variable"></property>
|
<property name="validator_variable"></property>
|
||||||
<property name="value">http://github.com/KiCad</property>
|
<property name="value">https://github.com/KiCad/packages3d</property>
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
// C++ code generated with wxFormBuilder (version Jul 2 2017)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
|
|
@ -65,10 +65,9 @@ bool GITHUB_GETLIBLIST::Get3DshapesLibsList( wxArrayString* aList,
|
||||||
|
|
||||||
strcpy( m_option_string, "text/html" );
|
strcpy( m_option_string, "text/html" );
|
||||||
|
|
||||||
wxString repoURL = m_repoURL;
|
|
||||||
|
|
||||||
wxString errorMsg;
|
wxString errorMsg;
|
||||||
|
|
||||||
|
wxString repoURL = m_repoURL;
|
||||||
fullURLCommand = repoURL.utf8_str();
|
fullURLCommand = repoURL.utf8_str();
|
||||||
bool success = remoteGetJSON( fullURLCommand, &errorMsg );
|
bool success = remoteGetJSON( fullURLCommand, &errorMsg );
|
||||||
|
|
||||||
|
@ -95,7 +94,7 @@ bool GITHUB_GETLIBLIST::GetFootprintLibraryList( wxArrayString& aList )
|
||||||
{
|
{
|
||||||
std::string fullURLCommand;
|
std::string fullURLCommand;
|
||||||
int page = 1;
|
int page = 1;
|
||||||
int itemCountMax = 99; // Do not use a valu > 100, it does not work
|
int itemCountMax = 99; // Do not use a value >= 100, it does not work
|
||||||
|
|
||||||
strcpy( m_option_string, "application/json" );
|
strcpy( m_option_string, "application/json" );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue