Allow board saves without modifying project files
Without the project files, certain settings will not be saved by this
python call. This defaults to false (current behavior) but setting the
`aSkipSettings` to true will revert to v5 behavior
Fixes https://gitlab.com/kicad/code/kicad/issues/11323
(cherry picked from commit 8418fe12d8
)
This commit is contained in:
parent
70b69af313
commit
b72675ba92
|
@ -238,7 +238,7 @@ BOARD* CreateEmptyBoard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat )
|
bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat, bool aSkipSettings )
|
||||||
{
|
{
|
||||||
aBoard->BuildConnectivity();
|
aBoard->BuildConnectivity();
|
||||||
aBoard->SynchronizeNetsAndNetClasses();
|
aBoard->SynchronizeNetsAndNetClasses();
|
||||||
|
@ -256,20 +256,23 @@ bool SaveBoard( wxString& aFileName, BOARD* aBoard, IO_MGR::PCB_FILE_T aFormat )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileName pro = aFileName;
|
if( !aSkipSettings )
|
||||||
pro.SetExt( ProjectFileExtension );
|
{
|
||||||
pro.MakeAbsolute();
|
wxFileName pro = aFileName;
|
||||||
wxString projectPath = pro.GetFullPath();
|
pro.SetExt( ProjectFileExtension );
|
||||||
|
pro.MakeAbsolute();
|
||||||
|
wxString projectPath = pro.GetFullPath();
|
||||||
|
|
||||||
GetSettingsManager()->SaveProjectAs( pro.GetFullPath(), aBoard->GetProject() );
|
GetSettingsManager()->SaveProjectAs( pro.GetFullPath(), aBoard->GetProject() );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SaveBoard( wxString& aFileName, BOARD* aBoard )
|
bool SaveBoard( wxString& aFileName, BOARD* aBoard, bool aSkipSettings )
|
||||||
{
|
{
|
||||||
return SaveBoard( aFileName, aBoard, IO_MGR::KICAD_SEXP );
|
return SaveBoard( aFileName, aBoard, IO_MGR::KICAD_SEXP, aSkipSettings );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,11 @@ BOARD* CreateEmptyBoard();
|
||||||
* Boards can only be saved in KiCad native format.
|
* Boards can only be saved in KiCad native format.
|
||||||
* @param aFileName is the full path to save a copy to.
|
* @param aFileName is the full path to save a copy to.
|
||||||
* @param aBoard is a pointer to a loaded BOARD to save.
|
* @param aBoard is a pointer to a loaded BOARD to save.
|
||||||
|
* @param aSkipSettings if true, only save the board file. This will lose settings changes
|
||||||
|
* that are saved in the project file
|
||||||
* @return true if the save was completed.
|
* @return true if the save was completed.
|
||||||
*/
|
*/
|
||||||
bool SaveBoard( wxString& aFileName, BOARD* aBoard );
|
bool SaveBoard( wxString& aFileName, BOARD* aBoard, bool aSkipSettings = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the nicknames of all of the footprint libraries configured in
|
* Get the nicknames of all of the footprint libraries configured in
|
||||||
|
|
Loading…
Reference in New Issue