33#include <wx/listbox.h>
35#include <wx/stattext.h>
42 m_description(
nullptr ),
44 m_sourcesList(
nullptr ),
45 m_manageButton(
nullptr )
47 wxBoxSizer* topSizer =
new wxBoxSizer( wxVERTICAL );
49 m_description =
new wxStaticText(
this, wxID_ANY,
50 _(
"Install schematic data sources from the Plugin and Content Manager. Data sources extend KiCad by linking schematic items to external data providers." ) );
51 m_description->Wrap( FromDIP( 480 ) );
53 topSizer->Add( m_description, 0, wxBOTTOM | wxEXPAND, FromDIP( 12 ) );
55 m_sourcesList =
new wxListBox(
this, wxID_ANY );
56 m_sourcesList->SetMinSize( FromDIP( wxSize( -1, 160 ) ) );
57 topSizer->Add( m_sourcesList, 1, wxBOTTOM | wxEXPAND, FromDIP( 12 ) );
59 m_status =
new wxStaticText(
this, wxID_ANY, wxEmptyString );
61 topSizer->Add( m_status, 0, wxBOTTOM | wxEXPAND, FromDIP( 12 ) );
63 m_manageButton =
new wxButton(
this, wxID_ANY,
_(
"Manage Data Sources..." ) );
64 topSizer->Add( m_manageButton, 0, wxALIGN_RIGHT );
75 m_pcm->SetRepositoryList( cfg->m_PcmRepositories );
99 std::vector<wxString> entries;
105 : entry.package.type;
110 wxString label = entry.package.name;
112 if( !entry.current_version.IsEmpty() )
113 label << wxS(
" (" ) << entry.current_version << wxS(
")" );
115 if( !entry.repository_name.IsEmpty() )
116 label << wxS(
" — " ) << entry.repository_name;
118 entries.push_back( label );
121 if( entries.empty() )
123 m_status->SetLabel(
_(
"No data sources are currently installed." ) );
127 std::sort( entries.begin(), entries.end(),
128 [](
const wxString& a,
const wxString& b )
130 return a.CmpNoCase( b ) < 0;
133 for(
const wxString& label : entries )
136 m_status->SetLabel(
_(
"Installed data sources are listed above." ) );
Implementing pcm main dialog.
void SetActivePackageType(PCM_PACKAGE_TYPE aType)
The base frame for deriving all KiCad main window classes.
bool TransferDataToWindow() override
void OnManageDataSources(wxCommandEvent &aEvent)
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
void ResetPanel() override
Reset the contents of this panel.
wxListBox * m_sourcesList
void populateInstalledSources()
PANEL_SCH_DATA_SOURCES(wxWindow *aParent, EDA_BASE_FRAME *aFrame)
bool TransferDataFromWindow() override
Main class of Plugin and Content Manager subsystem.
RESETTABLE_PANEL(wxWindow *aParent, wxWindowID aId=wxID_ANY, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxSize(-1,-1), long aStyle=wxTAB_TRAVERSAL, const wxString &aName=wxEmptyString)
Base window classes and related definitions.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
PCM_PACKAGE_TYPE
< Supported package types
T * GetAppSettings(const char *aFilename)
Functions to provide common constants and other functions to assist in making a consistent UI.