Add Open-Schematic tool to PcbNew.
Fixes: lp:1780610 * https://bugs.launchpad.net/kicad/+bug/1780610
This commit is contained in:
parent
0c042aff7b
commit
d804427c83
|
@ -73,6 +73,8 @@
|
|||
|
||||
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
|
||||
#include <python_scripting.h>
|
||||
#include <gestfich.h>
|
||||
#include <executable_names.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -225,6 +227,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
PCB_EDIT_FRAME::OnSelectOptionToolbar )
|
||||
|
||||
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, PCB_EDIT_FRAME::OnUpdatePCBFromSch )
|
||||
EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema )
|
||||
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
|
||||
PCB_EDIT_FRAME::OnSelectOptionToolbar )
|
||||
|
@ -1232,6 +1235,71 @@ void PCB_EDIT_FRAME::OnUpdatePCBFromSch( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::OnRunEeschema( wxCommandEvent& event )
|
||||
{
|
||||
wxString msg;
|
||||
wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), SchematicFileExtension );
|
||||
|
||||
if( !schfn.FileExists() )
|
||||
{
|
||||
msg.Printf( _( "Schematic file \"%s\" not found." ), schfn.GetFullPath() );
|
||||
wxMessageBox( msg, _( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Kiface().IsSingle() )
|
||||
{
|
||||
wxString filename = wxT( "\"" ) + schfn.GetFullPath( wxPATH_NATIVE ) + wxT( "\"" );
|
||||
ExecuteFile( this, EESCHEMA_EXE, filename );
|
||||
}
|
||||
else
|
||||
{
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, false );
|
||||
|
||||
// Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls
|
||||
// Kiway.Player( FRAME_SCH, true )
|
||||
// therefore, the schematic editor is sometimes running, but the schematic project
|
||||
// is not loaded, if the library editor was called, and the dialog field editor was used.
|
||||
// On linux, it happens the first time the schematic editor is launched, if
|
||||
// library editor was running, and the dialog field editor was open
|
||||
// On Windows, it happens always after the library editor was called,
|
||||
// and the dialog field editor was used
|
||||
if( !frame )
|
||||
{
|
||||
try
|
||||
{
|
||||
frame = Kiway().Player( FRAME_SCH, true );
|
||||
}
|
||||
catch( const IO_ERROR& err )
|
||||
{
|
||||
wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(),
|
||||
_( "KiCad Error" ), wxOK | wxICON_ERROR, this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( !frame->IsShown() ) // the frame exists, (created by the dialog field editor)
|
||||
// but no project loaded.
|
||||
{
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, schfn.GetFullPath() ) );
|
||||
frame->Show( true );
|
||||
}
|
||||
|
||||
// On Windows, Raise() does not bring the window on screen, when iconized or not shown
|
||||
// On linux, Raise() brings the window on screen, but this code works fine
|
||||
if( frame->IsIconized() )
|
||||
{
|
||||
frame->Iconize( false );
|
||||
// If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
|
||||
// to show the frame at its normal size: Maximize should be called.
|
||||
frame->Maximize( false );
|
||||
}
|
||||
|
||||
frame->Raise();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::OnFlipPcbView( wxCommandEvent& evt )
|
||||
{
|
||||
auto view = GetGalCanvas()->GetView();
|
||||
|
|
|
@ -331,6 +331,7 @@ public:
|
|||
void OnLayerColorChange( wxCommandEvent& aEvent );
|
||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||
void OnUpdatePCBFromSch( wxCommandEvent& event );
|
||||
void OnRunEeschema( wxCommandEvent& event );
|
||||
|
||||
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox );
|
||||
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox );
|
||||
|
|
|
@ -411,6 +411,7 @@ enum pcbnew_ids
|
|||
ID_FOOTPRINT_WIZARD_EXPORT_TO_BOARD,
|
||||
|
||||
ID_UPDATE_PCB_FROM_SCH,
|
||||
ID_RUN_EESCHEMA,
|
||||
ID_EDIT_CUT,
|
||||
ID_EDIT_COPY,
|
||||
ID_EDIT_PASTE,
|
||||
|
|
|
@ -309,6 +309,9 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
|
|||
m_mainToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, *LayerPairBitmap,
|
||||
SEL_LAYER_HELP );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
ADD_TOOL( ID_RUN_EESCHEMA, eeschema_xpm, _( "Open schematic in Eeschema" ) );
|
||||
|
||||
// Access to the scripting console
|
||||
#if defined(KICAD_SCRIPTING_WXPYTHON)
|
||||
if( IsWxPythonLoaded() )
|
||||
|
|
Loading…
Reference in New Issue