From 507edc54b39eea5d34bd8f410b64b3ea30bf553d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 9 Jan 2023 19:56:48 +0100 Subject: [PATCH] Fix issues related to footprint wizards not loaded/reloaded in fp editor and fp wizard frame. Fixes #11195 https://gitlab.com/kicad/code/kicad/issues/11195 --- pcbnew/footprint_edit_frame.cpp | 5 ++++- pcbnew/footprint_wizard_frame.cpp | 16 +++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index b77b080639..a2522fa8b5 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2015-2016 Wayne Stambaugh - * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -1066,6 +1066,9 @@ void FOOTPRINT_EDIT_FRAME::setupTools() m_toolManager->InitTools(); m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); + + // Load or reload wizard plugins in case they changed since the last time the frame opened + m_toolManager->RunAction( PCB_ACTIONS::pluginsReload, true ); } diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index ac77e4d1d0..ca117d75a2 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2012-2015 Miguel Angel Ajo Pelayo * Copyright (C) 2012-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -53,6 +53,7 @@ #include "tools/pcb_selection_tool.h" #include "tools/pcb_control.h" #include "tools/pcb_actions.h" +#include BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME ) @@ -142,6 +143,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent m_toolManager->RegisterTool( new PCB_CONTROL ); m_toolManager->RegisterTool( new PCB_SELECTION_TOOL ); // for std context menus (zoom & grid) + m_toolManager->RegisterTool( new SCRIPTING_TOOL ); m_toolManager->RegisterTool( new COMMON_TOOLS ); m_toolManager->InitTools(); @@ -636,12 +638,12 @@ void FOOTPRINT_WIZARD_FRAME::PythonPluginsReload() { // Reload the Python plugins // Because the board editor has also a plugin python menu, - // call PCB_EDIT_FRAME::PythonPluginsReload() if the board editor - // is running - auto brd_frame = static_cast( Kiway().Player( FRAME_PCB_EDITOR, false ) ); + // call the PCB_EDIT_FRAME RunAction() if the board editor is running + // Otherwise run the current RunAction(). + PCB_EDIT_FRAME* pcbframe = static_cast( Kiway().Player( FRAME_PCB_EDITOR, false ) ); - if( brd_frame ) - brd_frame->GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload ); + if( pcbframe ) + pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true ); else - GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload ); + GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload, true ); }