diff --git a/kicad/pcm/dialogs/panel_packages_view.cpp b/kicad/pcm/dialogs/panel_packages_view.cpp index 4f0b95ce12..89f5fe587f 100644 --- a/kicad/pcm/dialogs/panel_packages_view.cpp +++ b/kicad/pcm/dialogs/panel_packages_view.cpp @@ -393,15 +393,18 @@ void PANEL_PACKAGES_VIEW::OnVersionsCellClicked( wxGridEvent& event ) void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event ) { - const wxArrayInt rows = m_gridVersions->GetSelectedRows(); + if( m_gridVersions->GetNumberRows() == 1 ) + m_gridVersions->SelectRow( 0 ); - if( !m_currentSelected || rows.size() != 1 ) + const wxArrayInt selectedRows = m_gridVersions->GetSelectedRows(); + + if( !m_currentSelected || selectedRows.size() != 1 ) { wxBell(); return; } - wxString version = m_gridVersions->GetCellValue( rows[0], COL_VERSION ); + wxString version = m_gridVersions->GetCellValue( selectedRows[0], COL_VERSION ); const PCM_PACKAGE& package = m_currentSelected->GetPackageData().package; auto ver_it = std::find_if( package.versions.begin(), package.versions.end(), @@ -471,15 +474,18 @@ void PANEL_PACKAGES_VIEW::OnDownloadVersionClicked( wxCommandEvent& event ) void PANEL_PACKAGES_VIEW::OnInstallVersionClicked( wxCommandEvent& event ) { - const wxArrayInt rows = m_gridVersions->GetSelectedRows(); + if( m_gridVersions->GetNumberRows() == 1 ) + m_gridVersions->SelectRow( 0 ); - if( !m_currentSelected || rows.size() != 1 ) + const wxArrayInt selectedRows = m_gridVersions->GetSelectedRows(); + + if( !m_currentSelected || selectedRows.size() != 1 ) { wxBell(); return; } - wxString version = m_gridVersions->GetCellValue( rows[0], COL_VERSION ); + wxString version = m_gridVersions->GetCellValue( selectedRows[0], COL_VERSION ); const PCM_PACKAGE& package = m_currentSelected->GetPackageData().package; auto ver_it = std::find_if( package.versions.begin(), package.versions.end(), diff --git a/kicad/pcm/dialogs/panel_packages_view.h b/kicad/pcm/dialogs/panel_packages_view.h index 055a6bc358..a924c39f83 100644 --- a/kicad/pcm/dialogs/panel_packages_view.h +++ b/kicad/pcm/dialogs/panel_packages_view.h @@ -39,7 +39,7 @@ public: ~PANEL_PACKAGES_VIEW(); /** - * @brief Recreates package panels and displays daya + * @brief Recreates package panels and displays data * * @param aPackageData list of package view data * @param aCallback (un)install button callback