From 6d77e594b5d9896b902fe1725e2204701d469445 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 7 Jun 2018 10:03:26 +0200 Subject: [PATCH] Python binding: fix pcbnew.Refresh() to make a better re-initialization. Minor fixes in comments. Fixes: lp:1775003 https://bugs.launchpad.net/kicad/+bug/1775003 --- pcbnew/swig/pcbnew_scripting_helpers.cpp | 8 +++++--- pcbnew/swig/pcbnew_scripting_helpers.h | 2 +- utils/kicad2step/pcb/oce_utils.cpp | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pcbnew/swig/pcbnew_scripting_helpers.cpp b/pcbnew/swig/pcbnew_scripting_helpers.cpp index 065c029f75..066659ed0a 100644 --- a/pcbnew/swig/pcbnew_scripting_helpers.cpp +++ b/pcbnew/swig/pcbnew_scripting_helpers.cpp @@ -110,9 +110,11 @@ void Refresh() if( s_PcbEditFrame->IsGalCanvasActive() ) { - auto panel = static_cast( s_PcbEditFrame->GetGalCanvas() ); - panel->DisplayBoard(board); - s_PcbEditFrame->GetGalCanvas()->Refresh(); + auto gal_canvas = static_cast( s_PcbEditFrame->GetGalCanvas() ); + + // Reinit everything: this is the easy way to do that + s_PcbEditFrame->UseGalCanvas( true ); + gal_canvas->Refresh(); } else // first argument is erase background, second is a wxRect that diff --git a/pcbnew/swig/pcbnew_scripting_helpers.h b/pcbnew/swig/pcbnew_scripting_helpers.h index 6233b3ac5b..a2e009bde8 100644 --- a/pcbnew/swig/pcbnew_scripting_helpers.h +++ b/pcbnew/swig/pcbnew_scripting_helpers.h @@ -50,7 +50,7 @@ BOARD* LoadBoard( wxString& aFileName ); bool SaveBoard( wxString& aFileName, BOARD* aBoard ); /** - * Update the board display after modifying it bu a python script + * Update the board display after modifying it by a python script * (note: it is automatically called by action plugins, after running the plugin, * so call this function is usually not needed inside action plugins * diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index 30602d1c9a..860243e9f3 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -82,7 +82,7 @@ // nominal offset from the board #define BOARD_OFFSET (0.05 ) // min. length**2 below which 2 points are considered coincident -#define MIN_LENGTH2 (0.0001) +#define MIN_LENGTH2 (0.0001) // = 0.01*0.01 static void getEndPoints( const KICADCURVE& aCurve, double& spx0, double& spy0, double& epx0, double& epy0 )