Allow quiet creation (scripting)

This commit is contained in:
Seth Hillbrand 2021-09-24 13:47:57 -07:00
parent bb95ca2966
commit c3b6939ea7
4 changed files with 9 additions and 6 deletions

View File

@ -273,8 +273,9 @@ public:
* footprint is placed on a board and a netlist is read.
*
* @param aFootprintName is the name of the new footprint in library.
* @param aQuiet prevents user dialogs from being shown
*/
FOOTPRINT* CreateNewFootprint( const wxString& aFootprintName );
FOOTPRINT* CreateNewFootprint( const wxString& aFootprintName, bool aQuiet = false );
/**
* Places \a aFootprint at the current cursor position and updates footprint coordinates

View File

@ -1148,7 +1148,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint()
}
FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName )
FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, bool aQuiet )
{
wxString footprintName = aFootprintName;
@ -1156,7 +1156,7 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName )
static int footprintType = 1;
// Ask for the new footprint name
if( footprintName.IsEmpty() )
if( footprintName.IsEmpty() && !aQuiet )
{
WX_TEXT_ENTRY_DIALOG dlg( this, _( "Enter footprint name:" ), _( "New Footprint" ),
footprintName, _( "Footprint type:" ),
@ -1184,7 +1184,9 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName )
if( footprintName.IsEmpty() )
{
DisplayInfoMessage( this, _( "No footprint name defined." ) );
if( !aQuiet )
DisplayInfoMessage( this, _( "No footprint name defined." ) );
return nullptr;
}

View File

@ -188,7 +188,7 @@ FOOTPRINT* MICROWAVE_TOOL::createBaseFootprint( const wxString& aValue,
{
PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
FOOTPRINT* footprint = editFrame.CreateNewFootprint( aValue );
FOOTPRINT* footprint = editFrame.CreateNewFootprint( aValue, true );
footprint->SetAttributes( FP_EXCLUDE_FROM_POS_FILES | FP_EXCLUDE_FROM_BOM );

View File

@ -414,7 +414,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
if( ( cmpdlg.ShowQuasiModal() != wxID_OK ) || msg.IsEmpty() )
return nullptr; // Aborted by user
FOOTPRINT* footprint = editFrame.CreateNewFootprint( msg );
FOOTPRINT* footprint = editFrame.CreateNewFootprint( msg, true );
footprint->SetFPID( LIB_ID( wxEmptyString, wxT( "mw_inductor" ) ) );
footprint->SetAttributes( FP_EXCLUDE_FROM_POS_FILES | FP_EXCLUDE_FROM_BOM );