KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FOOTPRINT_WIZARD_MANAGER Class Reference

The footprint wizard manager interfaces with API_PLUGINs that can generate footprints. More...

#include <footprint_wizard.h>

Public Member Functions

 FOOTPRINT_WIZARD_MANAGER ()
 
 ~FOOTPRINT_WIZARD_MANAGER ()=default
 
void ReloadWizards (std::shared_ptr< REPORTER > aReporter=nullptr)
 Goes through the list of IPC API plugins that provide wizard actions and attempts to refresh the info of each one, placing the ones that work in to the internal list returned by Wizards().
 
std::optional< FOOTPRINT_WIZARD * > GetWizard (const wxString &aIdentifier)
 
std::vector< FOOTPRINT_WIZARD * > Wizards () const
 
tl::expected< FOOTPRINT *, wxString > Generate (FOOTPRINT_WIZARD *aWizard)
 Generates a footprint using a given wizard.
 

Static Public Member Functions

static bool RefreshInfo (FOOTPRINT_WIZARD *aWizard, std::shared_ptr< REPORTER > aReporter=nullptr)
 Runs a wizard plugin with the –get-info argument, which should result in the plugin dumping a WizardInfo protobuf message in JSON format to stdout.
 

Private Attributes

std::map< wxString, std::unique_ptr< FOOTPRINT_WIZARD > > m_wizards
 

Detailed Description

The footprint wizard manager interfaces with API_PLUGINs that can generate footprints.

It uses API_PLUGIN_MANAGER to enumerate the loaded wizard plugins, and filters to those that generate footprints. It then handles calling the plugin to query capabilities, generate footprints, and so on.

Definition at line 178 of file footprint_wizard.h.

Constructor & Destructor Documentation

◆ FOOTPRINT_WIZARD_MANAGER()

FOOTPRINT_WIZARD_MANAGER::FOOTPRINT_WIZARD_MANAGER ( )
inline

Definition at line 181 of file footprint_wizard.h.

◆ ~FOOTPRINT_WIZARD_MANAGER()

FOOTPRINT_WIZARD_MANAGER::~FOOTPRINT_WIZARD_MANAGER ( )
default

Member Function Documentation

◆ Generate()

tl::expected< FOOTPRINT *, wxString > FOOTPRINT_WIZARD_MANAGER::Generate ( FOOTPRINT_WIZARD * aWizard)

Generates a footprint using a given wizard.

Parameters
aWizardis the wizard data instance (with parameters set) to feed into the wizard
Returns
a generated footprint, or an error message if generation failed

Definition at line 131 of file footprint_wizard.cpp.

References _, PGM_BASE::GetPluginManager(), FOOTPRINT_WIZARD::Identifier(), FOOTPRINT_WIZARD::Info(), API_PLUGIN_MANAGER::InvokeActionSync(), WIZARD_INFO::meta, WIZARD_META_INFO::name, WIZARD_INFO::parameters, Pgm(), and traceApi.

Referenced by FOOTPRINT_WIZARD_FRAME::RegenerateFootprint().

◆ GetWizard()

std::optional< FOOTPRINT_WIZARD * > FOOTPRINT_WIZARD_MANAGER::GetWizard ( const wxString & aIdentifier)

Definition at line 79 of file footprint_wizard.cpp.

References m_wizards.

◆ RefreshInfo()

bool FOOTPRINT_WIZARD_MANAGER::RefreshInfo ( FOOTPRINT_WIZARD * aWizard,
std::shared_ptr< REPORTER > aReporter = nullptr )
static

Runs a wizard plugin with the –get-info argument, which should result in the plugin dumping a WizardInfo protobuf message in JSON format to stdout.

Parameters
aWizardis the wizard to refresh
aReporteris an optional reporter to receive failure messages
Returns
true if the call succeeded

Definition at line 88 of file footprint_wizard.cpp.

References _, WIZARD_INFO::FromProto(), PGM_BASE::GetPluginManager(), FOOTPRINT_WIZARD::Identifier(), FOOTPRINT_WIZARD::Info(), info, API_PLUGIN_MANAGER::InvokeActionSync(), Pgm(), RPT_SEVERITY_ERROR, KI_ERROR::SetDescription(), and KI_ERROR::SetTitle().

Referenced by BOOST_AUTO_TEST_CASE(), and ReloadWizards().

◆ ReloadWizards()

void FOOTPRINT_WIZARD_MANAGER::ReloadWizards ( std::shared_ptr< REPORTER > aReporter = nullptr)

Goes through the list of IPC API plugins that provide wizard actions and attempts to refresh the info of each one, placing the ones that work in to the internal list returned by Wizards().

Wizards that fail to load are reported to aReporter, if one is provided. Note that doing so clears the existing list and invalidates any existing pointers to wizards.

Parameters
aReporteris an optional reporter to receive wizard failure messages

Definition at line 40 of file footprint_wizard.cpp.

References FOOTPRINT_WIZARD, API_PLUGIN_MANAGER::GetActionsForScope(), PGM_BASE::GetPluginManager(), m_wizards, Pgm(), and RefreshInfo().

Referenced by DIALOG_FOOTPRINT_WIZARD_LIST::initLists().

◆ Wizards()

std::vector< FOOTPRINT_WIZARD * > FOOTPRINT_WIZARD_MANAGER::Wizards ( ) const

Member Data Documentation

◆ m_wizards

std::map<wxString, std::unique_ptr<FOOTPRINT_WIZARD> > FOOTPRINT_WIZARD_MANAGER::m_wizards
private

Definition at line 219 of file footprint_wizard.h.

Referenced by GetWizard(), ReloadWizards(), and Wizards().


The documentation for this class was generated from the following files: