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 <launch_ext.h>
40#include <sstream>
41#include <vector>
42#include <wx/filedlg.h>
43#include <wx/msgdlg.h>
44
45
46#define GRID_CELL_MARGIN 4
47
48// Notes: These strings are static, so wxGetTranslation must be called to display the
49// transalted text
50static std::vector<std::pair<PCM_PACKAGE_TYPE, wxString>> PACKAGE_TYPE_LIST = {
51 { PT_PLUGIN, _( "Plugins (%d)" ) },
52 { PT_FAB, _( "Fabrication plugins (%d)" ) },
53 { PT_LIBRARY, _( "Libraries (%d)" ) },
54 { PT_COLORTHEME, _( "Color themes (%d)" ) },
55};
56
57
58DIALOG_PCM::DIALOG_PCM( EDA_BASE_FRAME* parent, std::shared_ptr<PLUGIN_CONTENT_MANAGER> pcm ) :
59 DIALOG_PCM_BASE( parent ),
60 m_parentFrame( parent ),
61 m_pcm( pcm )
62{
63 // correct the min size from wxfb with fromdip
64 SetMinSize( FromDIP( GetMinSize() ) );
65
66 SetDoubleBuffered( true );
67
68 m_defaultBitmap = KiBitmap( BITMAPS::icon_pcm );
69
70 m_pcm->SetDialogWindow( this );
71 m_pcm->StopBackgroundUpdate();
72
73 m_gridPendingActions->PushEventHandler( new GRID_TRICKS( m_gridPendingActions ) );
74
75 m_discardActionButton->SetBitmap( KiBitmapBundle( BITMAPS::small_trash ) );
76 m_panelPending->Layout();
77
78 m_actionCallback = [this]( const PACKAGE_VIEW_DATA& aData, PCM_PACKAGE_ACTION aAction,
79 const wxString& aVersion )
80 {
81 if( aAction == PPA_UPDATE && m_pcm->IsPackagePinned( aData.package.identifier ) )
82 {
83 if( wxMessageBox( wxString::Format( _( "Are you sure you want to update pinned package "
84 "from version %s to %s?" ),
85 aData.current_version, aVersion ),
86 _( "Confirm update" ), wxICON_QUESTION | wxYES_NO, this )
87 == wxNO )
88 {
89 return;
90 }
91 }
92
93 m_gridPendingActions->Freeze();
94
95 PCM_PACKAGE_STATE new_state;
96
97 m_gridPendingActions->AppendRows();
98 int row = m_gridPendingActions->GetNumberRows() - 1;
99
100 m_gridPendingActions->SetCellValue( row, PENDING_COL_NAME, aData.package.name );
102
103 switch( aAction )
104 {
105 default:
106 case PPA_INSTALL:
107 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Install" ) );
108 m_gridPendingActions->SetCellValue( row, PENDING_COL_VERSION, aVersion );
109 new_state = PPS_PENDING_INSTALL;
110 break;
111
112 case PPA_UPDATE:
113 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Update" ) );
114 m_gridPendingActions->SetCellValue( row, PENDING_COL_VERSION,
115 wxString::Format( wxT( "%s \u279C %s" ),
116 aData.current_version,
117 aVersion ) );
118 new_state = PPS_PENDING_UPDATE;
119 break;
120
121 case PPA_UNINSTALL:
122 m_gridPendingActions->SetCellValue( row, PENDING_COL_ACTION, _( "Uninstall" ) );
123 m_gridPendingActions->SetCellValue( row, PENDING_COL_VERSION,
124 m_pcm->GetInstalledPackageVersion( aData.package.identifier ) );
125 new_state = PPS_PENDING_UNINSTALL;
126 break;
127 }
128
129 m_pendingActions.emplace_back( aAction, aData.repository_id, aData.package, aVersion );
130
131 m_gridPendingActions->Thaw();
132
134
135 updatePackageState( aData.package.identifier, new_state );
136 };
137
139 [this]( const wxString& aPackageId, const PCM_PACKAGE_STATE aState, const bool aPinned )
140 {
141 m_pcm->SetPinned( aPackageId, aPinned );
142
143 updatePackageState( aPackageId, aState );
144 };
145
147 m_panelInstalledHolder->GetSizer()->Add( m_installedPanel, 1, wxEXPAND );
148 m_panelInstalledHolder->Layout();
149
150 for( const std::pair<PCM_PACKAGE_TYPE, wxString>& entry : PACKAGE_TYPE_LIST )
151 {
154 wxString label = wxGetTranslation( entry.second );
155 m_contentNotebook->AddPage( panel, wxString::Format( label, 0 ) );
156 m_repositoryContentPanels.insert( { entry.first, panel } );
157 }
158
159 m_dialogNotebook->SetPageText( 0, wxString::Format( _( "Repository (%d)" ), 0 ) );
160
163
164 m_dialogNotebook->SetSelection( 0 );
165
166 SetupStandardButtons( { { wxID_OK, _( "Close" ) },
167 { wxID_APPLY, _( "Apply Pending Changes" ) },
168 { wxID_CANCEL, _( "Discard Pending Changes" ) } } );
169
170 Bind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );
171 m_sdbSizer1Cancel->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
172 m_sdbSizer1Apply->Bind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
173
175
176 for( int col = 0; col < m_gridPendingActions->GetNumberCols(); col++ )
177 {
178 const wxString& heading = m_gridPendingActions->GetColLabelValue( col );
179 int headingWidth = GetTextExtent( heading ).x + 2 * GRID_CELL_MARGIN;
180
181 // Set the minimal width to the column label size.
182 m_gridPendingActions->SetColMinimalWidth( col, headingWidth );
183 }
184
185 // fix sizers now widgets are set.
187}
188
189
191{
192 Unbind( wxEVT_CLOSE_WINDOW, &DIALOG_PCM::OnCloseWindow, this );
193 m_sdbSizer1Cancel->Unbind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
194 m_sdbSizer1Apply->Unbind( wxEVT_UPDATE_UI, &DIALOG_PCM::OnUpdateEventButtons, this );
195
196 m_pcm->SaveInstalledPackages();
197 m_pcm->SetDialogWindow( nullptr );
198 m_pcm->RunBackgroundUpdate();
199
200 m_gridPendingActions->PopEventHandler( true );
201}
202
203
204void DIALOG_PCM::OnUpdateEventButtons( wxUpdateUIEvent& event )
205{
206 event.Enable( !m_pendingActions.empty() );
207}
208
209
210void DIALOG_PCM::OnCloseClicked( wxCommandEvent& event )
211{
212 if( m_pendingActions.size() == 0
213 || wxMessageBox( _( "Are you sure you want to close the package manager "
214 "and discard pending changes?" ),
215 _( "Plugin and Content Manager" ), wxICON_QUESTION | wxYES_NO, this )
216 == wxYES )
217 {
218 EndModal( wxID_OK );
219 }
220}
221
222
223void DIALOG_PCM::OnCloseWindow( wxCloseEvent& aEvent )
224{
225 wxCommandEvent dummy;
226
228}
229
230
231void DIALOG_PCM::OnManageRepositoriesClicked( wxCommandEvent& event )
232{
234
235 std::vector<std::pair<wxString, wxString>> dialog_data;
236 std::vector<std::tuple<wxString, wxString, wxString>> repo_list = m_pcm->GetRepositoryList();
237
238 for( const auto& [id, url, name] : repo_list )
239 dialog_data.push_back( std::make_pair( url, name ) );
240
241 dialog->SetData( dialog_data );
242
243 if( dialog->ShowModal() == wxID_SAVE )
244 {
245 dialog_data = dialog->GetData();
246 m_pcm->SetRepositoryList( dialog_data );
247
248 if( KICAD_SETTINGS* cfg = GetAppSettings<KICAD_SETTINGS>( "kicad" ) )
249 cfg->m_PcmRepositories = std::move( dialog_data );
250
252 }
253
254 dialog->Destroy();
255}
256
257
259{
260 std::vector<std::tuple<wxString, wxString, wxString>> repositories = m_pcm->GetRepositoryList();
261
262 m_choiceRepository->Clear();
263
264 for( const auto& [id, url, name] : repositories )
265 m_choiceRepository->Append( url, new wxStringClientData( id ) );
266
267 if( repositories.size() > 0 )
268 {
269 m_choiceRepository->SetSelection( 0 );
270 m_selectedRepositoryId = std::get<0>( repositories[0] );
272 }
273 else
274 {
276 }
277}
278
279
280void DIALOG_PCM::OnRefreshClicked( wxCommandEvent& event )
281{
282 m_pcm->DiscardRepositoryCache( m_selectedRepositoryId );
284}
285
286
287void DIALOG_PCM::OnInstallFromFileClicked( wxCommandEvent& event )
288{
289 wxFileDialog open_file_dialog( this, _( "Install Package" ), wxEmptyString, wxEmptyString,
290 wxT( "Zip files (*.zip)|*.zip" ), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
291
292 if( open_file_dialog.ShowModal() == wxID_CANCEL )
293 return;
294
295 PCM_TASK_MANAGER task_manager( m_pcm );
296 task_manager.InstallFromFile( this, open_file_dialog.GetPath() );
297
298 m_changed_package_types.merge( task_manager.GetChangedPackageTypes() );
299
301
302 if( !m_selectedRepositoryId.IsEmpty() )
304}
305
306
307void DIALOG_PCM::OnRepositoryChoice( wxCommandEvent& event )
308{
309 wxStringClientData* data = static_cast<wxStringClientData*>(
310 m_choiceRepository->GetClientObject( m_choiceRepository->GetSelection() ) );
311
312 m_selectedRepositoryId = data->GetData();
313
315}
316
317
318void DIALOG_PCM::setRepositoryData( const wxString& aRepositoryId )
319{
320 m_dialogNotebook->Freeze();
321
322 if( m_pcm->CacheRepository( aRepositoryId ) )
323 {
324 for( const auto& [ packageType, packagesView ] : m_repositoryContentPanels )
325 packagesView->ClearData();
326
327 m_packageBitmaps = m_pcm->GetRepositoryPackageBitmaps( aRepositoryId );
328
329 const std::vector<PCM_PACKAGE> packages = m_pcm->GetRepositoryPackages( aRepositoryId );
330
331 std::unordered_map<PCM_PACKAGE_TYPE, std::vector<PACKAGE_VIEW_DATA>> data;
332
333 for( const PCM_PACKAGE& pkg : packages )
334 {
335 PACKAGE_VIEW_DATA package_data( pkg );
336
337 if( m_packageBitmaps.count( package_data.package.identifier ) > 0 )
338 package_data.bitmap = &m_packageBitmaps.at( package_data.package.identifier );
339 else
340 package_data.bitmap = &m_defaultBitmap;
341
342 package_data.state = m_pcm->GetPackageState( aRepositoryId, pkg.identifier );
343
344 if( package_data.state == PPS_INSTALLED || package_data.state == PPS_UPDATE_AVAILABLE )
345 {
346 package_data.current_version = m_pcm->GetInstalledPackageVersion( pkg.identifier );
347 package_data.pinned = m_pcm->IsPackagePinned( pkg.identifier );
348 }
349
350 if( package_data.state == PPS_UPDATE_AVAILABLE )
351 package_data.update_version = m_pcm->GetPackageUpdateVersion( pkg );
352
353
354 for( const PENDING_ACTION& action : m_pendingActions )
355 {
356 if( action.package.identifier != pkg.identifier )
357 continue;
358
359 switch( action.action )
360 {
361 case PPA_INSTALL: package_data.state = PPS_PENDING_INSTALL; break;
362 case PPA_UPDATE: package_data.state = PPS_PENDING_UPDATE; break;
363 case PPA_UNINSTALL: package_data.state = PPS_PENDING_UNINSTALL; break;
364 }
365
366 break;
367 }
368
369 package_data.repository_id = aRepositoryId;
370 package_data.repository_name = m_choiceRepository->GetStringSelection();
371
372 // Fabrication plugins are displayed in a different tab although they are still plugins
373 PCM_PACKAGE_TYPE type = pkg.category == PC_FAB ? PT_FAB : pkg.type;
374
375 data[type].emplace_back( package_data );
376 }
377
378 for( size_t i = 0; i < PACKAGE_TYPE_LIST.size(); i++ )
379 {
380 PCM_PACKAGE_TYPE type = PACKAGE_TYPE_LIST[i].first;
381 const wxString& label = PACKAGE_TYPE_LIST[i].second;
382 m_repositoryContentPanels[type]->SetData( data[type] );
383 m_contentNotebook->SetPageText( i, wxString::Format( wxGetTranslation( label ),
384 (int) data[type].size() ) );
385 }
386
387 m_dialogNotebook->SetPageText( 0, wxString::Format( _( "Repository (%d)" ),
388 (int) packages.size() ) );
389 }
390
391 m_dialogNotebook->Thaw();
392}
393
394
396{
397 m_gridPendingActions->ClearSelection();
398 m_gridPendingActions->SelectRow( event.GetRow() );
399}
400
401
403{
404 m_dialogNotebook->SetPageText( 2, wxString::Format( _( "Pending (%d)" ),
405 (int) m_pendingActions.size() ) );
406
407 for( int col = 0; col < m_gridPendingActions->GetNumberCols(); col++ )
408 {
409 // Set the width to see the full contents
411 }
412}
413
414
416{
418
419 const std::vector<PCM_INSTALLATION_ENTRY> installed = m_pcm->GetInstalledPackages();
420 std::vector<PACKAGE_VIEW_DATA> package_list;
421
422 m_installedBitmaps = m_pcm->GetInstalledPackageBitmaps();
423
424 for( const PCM_INSTALLATION_ENTRY& entry : installed )
425 {
426 PACKAGE_VIEW_DATA package_data( entry );
427
428 if( m_installedBitmaps.count( package_data.package.identifier ) > 0 )
429 package_data.bitmap = &m_installedBitmaps.at( package_data.package.identifier );
430 else
431 package_data.bitmap = &m_defaultBitmap;
432
433 package_data.state = m_pcm->GetPackageState( entry.repository_id,
434 entry.package.identifier );
435
436 if( package_data.state == PPS_UPDATE_AVAILABLE )
437 package_data.update_version = m_pcm->GetPackageUpdateVersion( entry.package );
438
439 package_list.emplace_back( package_data );
440 }
441
442 m_installedPanel->SetData( package_list );
443
444 m_dialogNotebook->SetPageText( 1, wxString::Format( _( "Installed (%d)" ),
445 (int) package_list.size() ) );
446}
447
448
449void DIALOG_PCM::OnApplyChangesClicked( wxCommandEvent& event )
450{
451 if( m_pendingActions.size() == 0 )
452 return;
453
454 m_sdbSizer1OK->Disable();
455 m_sdbSizer1Apply->Disable();
456 m_sdbSizer1Cancel->Disable();
457
458 PCM_TASK_MANAGER task_manager( m_pcm );
459
460 for( const PENDING_ACTION& action : m_pendingActions )
461 {
462 if( action.action == PPA_UNINSTALL )
463 {
464 task_manager.Uninstall( action.package );
465 }
466 else
467 {
468 bool isUpdate = action.action == PPA_UPDATE;
469 task_manager.DownloadAndInstall( action.package, action.version, action.repository_id,
470 isUpdate );
471 }
472 }
473
474 task_manager.RunQueue( this );
475
476 m_changed_package_types.merge( task_manager.GetChangedPackageTypes() );
477
478 m_sdbSizer1OK->Enable();
479 m_sdbSizer1Apply->Enable();
480 m_sdbSizer1Cancel->Enable();
481
483 wxCommandEvent dummy;
485
486 if( !m_selectedRepositoryId.IsEmpty() )
488}
489
490
491void DIALOG_PCM::OnDiscardChangesClicked( wxCommandEvent& event )
492{
493 m_gridPendingActions->Freeze();
494
495 for( int i = m_pendingActions.size() - 1; i >= 0; i-- )
496 discardAction( i );
497
499 m_gridPendingActions->Thaw();
500}
501
502
503void DIALOG_PCM::OnDiscardActionClicked( wxCommandEvent& event )
504{
505 wxArrayInt rows = m_gridPendingActions->GetSelectedRows();
506
507 std::sort( rows.begin(), rows.end(),
508 []( const int& a, const int& b )
509 {
510 return a > b;
511 } );
512
513 m_gridPendingActions->Freeze();
514
515 for( int row : rows )
516 discardAction( row );
517
519 m_gridPendingActions->Thaw();
520}
521
522
524{
525 m_gridPendingActions->DeleteRows( aIndex );
526
527 PENDING_ACTION action = m_pendingActions[aIndex];
528
529 PCM_PACKAGE_STATE state = m_pcm->GetPackageState( action.repository_id,
530 action.package.identifier );
531
532 updatePackageState( action.package.identifier, state );
533
534 m_pendingActions.erase( m_pendingActions.begin() + aIndex );
535}
536
537
538void DIALOG_PCM::updatePackageState( const wxString& aPackageId, const PCM_PACKAGE_STATE aState )
539{
540 bool pinned = m_pcm->IsPackagePinned( aPackageId );
541
542 m_installedPanel->SetPackageState( aPackageId, aState, pinned );
543
544 for( const auto& [ packageType, packagesView ] : m_repositoryContentPanels )
545 packagesView->SetPackageState( aPackageId, aState, pinned );
546}
547
548
549void DIALOG_PCM::OnOpenPackageDirClicked( wxCommandEvent& event )
550{
551 LaunchExternal( m_pcm->Get3rdPartyPath() );
552}
const char * name
Definition: DXF_plotter.cpp:62
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)
Class DIALOG_PCM_BASE.
wxChoice * m_choiceRepository
wxNotebook * m_contentNotebook
WX_GRID * m_gridPendingActions
wxButton * m_sdbSizer1OK
wxButton * m_sdbSizer1Cancel
wxBitmapButton * m_discardActionButton
wxNotebook * m_dialogNotebook
wxButton * m_sdbSizer1Apply
wxPanel * m_panelInstalledHolder
wxPanel * m_panelPending
ActionCallback m_actionCallback
Definition: dialog_pcm.h:112
void OnDiscardChangesClicked(wxCommandEvent &event) override
Switches to another repository.
Definition: dialog_pcm.cpp:491
std::unordered_map< wxString, wxBitmap > m_installedBitmaps
Definition: dialog_pcm.h:118
std::unordered_map< wxString, wxBitmap > m_packageBitmaps
Definition: dialog_pcm.h:117
void OnManageRepositoriesClicked(wxCommandEvent &event) override
Discards current repo cache, fetches it anew and displays.
Definition: dialog_pcm.cpp:231
void updatePackageState(const wxString &aPackageId, const PCM_PACKAGE_STATE aState)
Discards specified pending action.
Definition: dialog_pcm.cpp:538
void OnApplyChangesClicked(wxCommandEvent &event) override
Discards all pending changes.
Definition: dialog_pcm.cpp:449
void OnDiscardActionClicked(wxCommandEvent &event) override
Handles modification of the buttons' status.
Definition: dialog_pcm.cpp:503
void OnUpdateEventButtons(wxUpdateUIEvent &event)
Returns types of packages that were installed/uninstalled.
Definition: dialog_pcm.cpp:204
std::unordered_map< PCM_PACKAGE_TYPE, PANEL_PACKAGES_VIEW * > m_repositoryContentPanels
Definition: dialog_pcm.h:115
void OnOpenPackageDirClicked(wxCommandEvent &event) override
Enqueues current pending actions in PCM_TASK_MANAGER and runs the queue.
Definition: dialog_pcm.cpp:549
PinCallback m_pinCallback
Definition: dialog_pcm.h:113
std::unordered_set< PCM_PACKAGE_TYPE > m_changed_package_types
Definition: dialog_pcm.h:120
DIALOG_PCM(EDA_BASE_FRAME *parent, std::shared_ptr< PLUGIN_CONTENT_MANAGER > pcm)
Constructor.
Definition: dialog_pcm.cpp:58
void updatePendingActionsTab()
Gets installed packages list from PCM and displays it on installed tab.
Definition: dialog_pcm.cpp:402
std::vector< PENDING_ACTION > m_pendingActions
Definition: dialog_pcm.h:136
void setRepositoryListFromPcm()
Updates pending actions tab caption and content-fits the grid.
Definition: dialog_pcm.cpp:258
void OnInstallFromFileClicked(wxCommandEvent &event) override
Opens local directory where packages are installed in file manager.
Definition: dialog_pcm.cpp:287
@ PENDING_COL_NAME
Definition: dialog_pcm.h:141
@ PENDING_COL_REPOSITORY
Definition: dialog_pcm.h:143
@ PENDING_COL_VERSION
Definition: dialog_pcm.h:142
@ PENDING_COL_ACTION
Definition: dialog_pcm.h:140
void OnCloseWindow(wxCloseEvent &aEvent)
Opens repository management dialog, saves changes to PCM.
Definition: dialog_pcm.cpp:223
std::shared_ptr< PLUGIN_CONTENT_MANAGER > m_pcm
Definition: dialog_pcm.h:111
void OnRepositoryChoice(wxCommandEvent &event) override
Selects the whole row in the grid if a cell is clicked.
Definition: dialog_pcm.cpp:307
wxString m_selectedRepositoryId
Definition: dialog_pcm.h:116
PANEL_PACKAGES_VIEW * m_installedPanel
Definition: dialog_pcm.h:114
void setInstalledPackages()
Reflects new state of the package in all panels where it is displayed.
Definition: dialog_pcm.cpp:415
void OnPendingActionsCellClicked(wxGridEvent &event) override
Discards selected pending actions.
Definition: dialog_pcm.cpp:395
void setRepositoryData(const wxString &aRepositoryId)
Gets package data from PCM and displays it on repository tab.
Definition: dialog_pcm.cpp:318
void discardAction(int aIndex)
Definition: dialog_pcm.cpp:523
wxBitmap m_defaultBitmap
Definition: dialog_pcm.h:119
void OnRefreshClicked(wxCommandEvent &event) override
Opens file selection dialog and installs selected package archive.
Definition: dialog_pcm.cpp:280
void OnCloseClicked(wxCommandEvent &event) override
Definition: dialog_pcm.cpp:210
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
void ClearData()
Selects full row of the clicked cell.
void SetData(const std::vector< PACKAGE_VIEW_DATA > &aPackageData)
Recreates package panels and displays data.
void SetPackageState(const wxString &aPackageId, const PCM_PACKAGE_STATE aState, const bool aPinned)
Set the state of package.
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.
int GetVisibleWidth(int aCol, bool aHeader=true, bool aContents=true, bool aKeep=false)
Calculate the specified column based on the actual size of the text on screen.
Definition: wx_grid.cpp:916
#define GRID_CELL_MARGIN
static std::vector< std::pair< PCM_PACKAGE_TYPE, wxString > > PACKAGE_TYPE_LIST
Definition: dialog_pcm.cpp:50
#define _(s)
Base window classes and related definitions.
bool LaunchExternal(const wxString &aPath)
Launches the given file or folder in the host OS.
Definition: launch_ext.cpp:25
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:55
PCM_PACKAGE_TYPE
< Supported package types
Definition: pcm_data.h:42
@ PT_COLORTHEME
Definition: pcm_data.h:47
@ 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
std::vector< FAB_LAYER_COLOR > dummy
< Collection of data relevant to the package display panel Callback for (un)install button
Definition: panel_package.h:31
wxString update_version
Definition: panel_package.h:39
wxString repository_id
Definition: panel_package.h:36
wxString current_version
Definition: panel_package.h:38
const PCM_PACKAGE package
Definition: panel_package.h:32
wxString repository_name
Definition: panel_package.h:37
wxBitmap * bitmap
Definition: panel_package.h:33
PCM_PACKAGE_STATE state
Definition: panel_package.h:34
Definition: pcm_data.h:157
Repository reference to a resource.
Definition: pcm_data.h:113
wxString identifier
Definition: pcm_data.h:117
wxString name
Definition: pcm_data.h:114