Initial jobset creation and running within the CLI and GUI.
Incomplete, just pushing this before feature freeze, much fixing left
This commit is contained in:
@@ -87,19 +87,19 @@ void ScriptingOnDestructPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
|
||||
}
|
||||
|
||||
|
||||
BOARD* LoadBoard( wxString& aFileName, bool aSetActive )
|
||||
BOARD* LoadBoard( const wxString& aFileName, bool aSetActive, PROJECT* aProject )
|
||||
{
|
||||
if( aFileName.EndsWith( FILEEXT::KiCadPcbFileExtension ) )
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::KICAD_SEXP, aSetActive );
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::KICAD_SEXP, aSetActive, aProject );
|
||||
else if( aFileName.EndsWith( FILEEXT::LegacyPcbFileExtension ) )
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive );
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive, aProject );
|
||||
|
||||
// as fall back for any other kind use the legacy format
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive );
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::LEGACY, aSetActive, aProject );
|
||||
}
|
||||
|
||||
|
||||
BOARD* LoadBoard( wxString& aFileName )
|
||||
BOARD* LoadBoard( const wxString& aFileName )
|
||||
{
|
||||
return LoadBoard( aFileName, false );
|
||||
}
|
||||
@@ -142,12 +142,13 @@ PROJECT* GetDefaultProject()
|
||||
return project;
|
||||
}
|
||||
|
||||
BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat )
|
||||
BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat )
|
||||
{
|
||||
return LoadBoard( aFileName, aFormat, false );
|
||||
}
|
||||
|
||||
BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive )
|
||||
BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive,
|
||||
PROJECT* aProject )
|
||||
{
|
||||
wxFileName pro = aFileName;
|
||||
pro.SetExt( FILEEXT::ProjectFileExtension );
|
||||
@@ -158,7 +159,12 @@ BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSet
|
||||
// It also avoid wxWidget alerts about locale issues, later, when using Python 3
|
||||
LOCALE_IO dummy;
|
||||
|
||||
PROJECT* project = GetSettingsManager()->GetProject( projectPath );
|
||||
PROJECT* project = aProject;
|
||||
|
||||
if( !project )
|
||||
{
|
||||
GetSettingsManager()->GetProject( projectPath );
|
||||
}
|
||||
|
||||
if( !project )
|
||||
{
|
||||
@@ -181,7 +187,15 @@ BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSet
|
||||
|
||||
BASE_SCREEN::m_DrawingSheetFileName = project->GetProjectFile().m_BoardDrawingSheetFile;
|
||||
|
||||
BOARD* brd = PCB_IO_MGR::Load( aFormat, aFileName );
|
||||
BOARD* brd = nullptr;
|
||||
try
|
||||
{
|
||||
brd = PCB_IO_MGR::Load( aFormat, aFileName );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
brd = nullptr;
|
||||
}
|
||||
|
||||
if( brd )
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ BOARD* GetBoard();
|
||||
* This function does not set the board project as the active one
|
||||
* @return a pointer to the board if it was created, or None if not
|
||||
*/
|
||||
BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat );
|
||||
BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat );
|
||||
|
||||
#ifndef SWIG
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat );
|
||||
*
|
||||
* Hidden from SWIG as aSetActive should not be used by python, but cli also leverages this function
|
||||
*/
|
||||
BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive );
|
||||
BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive, PROJECT* aProject = nullptr );
|
||||
#endif
|
||||
|
||||
// Default LoadBoard() to load .kicad_pcb files:.
|
||||
@@ -75,7 +75,7 @@ BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSet
|
||||
*
|
||||
* Hidden from SWIG as aSetActive should not be used by python, but cli also leverages this function
|
||||
*/
|
||||
BOARD* LoadBoard( wxString& aFileName, bool aSetActive );
|
||||
BOARD* LoadBoard( const wxString& aFileName, bool aSetActive, PROJECT* aProject = nullptr );
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ BOARD* LoadBoard( wxString& aFileName, bool aSetActive );
|
||||
* This function does not set the board project as the active one
|
||||
* @return a pointer to the board if it was created, or None if not
|
||||
*/
|
||||
BOARD* LoadBoard( wxString& aFileName );
|
||||
BOARD* LoadBoard( const wxString& aFileName );
|
||||
|
||||
/**
|
||||
* Creates a new board and project with the given filename (will overwrite existing files!)
|
||||
|
||||
Reference in New Issue
Block a user