Apply a big hammer for python script refreshing.

While not ideal, this should tide us over until we have a commit
architecture for python scripts.

Fixes https://gitlab.com/kicad/code/kicad/issues/7065
This commit is contained in:
Jeff Young 2021-11-09 12:00:14 +00:00 committed by Jon Evans
parent b2fa2f81b2
commit f6c160eb50
1 changed files with 20 additions and 4 deletions

View File

@ -32,6 +32,7 @@
#include "pcbnew_scripting_helpers.h"
#include <tool/tool_manager.h>
#include <action_plugin.h>
#include <board.h>
#include <board_design_settings.h>
@ -358,12 +359,27 @@ void Refresh()
{
if( s_PcbEditFrame )
{
auto board = s_PcbEditFrame->GetBoard();
TOOL_MANAGER* toolMgr = s_PcbEditFrame->GetToolManager();
BOARD* board = s_PcbEditFrame->GetBoard();
PCB_DRAW_PANEL_GAL* canvas = s_PcbEditFrame->GetCanvas();
canvas->SyncLayersVisibility( board );
canvas->GetView()->Clear();
canvas->GetView()->InitPreview();
canvas->GetGAL()->SetGridOrigin( VECTOR2D( board->GetDesignSettings().GetGridOrigin() ) );
canvas->DisplayBoard( board );
// allow tools to re-add their view items (selection previews, grids, etc.)
if( toolMgr )
toolMgr->ResetTools( TOOL_BASE::GAL_SWITCH );
// reload the drawing-sheet
s_PcbEditFrame->SetPageSettings( board->GetPageSettings() );
board->BuildConnectivity();
// Re-init everything: this is the easy way to do that
s_PcbEditFrame->ActivateGalCanvas();
s_PcbEditFrame->GetCanvas()->Refresh();
canvas->Refresh();
}
}