KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_pcm.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2021 Andrew Lutsenko, anlutsenko at gmail dot com
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21// kicad_curl_easy.h **must be** included before any wxWidgets header to avoid conflicts
22// at least on Windows/msys2
24
25#include "bitmaps.h"
27#include "dialog_pcm.h"
28#include <eda_base_frame.h>
29#include "grid_tricks.h"
30#include "ki_exception.h"
31#include "pcm_task_manager.h"
32#include "pgm_base.h"
35#include "thread"
36#include "widgets/wx_grid.h"
37
38#include <fstream>
39#include <kiplatform/ui.h>
40#include <launch_ext.h>
41#include <sstream>
42#include <vector>
43#include <wx/filedlg.h>
44#include <wx/msgdlg.h>
45
46
47#define GRID_CELL_MARGIN 4
48
49// Notes: These strings are static, so wxGetTranslation must be called to display the
50// transalted text
51static std::vector<std::pair<PCM_PACKAGE_TYPE, wxString>> PACKAGE_TYPE_LIST = {
52 { PT_PLUGIN, _( "Plugins (%d)" ) },
53 { PT_FAB, _( "Fabrication plugins (%d)" ) },
54 { PT_LIBRARY, _( "Libraries (%d)" ) },
55 { PT_DATASOURCE, _( "Data sources (%d)" ) },
56 { PT_COLORTHEME, _( "Color themes (%d)" ) },
57};
58
59
60DIALOG_PCM::DIALOG_PCM( EDA_BASE_FRAME* parent, std::shared_ptr<PLUGIN_CONTENT_MANAGER> pcm ) :
61 DIALOG_PCM_BASE( parent ),
62 m_parentFrame( parent ),
63 m_pcm( pcm )
64{
65 // correct the min size from wxfb with fromdip
66 SetMinSize( FromDIP( GetMinSize() ) );
67
68 SetDoubleBuffered( true );
69
71
72 m_pcm->SetDialogWindow( this );
73 m_pcm->StopBackgroundUpdate();
74
75 m_gridPendingActions->PushEventHandler( new GRID_TRICKS( m_gridPendingActions ) );
76
78 m_panelPending->Layout();
79
80 m_actionCallback = [this]( const PACKAGE_VIEW_DATA& aData, PCM_PACKAGE_ACTION aAction,
81 const wxString& aVersion )
82 {
83 if( aAction == PPA_UPDATE && m_pcm->IsPackagePinned( aData.package.identifier ) )
84 {
85 if( wxMessageBox( wxString::Format( _( "Are you sure you want to update pinned package "
86 "from version %s to %s?" ),
87 aData.current_version, aVersion ),
88 _( "Confirm update" ), wxICON_QUESTION | wxYES_NO, this )
89 == wxNO )
90 {
91 return;
92 }
93 }
94
95 m_gridPendingActions->Freeze();
96
97 PCM_PACKAGE_STATE new_state;
98
99 m_gridPendingActions->AppendRows();
100 int row = m_gridPendingActions->GetNumberRows() - 1;
101
102 m_gridPendingActions->SetCellValue( row, PENDING_COL_NAME, aData.package.name );
104
105 switch( aAction )
106 {
107 default:
108 case PPA_INSTALL:
109 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Install" ) );
110 m_gridPendingActions->SetCellValue( row, PENDING_COL_VERSION, aVersion );
111 new_state = PPS_PENDING_INSTALL;
112 break;
113
114 case PPA_UPDATE:
115 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Update" ) );
116 m_gridPendingActions->SetCellValue( row, PENDING_COL_VERSION,
117 wxString::Format( wxT( "%s \u279C %s" ),
118 aData.current_version,
119 aVersion ) );
120 new_state = PPS_PENDING_UPDATE;
121 break;
122
123 case PPA_UNINSTALL:
124 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Uninstall" ) );
125 m_gridPendingActions->SetCellValue( row, PENDING_COL_VERSION,
126 m_pcm->GetInstalledPackageVersion( aData.package.identifier ) );
127 new_state = PPS_PENDING_UNINSTALL;
128 break;
129 }
130
131 m_pendingActions.emplace_back( aAction, aData.repository_id, aData.package, aVersion );
132
133 m_gridPendingActions->Thaw();
134
136
137 updatePackageState( aData.package.identifier, new_state );
138 };
139
141 [this]( const wxString& aPackageId, const PCM_PACKAGE_STATE aState, const bool aPinned )
142 {
143 m_pcm->SetPinned( aPackageId, aPinned );
144
145 updatePackageState( aPackageId, aState );
146 };
147
149 m_panelInstalledHolder->GetSizer()->Add( m_installedPanel, 1, wxEXPAND );
150 m_panelInstalledHolder->Layout();
151
152 for( const std::pair<PCM_PACKAGE_TYPE, wxString>& entry : PACKAGE_TYPE_LIST )
153 {
156 wxString label = wxGetTranslation( entry.second );
157 m_contentNotebook->AddPage( panel, wxString::Format( label, 0 ) );
158 m_repositoryContentPanels.insert( { entry.first, panel } );
159 }
160
161 m_dialogNotebook->SetPageText( 0, wxString::Format( _( "Repository (%d)" ), 0 ) );
162
165
166 m_dialogNotebook->SetSelection( 0 );
167
168 SetupStandardButtons( { { wxID_OK, _( "Close" ) },
169 { wxID_APPLY, _( "Apply Pending Changes" ) },
170 { wxID_CANCEL, _( "Discard Pending Changes" ) } } );
171
172 Bind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );
173 m_sdbSizer1Cancel->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
174 m_sdbSizer1Apply->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
175
176 // Has to be called after DIALOG_SHIM reads cached values
177 CallAfter(
178 [this]()
179 {
181 } );
182
183 for( int col = 0; col < m_gridPendingActions->GetNumberCols(); col++ )
184 {
185 const wxString& heading = m_gridPendingActions->GetColLabelValue( col );
186 int headingWidth = GetTextExtent( heading ).x + 2 * GRID_CELL_MARGIN;
187
188 // Set the minimal width to the column label size.
189 m_gridPendingActions->SetColMinimalWidth( col, headingWidth );
190 }
191
192 // fix sizers now widgets are set.
194}
195
196
198{
199 Unbind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );
200 m_sdbSizer1Cancel->Unbind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
201 m_sdbSizer1Apply->Unbind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
202
203 m_pcm->SaveInstalledPackages();
204 m_pcm->SetDialogWindow( nullptr );
205 m_pcm->RunBackgroundUpdate();
206
207 m_gridPendingActions->PopEventHandler( true );
208}
209
210
212{
213 for( size_t i = 0; i < PACKAGE_TYPE_LIST.size(); ++i )
214 {
215 if( PACKAGE_TYPE_LIST[i].first == aType )
216 {
217 m_contentNotebook->SetSelection( i );
218 break;
219 }
220 }
221}
222
223
224void DIALOG_PCM::OnUpdateEventButtons( wxUpdateUIEvent& event )
225{
226 event.Enable( !m_pendingActions.empty() );
227}
228
229
230void DIALOG_PCM::OnCloseClicked( wxCommandEvent& event )
231{
232 if( m_pendingActions.size() == 0
233 || wxMessageBox( _( "Are you sure you want to close the package manager "
234 "and discard pending changes?" ),
235 _( "Plugin and Content Manager" ), wxICON_QUESTION | wxYES_NO, this )
236 == wxYES )
237 {
238 EndModal( wxID_OK );
239 }
240}
241
242
243void DIALOG_PCM::OnCloseWindow( wxCloseEvent& aEvent )
244{
245 wxCommandEvent dummy;
246
248}
249
250
251void DIALOG_PCM::OnManageRepositoriesClicked( wxCommandEvent& event )
252{
254
255 std::vector<std::pair<wxString, wxString>> dialog_data;
256 std::vector<std::tuple<wxString, wxString, wxString>> repo_list = m_pcm->GetRepositoryList();
257
258 for( const auto& [id, url, name] : repo_list )
259 dialog_data.push_back( std::make_pair( url, name ) );
260
261 dialog->SetData( dialog_data );
262
263 if( dialog->ShowModal() == wxID_SAVE )
264 {
265 dialog_data = dialog->GetData();
266 m_pcm->SetRepositoryList( dialog_data );
267
268 if( KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" ) )
269 cfg->m_PcmRepositories = std::move( dialog_data );
270
272 }
273
274 dialog->Destroy();
275}
276
277
279{
280 std::vector<std::tuple<wxString, wxString, wxString>> repositories = m_pcm->GetRepositoryList();
282
283 m_choiceRepository->Clear();
284
285 for( const auto& [id, url, name] : repositories )
286 m_choiceRepository->Append( url, new wxStringClientData( id ) );
287
288 if( repositories.size() > 0 )
289 {
290 int idx = 0;
291
292 if( cfg && !cfg->m_PcmLastSelectedRepoId.IsEmpty() )
293 {
294 auto it = std::find_if( repositories.begin(), repositories.end(),
295 [&cfg]( const auto& repo )
296 {
297 return std::get<0>( repo ) == cfg->m_PcmLastSelectedRepoId;
298 } );
299
300 if( it != repositories.end() )
301 idx = std::distance( repositories.begin(), it );
302 }
303
304 m_choiceRepository->SetSelection( idx );
305 m_selectedRepositoryId = std::get<0>( repositories[idx] );
307 }
308 else
309 {
311 }
312
313 if( cfg )
315}
316
317
318void DIALOG_PCM::OnRefreshClicked( wxCommandEvent& event )
319{
320 m_pcm->DiscardRepositoryCache( m_selectedRepositoryId );
322}
323
324
325void DIALOG_PCM::OnInstallFromFileClicked( wxCommandEvent& event )
326{
327 wxFileDialog open_file_dialog( this, _( "Install Package" ), wxEmptyString, wxEmptyString,
328 wxT( "Zip files (*.zip)|*.zip" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
329
330 KIPLATFORM::UI::AllowNetworkFileSystems( &open_file_dialog );
331
332 if( open_file_dialog.ShowModal() == wxID_CANCEL )
333 return;
334
335 PCM_TASK_MANAGER task_manager( m_pcm );
336 task_manager.InstallFromFile( this, open_file_dialog.GetPath() );
337
338 m_changed_package_types.merge( task_manager.GetChangedPackageTypes() );
339
341
342 if( !m_selectedRepositoryId.IsEmpty() )
344}
345
346
347void DIALOG_PCM::OnRepositoryChoice( wxCommandEvent& event )
348{
349 wxStringClientData* data = static_cast<wxStringClientData*>(
350 m_choiceRepository->GetClientObject( m_choiceRepository->GetSelection() ) );
351
352 m_selectedRepositoryId = data->GetData();
353
355
356 if( KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" ) )
357 cfg->m_PcmLastSelectedRepoId = m_selectedRepositoryId;
358}
359
360
361void DIALOG_PCM::setRepositoryData( const wxString& aRepositoryId )
362{
363 m_dialogNotebook->Freeze();
364
365 if( m_pcm->CacheRepository( aRepositoryId ) )
366 {
367 for( const auto& [ packageType, packagesView ] : m_repositoryContentPanels )
368 packagesView->ClearData();
369
370 m_packageBitmaps = m_pcm->GetRepositoryPackageBitmaps( aRepositoryId );
371
372 const std::vector<PCM_PACKAGE> packages = m_pcm->GetRepositoryPackages( aRepositoryId );
373
374 std::unordered_map<PCM_PACKAGE_TYPE, std::vector<PACKAGE_VIEW_DATA>> data;
375
376 for( const PCM_PACKAGE& pkg : packages )
377 {
378 if( pkg.type == PT_INVALID )
379 continue;
380
381 PACKAGE_VIEW_DATA package_data( pkg );
382
383 if( m_packageBitmaps.count( package_data.package.identifier ) > 0 )
384 package_data.bitmap = &m_packageBitmaps.at( package_data.package.identifier );
385 else
386 package_data.bitmap = &m_defaultBitmap;
387
388 package_data.state = m_pcm->GetPackageState( aRepositoryId, pkg.identifier );
389
390 if( package_data.state == PPS_INSTALLED || package_data.state == PPS_UPDATE_AVAILABLE )
391 {
392 package_data.current_version = m_pcm->GetInstalledPackageVersion( pkg.identifier );
393 package_data.pinned = m_pcm->IsPackagePinned( pkg.identifier );
394 package_data.swig_warning = m_pcm->UsesSWIGRuntime( pkg, package_data.current_version );
395 }
396 else if( !pkg.versions.empty() )
397 {
398 package_data.swig_warning = m_pcm->UsesSWIGRuntime( pkg, pkg.versions[0].version );
399 }
400
401 if( package_data.state == PPS_UPDATE_AVAILABLE )
402 package_data.update_version = m_pcm->GetPackageUpdateVersion( pkg );
403
404 for( const PENDING_ACTION& action : m_pendingActions )
405 {
406 if( action.package.identifier != pkg.identifier )
407 continue;
408
409 switch( action.action )
410 {
411 case PPA_INSTALL: package_data.state = PPS_PENDING_INSTALL; break;
412 case PPA_UPDATE: package_data.state = PPS_PENDING_UPDATE; break;
413 case PPA_UNINSTALL: package_data.state = PPS_PENDING_UNINSTALL; break;
414 }
415
416 break;
417 }
418
419 package_data.repository_id = aRepositoryId;
420 package_data.repository_name = m_choiceRepository->GetStringSelection();
421
422 // Fabrication plugins are displayed in a different tab although they are still plugins
423 PCM_PACKAGE_TYPE type = pkg.category == PC_FAB ? PT_FAB : pkg.type;
424
425 data[type].emplace_back( package_data );
426 }
427
428 for( size_t i = 0; i < PACKAGE_TYPE_LIST.size(); i++ )
429 {
430 PCM_PACKAGE_TYPE type = PACKAGE_TYPE_LIST[i].first;
431 const wxString& label = PACKAGE_TYPE_LIST[i].second;
432 m_repositoryContentPanels[type]->SetData( data[type] );
433 m_contentNotebook->SetPageText( i, wxString::Format( wxGetTranslation( label ),
434 (int) data[type].size() ) );
435 }
436
437 m_dialogNotebook->SetPageText( 0, wxString::Format( _( "Repository (%d)" ),
438 (int) packages.size() ) );
439 }
440
441 m_dialogNotebook->Thaw();
442}
443
444
446{
447 m_gridPendingActions->ClearSelection();
448 m_gridPendingActions->SelectRow( event.GetRow() );
449}
450
451
453{
454 m_dialogNotebook->SetPageText( 2, wxString::Format( _( "Pending (%d)" ),
455 (int) m_pendingActions.size() ) );
456
457 for( int col = 0; col < m_gridPendingActions->GetNumberCols(); col++ )
458 {
459 // Set the width to see the full contents
460 m_gridPendingActions->SetColSize( col, m_gridPendingActions->GetVisibleWidth( col ) );
461 }
462}
463
464
466{
467 m_installedPanel->ClearData();
468
469 const std::vector<PCM_INSTALLATION_ENTRY> installed = m_pcm->GetInstalledPackages();
470 std::vector<PACKAGE_VIEW_DATA> package_list;
471
472 m_installedBitmaps = m_pcm->GetInstalledPackageBitmaps();
473
474 for( const PCM_INSTALLATION_ENTRY& entry : installed )
475 {
476 PACKAGE_VIEW_DATA package_data( entry );
477
478 if( m_installedBitmaps.count( package_data.package.identifier ) > 0 )
479 package_data.bitmap = &m_installedBitmaps.at( package_data.package.identifier );
480 else
481 package_data.bitmap = &m_defaultBitmap;
482
483 package_data.state = m_pcm->GetPackageState( entry.repository_id,
484 entry.package.identifier );
485
486 package_data.swig_warning = m_pcm->UsesSWIGRuntime( entry.package, entry.current_version );
487
488 if( package_data.state == PPS_UPDATE_AVAILABLE )
489 package_data.update_version = m_pcm->GetPackageUpdateVersion( entry.package );
490
491 package_list.emplace_back( package_data );
492 }
493
494 m_installedPanel->SetData( package_list );
495
496 m_dialogNotebook->SetPageText( 1, wxString::Format( _( "Installed (%d)" ),
497 (int) package_list.size() ) );
498}
499
500
501void DIALOG_PCM::OnApplyChangesClicked( wxCommandEvent& event )
502{
503 if( m_pendingActions.size() == 0 )
504 return;
505
506 m_sdbSizer1OK->Disable();
507 m_sdbSizer1Apply->Disable();
508 m_sdbSizer1Cancel->Disable();
509
510 PCM_TASK_MANAGER task_manager( m_pcm );
511
512 for( const PENDING_ACTION& action : m_pendingActions )
513 {
514 if( action.action == PPA_UNINSTALL )
515 {
516 task_manager.Uninstall( action.package );
517 }
518 else
519 {
520 bool isUpdate = action.action == PPA_UPDATE;
521 task_manager.DownloadAndInstall( action.package, action.version, action.repository_id,
522 isUpdate );
523 }
524 }
525
526 task_manager.RunQueue( this );
527
528 m_changed_package_types.merge( task_manager.GetChangedPackageTypes() );
529
530 m_sdbSizer1OK->Enable();
531 m_sdbSizer1Apply->Enable();
532 m_sdbSizer1Cancel->Enable();
533
535 wxCommandEvent dummy;
537
538 if( !m_selectedRepositoryId.IsEmpty() )
540}
541
542
543void DIALOG_PCM::OnDiscardChangesClicked( wxCommandEvent& event )
544{
545 m_gridPendingActions->Freeze();
546
547 for( int i = m_pendingActions.size() - 1; i >= 0; i-- )
548 discardAction( i );
549
551 m_gridPendingActions->Thaw();
552}
553
554
555void DIALOG_PCM::OnDiscardActionClicked( wxCommandEvent& event )
556{
557 wxArrayInt rows = m_gridPendingActions->GetSelectedRows();
558
559 std::sort( rows.begin(), rows.end(),
560 []( const int& a, const int& b )
561 {
562 return a > b;
563 } );
564
565 m_gridPendingActions->Freeze();
566
567 for( int row : rows )
568 discardAction( row );
569
571 m_gridPendingActions->Thaw();
572}
573
574
576{
577 m_gridPendingActions->DeleteRows( aIndex );
578
579 PENDING_ACTION action = m_pendingActions[aIndex];
580
581 PCM_PACKAGE_STATE state = m_pcm->GetPackageState( action.repository_id,
582 action.package.identifier );
583
584 updatePackageState( action.package.identifier, state );
585
586 m_pendingActions.erase( m_pendingActions.begin() + aIndex );
587}
588
589
590void DIALOG_PCM::updatePackageState( const wxString& aPackageId, const PCM_PACKAGE_STATE aState )
591{
592 bool pinned = m_pcm->IsPackagePinned( aPackageId );
593
594 m_installedPanel->SetPackageState( aPackageId, aState, pinned );
595
596 for( const auto& [ packageType, packagesView ] : m_repositoryContentPanels )
597 packagesView->SetPackageState( aPackageId, aState, pinned );
598}
599
600
601void DIALOG_PCM::OnOpenPackageDirClicked( wxCommandEvent& event )
602{
603 LaunchExternal( m_pcm->Get3rdPartyPath() );
604}
const char * name
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition bitmap.cpp:104
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
Implementing DIALOG_MANAGE_REPOSITORIES_BASE.
std::vector< std::pair< wxString, wxString > > GetData()
void SetData(const std::vector< std::pair< wxString, wxString > > &aData)
wxChoice * m_choiceRepository
wxNotebook * m_contentNotebook
WX_GRID * m_gridPendingActions
wxButton * m_sdbSizer1OK
wxButton * m_sdbSizer1Cancel
wxBitmapButton * m_discardActionButton
DIALOG_PCM_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Plugin And Content Manager"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxNotebook * m_dialogNotebook
wxButton * m_sdbSizer1Apply
wxPanel * m_panelInstalledHolder
wxPanel * m_panelPending
ActionCallback m_actionCallback
Definition dialog_pcm.h:114
void OnDiscardChangesClicked(wxCommandEvent &event) override
Switches to another repository.
std::unordered_map< wxString, wxBitmap > m_installedBitmaps
Definition dialog_pcm.h:120
std::unordered_map< wxString, wxBitmap > m_packageBitmaps
Definition dialog_pcm.h:119
void OnManageRepositoriesClicked(wxCommandEvent &event) override
Discards current repo cache, fetches it anew and displays.
void updatePackageState(const wxString &aPackageId, const PCM_PACKAGE_STATE aState)
Discards specified pending action.
void OnApplyChangesClicked(wxCommandEvent &event) override
Discards all pending changes.
void OnDiscardActionClicked(wxCommandEvent &event) override
Handles modification of the buttons' status.
void OnUpdateEventButtons(wxUpdateUIEvent &event)
Returns types of packages that were installed/uninstalled.
std::unordered_map< PCM_PACKAGE_TYPE, PANEL_PACKAGES_VIEW * > m_repositoryContentPanels
Definition dialog_pcm.h:117
void OnOpenPackageDirClicked(wxCommandEvent &event) override
Enqueues current pending actions in PCM_TASK_MANAGER and runs the queue.
PinCallback m_pinCallback
Definition dialog_pcm.h:115
std::unordered_set< PCM_PACKAGE_TYPE > m_changed_package_types
Definition dialog_pcm.h:122
void SetActivePackageType(PCM_PACKAGE_TYPE aType)
EDA_BASE_FRAME * m_parentFrame
Definition dialog_pcm.h:112
DIALOG_PCM(EDA_BASE_FRAME *parent, std::shared_ptr< PLUGIN_CONTENT_MANAGER > pcm)
Constructor.
void updatePendingActionsTab()
Gets installed packages list from PCM and displays it on installed tab.
std::vector< PENDING_ACTION > m_pendingActions
Definition dialog_pcm.h:138
void setRepositoryListFromPcm()
Updates pending actions tab caption and content-fits the grid.
void OnInstallFromFileClicked(wxCommandEvent &event) override
Opens local directory where packages are installed in file manager.
@ PENDING_COL_REPOSITORY
Definition dialog_pcm.h:145
@ PENDING_COL_VERSION
Definition dialog_pcm.h:144
@ PENDING_COL_ACTION
Definition dialog_pcm.h:142
void OnCloseWindow(wxCloseEvent &aEvent)
Opens repository management dialog, saves changes to PCM.
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
Definition dialog_pcm.h:113
void OnRepositoryChoice(wxCommandEvent &event) override
Selects the whole row in the grid if a cell is clicked.
wxString m_selectedRepositoryId
Definition dialog_pcm.h:118
PANEL_PACKAGES_VIEW * m_installedPanel
Definition dialog_pcm.h:116
void setInstalledPackages()
Reflects new state of the package in all panels where it is displayed.
void OnPendingActionsCellClicked(wxGridEvent &event) override
Discards selected pending actions.
void setRepositoryData(const wxString &aRepositoryId)
Gets package data from PCM and displays it on repository tab.
void discardAction(int aIndex)
wxBitmap m_defaultBitmap
Definition dialog_pcm.h:121
void OnRefreshClicked(wxCommandEvent &event) override
Opens file selection dialog and installs selected package archive.
void OnCloseClicked(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
int ShowModal() override
The base frame for deriving all KiCad main window classes.
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition grid_tricks.h:61
wxString m_PcmLastSelectedRepoId
Helper class that handles package (un)installation.
std::unordered_set< PCM_PACKAGE_TYPE > & GetChangedPackageTypes()
PCM_TASK_MANAGER::STATUS DownloadAndInstall(const PCM_PACKAGE &aPackage, const wxString &aVersion, const wxString &aRepositoryId, const bool isUpdate)
Enqueue package download and installation.
void RunQueue(wxWindow *aParent)
Run queue of pending actions.
PCM_TASK_MANAGER::STATUS Uninstall(const PCM_PACKAGE &aPackage)
Enqueue package uninstallation.
PCM_TASK_MANAGER::STATUS InstallFromFile(wxWindow *aParent, const wxString &aFilePath)
Installs package from an archive file on disk.
#define GRID_CELL_MARGIN
static std::vector< std::pair< PCM_PACKAGE_TYPE, wxString > > PACKAGE_TYPE_LIST
#define _(s)
Base window classes and related definitions.
bool LaunchExternal(const wxString &aPath)
Launches the given file or folder in the host OS.
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:435
PCM_PACKAGE_STATE
Definition pcm.h:58
@ PPS_INSTALLED
Definition pcm.h:61
@ PPS_PENDING_UPDATE
Definition pcm.h:65
@ PPS_UPDATE_AVAILABLE
Definition pcm.h:64
@ PPS_PENDING_UNINSTALL
Definition pcm.h:63
@ PPS_PENDING_INSTALL
Definition pcm.h:62
PCM_PACKAGE_ACTION
Definition pcm.h:71
@ PPA_UNINSTALL
Definition pcm.h:73
@ PPA_UPDATE
Definition pcm.h:74
@ PPA_INSTALL
Definition pcm.h:72
@ PC_FAB
Definition pcm_data.h:56
PCM_PACKAGE_TYPE
< Supported package types
Definition pcm_data.h:42
@ PT_DATASOURCE
Definition pcm_data.h:47
@ PT_COLORTHEME
Definition pcm_data.h:48
@ PT_INVALID
Definition pcm_data.h:43
@ PT_PLUGIN
Definition pcm_data.h:44
@ PT_LIBRARY
Definition pcm_data.h:46
@ PT_FAB
Definition pcm_data.h:45
see class PGM_BASE
T * GetAppSettings(const char *aFilename)
std::vector< FAB_LAYER_COLOR > dummy
< Collection of data relevant to the package display panelCallback for (un)install button
wxString update_version
wxString current_version
const PCM_PACKAGE package
wxString repository_name
PCM_PACKAGE_STATE state
Definition pcm_data.h:159
Repository reference to a resource.
Definition pcm_data.h:114
wxString identifier
Definition pcm_data.h:118
wxString name
Definition pcm_data.h:115