Make the python window follow the parent app

The Python window is pinned to the main KiCad application but to the
user, it appears that the window opens in response to their clicking
eeschema or pcbnew.  For this reason, we should re-center the python
window when the user will expect to see it when showing.

Fixes https://gitlab.com/kicad/code/kicad/issues/8623
This commit is contained in:
Seth Hillbrand 2021-09-21 15:00:14 -07:00
parent becc3a228e
commit 8a5388cf65
1 changed files with 5 additions and 0 deletions

View File

@ -214,6 +214,9 @@ void EDA_DRAW_FRAME::ScriptingConsoleEnableDisable()
{ {
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PYTHON, false ); KIWAY_PLAYER* frame = Kiway().Player( FRAME_PYTHON, false );
wxRect rect = GetScreenRect();
wxPoint center = rect.GetPosition() + rect.GetSize() / 2;
if( !frame ) if( !frame )
{ {
frame = Kiway().Player( FRAME_PYTHON, true, Kiway().GetTop() ); frame = Kiway().Player( FRAME_PYTHON, true, Kiway().GetTop() );
@ -230,11 +233,13 @@ void EDA_DRAW_FRAME::ScriptingConsoleEnableDisable()
frame->Iconize( false ); frame->Iconize( false );
frame->Raise(); frame->Raise();
frame->SetPosition( center - frame->GetSize() / 2 );
return; return;
} }
frame->Show( !frame->IsVisible() ); frame->Show( !frame->IsVisible() );
frame->SetPosition( center - frame->GetSize() / 2 );
} }