mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 17:23:44 +00:00
Remove PYTHON_* compile options
This commit is contained in:
parent
33c0bb78fd
commit
f274a00c08
CMakeLists.txt
CMakeModules
common
eeschema/symbol_editor
include
pcbnew
board_item.cpp
dialogs
footprint_wizard_frame.cppfootprint_wizard_frame.hmenubar_footprint_editor.cppmenubar_pcb_editor.cpppcb_edit_frame.cpppcb_edit_frame.hpcbnew.cpppcbnew_config.cpppcbnew_settings.cpppcbnew_settings.hswig
toolbars_footprint_editor.cpptoolbars_pcb_editor.cpptools
scripting/pybind11
.cpp.modules.sources
bits/types
common.cppcore
eda_rect.cppeda_units.cppeda_units_1.cppgal
gr_basic.cppinspectable.cppki_exception.cppkicad_binder.cfgkicad_include.hppkiid.cpplayers_id_colors_and_visibility.cpplayers_id_colors_and_visibility_1.cpplib_circle.cpplib_field.cpplib_item.cpplib_pin.cpplib_rectangle.cpplib_symbol.cppmacros.cpprender_settings.cpprichio.cpptool
unknown
unknown.cppunknown_1.cppunknown_10.cppunknown_11.cppunknown_12.cppunknown_13.cppunknown_14.cppunknown_15.cppunknown_16.cppunknown_17.cppunknown_18.cppunknown_19.cppunknown_2.cppunknown_20.cppunknown_21.cppunknown_22.cppunknown_23.cppunknown_24.cppunknown_25.cppunknown_26.cppunknown_27.cppunknown_28.cppunknown_29.cppunknown_3.cppunknown_30.cppunknown_31.cppunknown_32.cppunknown_33.cppunknown_34.cppunknown_35.cppunknown_36.cppunknown_37.cppunknown_38.cppunknown_39.cppunknown_4.cppunknown_40.cppunknown_41.cppunknown_42.cppunknown_43.cppunknown_44.cppunknown_45.cppunknown_46.cppunknown_47.cppunknown_48.cppunknown_49.cppunknown_5.cppunknown_50.cppunknown_51.cppunknown_52.cppunknown_53.cppunknown_54.cppunknown_55.cppunknown_56.cppunknown_57.cppunknown_58.cppunknown_59.cppunknown_6.cppunknown_60.cppunknown_61.cppunknown_62.cppunknown_63.cppunknown_64.cppunknown_65.cppunknown_66.cppunknown_67.cppunknown_68.cppunknown_69.cppunknown_7.cppunknown_70.cppunknown_71.cppunknown_72.cppunknown_73.cppunknown_74.cppunknown_75.cppunknown_76.cppunknown_77.cppunknown_78.cppunknown_79.cppunknown_8.cppunknown_80.cppunknown_81.cppunknown_82.cppunknown_83.cppunknown_84.cppunknown_85.cppunknown_86.cppunknown_87.cppunknown_88.cppunknown_89.cppunknown_9.cpp
view
wx
@ -54,30 +54,14 @@ cmake_dependent_option( BUILD_SMALL_DEBUG_FILES "In debug build: create smaller
|
||||
# so that build option settings can be included in bug reports.
|
||||
#
|
||||
|
||||
option( KICAD_SCRIPTING
|
||||
"Build the Python scripting support inside KiCad binaries (default ON)."
|
||||
ON )
|
||||
|
||||
option( KICAD_SCRIPTING_MODULES
|
||||
"Build native portion of the pcbnew Python module: _pcbnew.{pyd,so} for OS command line use of Python."
|
||||
ON )
|
||||
|
||||
option( KICAD_SCRIPTING_PYTHON3
|
||||
"Build for Python 3 instead of 2 (default OFF)."
|
||||
OFF )
|
||||
|
||||
option( KICAD_SCRIPTING_WXPYTHON
|
||||
"Build wxPython implementation for wx interface building in Python and py.shell (default ON)."
|
||||
ON )
|
||||
|
||||
option( KICAD_SCRIPTING_WXPYTHON_PHOENIX
|
||||
"Use new wxPython binding (default OFF)."
|
||||
OFF )
|
||||
|
||||
option( KICAD_SCRIPTING_ACTION_MENU
|
||||
"Build a tools menu with registered python plugins: actions plugins (default ON)."
|
||||
ON )
|
||||
|
||||
option( KICAD_USE_OCE
|
||||
"Build tools and plugins related to OpenCascade Community Edition (default ON)"
|
||||
ON )
|
||||
@ -161,31 +145,6 @@ option( KICAD_GAL_PROFILE
|
||||
"Enable profiling info for GAL"
|
||||
OFF )
|
||||
|
||||
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
||||
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
||||
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
||||
# when not defined by user, the default is python.exe under Windows and python2 for others
|
||||
# python binary file should be in exec path.
|
||||
|
||||
# KICAD_SCRIPTING controls the entire python scripting system. If it is off, no other scripting
|
||||
# functions are available.
|
||||
if ( NOT KICAD_SCRIPTING )
|
||||
message( STATUS "KICAD_SCRIPTING is OFF: Disabling all python scripting support" )
|
||||
set( KICAD_SCRIPTING_MODULES OFF )
|
||||
set( KICAD_SCRIPTING_ACTION_MENU OFF )
|
||||
set( KICAD_SCRIPTING_PYTHON3 OFF )
|
||||
set( KICAD_SCRIPTING_WXPYTHON OFF )
|
||||
set( KICAD_SCRIPTING_WXPYTHON_PHOENIX OFF)
|
||||
endif()
|
||||
|
||||
# KICAD_SCRIPTING_WXPYTHON_PHOENIX requires enabling the KICAD_SCRIPTING_WXPYTHON flag
|
||||
# so that the wxWidgets library is properly versioned
|
||||
if ( KICAD_SCRIPTING AND NOT KICAD_SCRIPTING_WXPYTHON AND KICAD_SCRIPTING_WXPYTHON_PHOENIX )
|
||||
message( STATUS
|
||||
"KICAD_SCRIPTING_WXPYTHON_PHOENIX has been requested, setting KICAD_SCRIPTING_WXPYTHON to ON")
|
||||
set( KICAD_SCRIPTING_WXPYTHON ON)
|
||||
endif()
|
||||
|
||||
# Global setting: exports are explicit
|
||||
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
|
||||
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
|
||||
|
@ -69,10 +69,8 @@
|
||||
#define WXPYTHON_VERSION "@WXPYTHON_VERSION@"
|
||||
#endif
|
||||
|
||||
#if defined( KICAD_SCRIPTING )
|
||||
#define PYTHON_VERSION_MAJOR @PYTHON_VERSION_MAJOR@
|
||||
#define PYTHON_VERSION_MINOR @PYTHON_VERSION_MINOR@
|
||||
#endif
|
||||
|
||||
/// A file extension with a leading '.' is a suffix, and this one is used on
|
||||
/// top level program modules which implement the KIFACE.
|
||||
|
@ -208,20 +208,6 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
// Add build settings config (build options):
|
||||
aMsg << "Build settings:" << eol;
|
||||
|
||||
aMsg << indent4 << "KICAD_SCRIPTING=";
|
||||
#ifdef KICAD_SCRIPTING
|
||||
aMsg << ON;
|
||||
#else
|
||||
aMsg << OFF;
|
||||
#endif
|
||||
|
||||
aMsg << indent4 << "KICAD_SCRIPTING_MODULES=";
|
||||
#ifdef KICAD_SCRIPTING_MODULES
|
||||
aMsg << ON;
|
||||
#else
|
||||
aMsg << OFF;
|
||||
#endif
|
||||
|
||||
aMsg << indent4 << "KICAD_SCRIPTING_PYTHON3=";
|
||||
#ifdef KICAD_SCRIPTING_PYTHON3
|
||||
aMsg << ON;
|
||||
@ -229,13 +215,6 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
aMsg << OFF;
|
||||
#endif
|
||||
|
||||
aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON=";
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
aMsg << ON;
|
||||
#else
|
||||
aMsg << OFF;
|
||||
#endif
|
||||
|
||||
aMsg << indent4 << "KICAD_SCRIPTING_WXPYTHON_PHOENIX=";
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON_PHOENIX
|
||||
aMsg << ON;
|
||||
@ -243,13 +222,6 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
aMsg << OFF;
|
||||
#endif
|
||||
|
||||
aMsg << indent4 << "KICAD_SCRIPTING_ACTION_MENU=";
|
||||
#ifdef KICAD_SCRIPTING_ACTION_MENU
|
||||
aMsg << ON;
|
||||
#else
|
||||
aMsg << OFF;
|
||||
#endif
|
||||
|
||||
#ifdef KICAD_USE_OCE
|
||||
aMsg << indent4 << "KICAD_USE_OCE=" << ON;
|
||||
#endif
|
||||
|
@ -63,6 +63,9 @@
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#include <wx/snglinst.h>
|
||||
#include <wx/fdrepdlg.h>
|
||||
|
||||
#define FR_HISTORY_LIST_CNT 10 ///< Maximum size of the find/replace history stacks.
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <eda_item.h>
|
||||
@ -31,6 +32,7 @@
|
||||
#include <trigo.h>
|
||||
#include <i18n_utility.h>
|
||||
|
||||
#include <wx/fdrepdlg.h>
|
||||
|
||||
EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) :
|
||||
m_status( 0 ),
|
||||
@ -234,6 +236,9 @@ std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os )
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static struct EDA_ITEM_DESC
|
||||
{
|
||||
EDA_ITEM_DESC()
|
||||
|
@ -174,10 +174,7 @@ struct APP_SINGLE_TOP : public wxApp
|
||||
|
||||
int OnExit() override
|
||||
{
|
||||
// Fixes segfault when wxPython scripting is enabled.
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
program.OnPgmExit();
|
||||
#endif
|
||||
return wxApp::OnExit();
|
||||
}
|
||||
|
||||
@ -203,10 +200,6 @@ struct APP_SINGLE_TOP : public wxApp
|
||||
wxLogError( wxT( "Unhandled exception of unknown type" ) );
|
||||
}
|
||||
|
||||
// Works properly when wxPython scripting is disabled.
|
||||
#if !defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
program.OnPgmExit();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -129,8 +129,8 @@ void SYMBOL_EDIT_FRAME::ExportPart()
|
||||
fn.MakeAbsolute();
|
||||
|
||||
LIB_PART* old_part = NULL;
|
||||
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
|
||||
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::GuessPluginTypeFromLibPath( fn.GetFullPath() );
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );
|
||||
|
||||
if( fn.FileExists() )
|
||||
{
|
||||
|
@ -51,15 +51,15 @@ enum class SEARCH_RESULT
|
||||
enum FIND_REPLACE_FLAGS
|
||||
{
|
||||
// The last wxFindReplaceFlag enum is wxFR_MATCHCASE = 0x4.
|
||||
FR_CURRENT_SHEET_ONLY = wxFR_MATCHCASE << 1, // Search the current sheet only.
|
||||
FR_SEARCH_ALL_FIELDS = wxFR_MATCHCASE << 2, // Search hidden fields too.
|
||||
FR_SEARCH_ALL_PINS = wxFR_MATCHCASE << 3, // Search pin name and number.
|
||||
FR_MATCH_WILDCARD = wxFR_MATCHCASE << 4, // Use simple wild card matching (* & ?).
|
||||
FR_SEARCH_WRAP = wxFR_MATCHCASE << 5, // Wrap around the start or end of search.
|
||||
FR_SEARCH_REPLACE = wxFR_MATCHCASE << 7, // Search for a item that has replaceable text.
|
||||
FR_REPLACE_ITEM_FOUND = wxFR_MATCHCASE << 8, // Indicates an item with replaceable text has
|
||||
FR_CURRENT_SHEET_ONLY = 0x4 << 1, // Search the current sheet only.
|
||||
FR_SEARCH_ALL_FIELDS = 0x4 << 2, // Search hidden fields too.
|
||||
FR_SEARCH_ALL_PINS = 0x4 << 3, // Search pin name and number.
|
||||
FR_MATCH_WILDCARD = 0x4 << 4, // Use simple wild card matching (* & ?).
|
||||
FR_SEARCH_WRAP = 0x4 << 5, // Wrap around the start or end of search.
|
||||
FR_SEARCH_REPLACE = 0x4 << 7, // Search for a item that has replaceable text.
|
||||
FR_REPLACE_ITEM_FOUND = 0x4 << 8, // Indicates an item with replaceable text has
|
||||
// been found.
|
||||
FR_REPLACE_REFERENCES = wxFR_MATCHCASE << 9 // Don't replace in references.
|
||||
FR_REPLACE_REFERENCES = 0x4 << 9 // Don't replace in references.
|
||||
};
|
||||
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
#include <wx/debug.h>
|
||||
#include <i18n_utility.h>
|
||||
#include <board.h>
|
||||
|
@ -36,14 +36,7 @@
|
||||
#include <dialog_footprint_wizard_list.h>
|
||||
#include <footprint_wizard_frame.h>
|
||||
|
||||
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
|
||||
#include <python_scripting.h>
|
||||
#else
|
||||
// Dummy functions, actually defined in python_scripting.h when KICAD_SCRIPTING is enabled
|
||||
static void pcbnewGetWizardsBackTrace( wxString& aText ) {}
|
||||
static void pcbnewGetScriptsSearchPaths( wxString& aText ) {}
|
||||
static void pcbnewGetUnloadableScriptNames( wxString& aText ) {}
|
||||
#endif
|
||||
|
||||
enum FPGeneratorRowNames
|
||||
{
|
||||
@ -156,12 +149,10 @@ void DIALOG_FOOTPRINT_WIZARD_LIST::initLists()
|
||||
|
||||
void DIALOG_FOOTPRINT_WIZARD_LIST::onUpdatePythonModulesClick( wxCommandEvent& event )
|
||||
{
|
||||
#if defined(KICAD_SCRIPTING)
|
||||
FOOTPRINT_WIZARD_FRAME* fpw_frame = static_cast<FOOTPRINT_WIZARD_FRAME*>( GetParent() );
|
||||
fpw_frame->PythonPluginsReload();
|
||||
|
||||
initLists();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,12 +30,7 @@
|
||||
#include <grid_tricks.h>
|
||||
#include <widgets/wx_grid.h>
|
||||
|
||||
#if defined( KICAD_SCRIPTING ) || defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
#include <python_scripting.h>
|
||||
#else
|
||||
// Dummy functions, actually defined in python_scripting.h when KICAD_SCRIPTING is enabled
|
||||
static void pcbnewGetWizardsBackTrace( wxString& aText ) {}
|
||||
#endif
|
||||
|
||||
#define GRID_CELL_MARGIN 4
|
||||
|
||||
|
@ -638,7 +638,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar()
|
||||
// Currently, there is no vertical toolbar
|
||||
}
|
||||
|
||||
#if defined(KICAD_SCRIPTING)
|
||||
void FOOTPRINT_WIZARD_FRAME::PythonPluginsReload()
|
||||
{
|
||||
// Reload the Python plugins
|
||||
@ -652,6 +651,3 @@ void FOOTPRINT_WIZARD_FRAME::PythonPluginsReload()
|
||||
else
|
||||
PythonPluginsReloadBase();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -85,7 +85,6 @@ public:
|
||||
/**
|
||||
* Reload the Python plugins if they are newer than
|
||||
* the already loaded, and load new plugins if any
|
||||
* Do nothing if KICAD_SCRIPTING is not defined
|
||||
*/
|
||||
void PythonPluginsReload();
|
||||
|
||||
|
@ -51,10 +51,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||
fileMenu->Add( ACTIONS::newLibrary );
|
||||
fileMenu->Add( ACTIONS::addLibrary );
|
||||
fileMenu->Add( PCB_ACTIONS::newFootprint );
|
||||
|
||||
#ifdef KICAD_SCRIPTING
|
||||
fileMenu->Add( PCB_ACTIONS::createFootprint );
|
||||
#endif
|
||||
|
||||
fileMenu->AppendSeparator();
|
||||
|
||||
|
@ -406,13 +406,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||
update = toolsMenu->Add( ACTIONS::updateSchematicFromPcb );
|
||||
update->Enable( !Kiface().IsSingle() );
|
||||
|
||||
|
||||
#if defined(KICAD_SCRIPTING_WXPYTHON)
|
||||
toolsMenu->AppendSeparator();
|
||||
toolsMenu->Add( PCB_ACTIONS::showPythonConsole );
|
||||
#endif
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
ACTION_MENU* submenuActionPlugins = new ACTION_MENU( false, selTool );
|
||||
submenuActionPlugins->SetTitle( _( "External Plugins" ) );
|
||||
submenuActionPlugins->SetIcon( BITMAPS::puzzle_piece );
|
||||
@ -439,8 +435,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||
|
||||
toolsMenu->AppendSeparator();
|
||||
toolsMenu->Add( submenuActionPlugins );
|
||||
#endif
|
||||
|
||||
|
||||
//-- Preferences menu ----------------------------------------------------
|
||||
//
|
||||
|
@ -92,18 +92,12 @@
|
||||
#include <dialog_drc.h> // for DIALOG_DRC_WINDOW_NAME definition
|
||||
#include <ratsnest/ratsnest_view_item.h>
|
||||
#include <widgets/appearance_controls.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <widgets/panel_selection_filter.h>
|
||||
#include <kiplatform/app.h>
|
||||
|
||||
|
||||
#include <widgets/infobar.h>
|
||||
|
||||
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
|
||||
#include <python_scripting.h>
|
||||
#if defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
#include <action_plugin.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
using namespace std::placeholders;
|
||||
@ -152,11 +146,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
EVT_CHOICE( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
|
||||
EVT_CHOICE( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
|
||||
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, PCB_EDIT_FRAME::OnActionPluginRefresh )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_SHOW_FOLDER, PCB_EDIT_FRAME::OnActionPluginShowFolder )
|
||||
#endif
|
||||
|
||||
// Tracks and vias sizes general options
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
|
||||
@ -555,8 +546,6 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
||||
mgr->SetConditions( PCB_ACTIONS::viaDisplayMode, CHECK( !cond.ViaFillDisplay() ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::trackDisplayMode, CHECK( !cond.TrackFillDisplay() ) );
|
||||
|
||||
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
auto pythonConsoleCond =
|
||||
[] ( const SELECTION& )
|
||||
{
|
||||
@ -570,7 +559,6 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
||||
};
|
||||
|
||||
mgr->SetConditions( PCB_ACTIONS::showPythonConsole, CHECK( pythonConsoleCond ) );
|
||||
#endif
|
||||
|
||||
auto enableZoneControlConition =
|
||||
[this] ( const SELECTION& )
|
||||
@ -1302,8 +1290,6 @@ void PCB_EDIT_FRAME::UpdateUserInterface()
|
||||
}
|
||||
|
||||
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
|
||||
void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable()
|
||||
{
|
||||
wxWindow * pythonPanelFrame = findPythonConsole();
|
||||
@ -1319,7 +1305,6 @@ void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable()
|
||||
else
|
||||
wxMessageBox( wxT( "Error: unable to create the Python Console" ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||
@ -1532,29 +1517,22 @@ void PCB_EDIT_FRAME::RunEeschema()
|
||||
void PCB_EDIT_FRAME::PythonPluginsReload()
|
||||
{
|
||||
// Reload Python plugins if they are newer than the already loaded, and load new plugins
|
||||
#if defined(KICAD_SCRIPTING)
|
||||
#if defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
// Remove all action plugins so that we don't keep references to old versions
|
||||
ACTION_PLUGINS::UnloadAll();
|
||||
#endif
|
||||
|
||||
// Reload plugin list: reload Python plugins if they are newer than the already loaded,
|
||||
// and load new plugins
|
||||
PythonPluginsReloadBase();
|
||||
|
||||
#if defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
// Action plugins can be modified, therefore the plugins menu must be updated:
|
||||
ReCreateMenuBar();
|
||||
// Recreate top toolbar to add action plugin buttons
|
||||
ReCreateHToolbar();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::PythonPluginsShowFolder()
|
||||
{
|
||||
#if defined(KICAD_SCRIPTING)
|
||||
#ifdef __WXMAC__
|
||||
wxString msg;
|
||||
|
||||
@ -1570,13 +1548,11 @@ void PCB_EDIT_FRAME::PythonPluginsShowFolder()
|
||||
|
||||
wxLaunchDefaultApplication( pypath );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::PythonSyncEnvironmentVariables()
|
||||
{
|
||||
#if defined( KICAD_SCRIPTING )
|
||||
const ENV_VAR_MAP& vars = Pgm().GetLocalEnvVariables();
|
||||
|
||||
// Set the environment variables for python scripts
|
||||
@ -1588,13 +1564,11 @@ void PCB_EDIT_FRAME::PythonSyncEnvironmentVariables()
|
||||
// regenerate them (in Unicode) for our normal environment
|
||||
for( auto& var : vars )
|
||||
wxSetEnv( var.first, var.second.GetValue() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::PythonSyncProjectName()
|
||||
{
|
||||
#if defined( KICAD_SCRIPTING )
|
||||
wxString evValue;
|
||||
wxGetEnv( PROJECT_VAR_NAME, &evValue );
|
||||
pcbnewUpdatePythonEnvVar( wxString( PROJECT_VAR_NAME ).ToStdString(), evValue );
|
||||
@ -1602,7 +1576,6 @@ void PCB_EDIT_FRAME::PythonSyncProjectName()
|
||||
// Because PROJECT_VAR_NAME can be modified by the python scripts (rewritten in UTF8),
|
||||
// regenerate it (in Unicode) for our normal environment
|
||||
wxSetEnv( PROJECT_VAR_NAME, evValue );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,25 +96,21 @@ public:
|
||||
/**
|
||||
* Reload the Python plugins if they are newer than the already loaded, and load new
|
||||
* plugins if any.
|
||||
* Do nothing if KICAD_SCRIPTING is not defined.
|
||||
*/
|
||||
void PythonPluginsReload();
|
||||
|
||||
/**
|
||||
* Open the plugins folder in the default system file browser.
|
||||
* Do nothing if KICAD_SCRIPTING is not defined.
|
||||
*/
|
||||
void PythonPluginsShowFolder();
|
||||
|
||||
/**
|
||||
* Synchronize the environment variables from KiCad's environment into the Python interpreter.
|
||||
* Do nothing if KICAD_SCRIPTING is not defined.
|
||||
*/
|
||||
void PythonSyncEnvironmentVariables();
|
||||
|
||||
/**
|
||||
* Synchronize the project name from KiCad's environment into the Python interpreter.
|
||||
* Do nothing if KICAD_SCRIPTING is not defined.
|
||||
*/
|
||||
void PythonSyncProjectName();
|
||||
|
||||
@ -173,8 +169,6 @@ public:
|
||||
// Configurations:
|
||||
void Process_Config( wxCommandEvent& event );
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
|
||||
/**
|
||||
* Return true if button visibility action plugin setting was set to true
|
||||
* or it is unset and plugin defaults to true.
|
||||
@ -187,8 +181,6 @@ public:
|
||||
*/
|
||||
std::vector<ACTION_PLUGIN*> GetOrderedActionPlugins();
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Save changes to the project settings to the project (.pro) file.
|
||||
*/
|
||||
@ -613,12 +605,10 @@ public:
|
||||
*/
|
||||
void OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aRunDragCommand );
|
||||
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
/**
|
||||
* Enable or disable the scripting console.
|
||||
*/
|
||||
void ScriptingConsoleEnableDisable();
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Send a message to the schematic editor so that it may move its cursor
|
||||
@ -705,7 +695,6 @@ protected:
|
||||
*/
|
||||
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
/**
|
||||
* Fill action menu with all registered action plugins
|
||||
*/
|
||||
@ -756,7 +745,6 @@ protected:
|
||||
{
|
||||
PythonPluginsShowFolder();
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Has meaning only if KICAD_SCRIPTING_WXPYTHON option is not defined.
|
||||
|
@ -28,10 +28,8 @@
|
||||
* @brief Pcbnew main program.
|
||||
*/
|
||||
|
||||
#ifdef KICAD_SCRIPTING
|
||||
#include <python_scripting.h>
|
||||
#include <pcbnew_scripting_helpers.h>
|
||||
#endif
|
||||
#include <python_scripting.h>
|
||||
#include <pcbnew_scripting_helpers.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiface_ids.h>
|
||||
@ -82,10 +80,8 @@ static struct IFACE : public KIFACE_I
|
||||
{
|
||||
auto frame = new PCB_EDIT_FRAME( aKiway, aParent );
|
||||
|
||||
#if defined( KICAD_SCRIPTING )
|
||||
// give the scripting helpers access to our frame
|
||||
ScriptingSetPcbEditFrame( frame );
|
||||
#endif
|
||||
|
||||
if( Kiface().IsSingle() )
|
||||
{
|
||||
@ -209,14 +205,11 @@ PGM_BASE* PgmOrNull()
|
||||
{
|
||||
return process;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined( KICAD_SCRIPTING )
|
||||
static bool scriptingSetup()
|
||||
{
|
||||
|
||||
#if defined( __WINDOWS__ )
|
||||
// If our python.exe (in kicad/bin) exists, force our kicad python environment
|
||||
wxString kipython = FindKicadFile( "python.exe" );
|
||||
@ -304,12 +297,10 @@ static bool scriptingSetup()
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // KICAD_SCRIPTING
|
||||
|
||||
|
||||
void PythonPluginsReloadBase()
|
||||
{
|
||||
#if defined( KICAD_SCRIPTING )
|
||||
// Reload plugin list: reload Python plugins if they are newer than the already loaded,
|
||||
// and load new plugins
|
||||
char cmd[1024];
|
||||
@ -324,7 +315,6 @@ void PythonPluginsReloadBase()
|
||||
|
||||
if( retv != 0 )
|
||||
wxLogError( "Python error %d occurred running command:\n\n`%s`", retv, cmd );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -381,9 +371,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( KICAD_SCRIPTING )
|
||||
scriptingSetup();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -391,14 +379,12 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||
|
||||
void IFACE::OnKifaceEnd()
|
||||
{
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
// Restore the thread state and tell Python to cleanup after itself.
|
||||
// wxPython will do its own cleanup as part of that process.
|
||||
// This should only be called if python was setup correctly.
|
||||
|
||||
if( IsWxPythonLoaded() )
|
||||
pcbnewFinishPythonScripting();
|
||||
#endif
|
||||
|
||||
end_common();
|
||||
}
|
||||
|
@ -55,9 +55,7 @@ void PCB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_EDIT_OPTIONS( this, aParent ), _( "Editing Options" ) );
|
||||
book->AddSubPage( new PANEL_PCBNEW_COLOR_SETTINGS( this, book ), _( "Colors" ) );
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
book->AddSubPage( new PANEL_PCBNEW_ACTION_PLUGINS( this, aParent ), _( "Action Plugins" ) );
|
||||
#endif
|
||||
book->AddSubPage( new PANEL_PCBNEW_DISPLAY_ORIGIN( this, aParent ), _( "Origins & Axes" ) );
|
||||
|
||||
aHotkeysPanel->AddHotKeys( GetToolManager() );
|
||||
|
@ -21,6 +21,8 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
#include <common.h>
|
||||
#include <footprint_editor_settings.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
@ -455,7 +457,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
||||
m_params.emplace_back( new PARAM<wxString>( "reannotate_dialog.annotate_report_file_name",
|
||||
&m_Reannotate.report_file_name, "" ) );
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "action_plugins",
|
||||
[&]() -> nlohmann::json
|
||||
{
|
||||
@ -488,7 +489,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
||||
}
|
||||
},
|
||||
nlohmann::json::array() ) );
|
||||
#endif
|
||||
|
||||
addParamsForWindow( &m_FootprintViewer, "footprint_viewer" );
|
||||
|
||||
@ -795,3 +795,17 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//namespace py = pybind11;
|
||||
//
|
||||
//PYBIND11_MODULE( pcbnew, m )
|
||||
//{
|
||||
// py::class_<PCBNEW_SETTINGS>( m, "settings" )
|
||||
// .def_readwrite( "Use45DegreeGraphicSegments", &PCBNEW_SETTINGS::m_Use45DegreeGraphicSegments )
|
||||
// .def_readwrite( "FlipLeftRight", &PCBNEW_SETTINGS::m_FlipLeftRight )
|
||||
// .def_readwrite( "AddUnlockedPads", &PCBNEW_SETTINGS::m_AddUnlockedPads)
|
||||
// .def_readwrite( "UsePolarCoords", &PCBNEW_SETTINGS::m_PolarCoords)
|
||||
// .def_readwrite( "RotationAngle", &PCBNEW_SETTINGS::m_RotationAngle)
|
||||
// .def_readwrite( "ShowPageLimits", &PCBNEW_SETTINGS::m_ShowPageLimits)
|
||||
// ;
|
||||
//}
|
||||
|
@ -57,9 +57,7 @@ enum class TRACK_DRAG_ACTION
|
||||
DRAG_FREE_ANGLE
|
||||
};
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
typedef std::vector<std::pair<wxString, bool>> ACTION_PLUGIN_SETTINGS_LIST;
|
||||
#endif
|
||||
|
||||
|
||||
class PCBNEW_SETTINGS : public APP_SETTINGS_BASE
|
||||
@ -305,9 +303,7 @@ public:
|
||||
|
||||
wxString m_lastFootprint3dDir;
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -189,8 +189,6 @@ void PYTHON_ACTION_PLUGINS::deregister_action( PyObject* aPyAction )
|
||||
}
|
||||
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
|
||||
void PCB_EDIT_FRAME::OnActionPluginMenu( wxCommandEvent& aEvent )
|
||||
{
|
||||
ACTION_PLUGIN* actionPlugin = ACTION_PLUGINS::GetActionByMenu( aEvent.GetId() );
|
||||
@ -471,6 +469,3 @@ bool PCB_EDIT_FRAME::GetActionPluginButtonVisible( const wxString& aPluginPath,
|
||||
// Plugin is not in settings, return default.
|
||||
return aPluginDefault;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -189,8 +189,6 @@ bool pcbnewInitPythonScripting( const char* aStockScriptingPath, const char* aUs
|
||||
Py_Initialize();
|
||||
PySys_SetArgv( Pgm().App().argc, Pgm().App().argv );
|
||||
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
|
||||
#if PY_VERSION_HEX < 0x03070000 // PyEval_InitThreads() is called by Py_Initialize() starting with version 3.7
|
||||
PyEval_InitThreads();
|
||||
#endif // if PY_VERSION_HEX < 0x03070000
|
||||
@ -233,8 +231,6 @@ bool pcbnewInitPythonScripting( const char* aStockScriptingPath, const char* aUs
|
||||
// Global Interpreter Lock.
|
||||
g_PythonMainTState = PyEval_SaveThread();
|
||||
|
||||
#endif // ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
|
||||
// Load pcbnew inside Python and load all the user plugins and package-based plugins
|
||||
{
|
||||
PyLOCK lock;
|
||||
@ -364,9 +360,7 @@ void pcbnewGetWizardsBackTrace( wxString& aTrace )
|
||||
|
||||
void pcbnewFinishPythonScripting()
|
||||
{
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
PyEval_RestoreThread( g_PythonMainTState );
|
||||
#endif
|
||||
Py_Finalize();
|
||||
}
|
||||
|
||||
@ -419,8 +413,6 @@ void pcbnewUpdatePythonEnvVar( const wxString& aVar, const wxString& aValue )
|
||||
wxLogError( "Python error %d occurred running command:\n\n`%s`", retv, cmd );
|
||||
}
|
||||
|
||||
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
void RedirectStdio()
|
||||
{
|
||||
// This is a helpful little tidbit to help debugging and such. It
|
||||
@ -536,7 +528,6 @@ wxWindow* CreatePythonShellWindow( wxWindow* parent, const wxString& aFramenameI
|
||||
|
||||
return window;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
wxString PyStringToWx( PyObject* aString )
|
||||
|
@ -41,14 +41,10 @@
|
||||
#include <Python.h>
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
||||
#ifndef NO_WXPYTHON_EXTENSION_HEADERS
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON_PHOENIX
|
||||
#include <wx/window.h>
|
||||
#else
|
||||
#include <wx/wxPython/wxPython.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON_PHOENIX
|
||||
#include <wx/window.h>
|
||||
#else
|
||||
#include <wx/wxPython/wxPython.h>
|
||||
#endif
|
||||
|
||||
#include <wx/string.h>
|
||||
@ -90,28 +86,11 @@ void pcbnewGetWizardsBackTrace( wxString& aNames );
|
||||
*/
|
||||
void pcbnewUpdatePythonEnvVar( const wxString& aVar, const wxString& aValue );
|
||||
|
||||
|
||||
#ifdef KICAD_SCRIPTING_WXPYTHON
|
||||
void RedirectStdio();
|
||||
wxWindow* CreatePythonShellWindow( wxWindow* parent, const wxString& aFramenameId );
|
||||
#endif
|
||||
|
||||
bool IsWxPythonLoaded();
|
||||
|
||||
#if 0 && defined (KICAD_SCRIPTING_WXPYTHON)
|
||||
// This definition of PyLOCK crashed Pcbnew under some conditions (JPC),
|
||||
// especially reloading plugins
|
||||
class PyLOCK
|
||||
{
|
||||
wxPyBlock_t b;
|
||||
public:
|
||||
|
||||
// @todo, find out why these are wxPython specific. We need the GIL regardless.
|
||||
// Should never assume python will only have one thread calling it.
|
||||
PyLOCK() { b = wxPyBeginBlockThreads(); }
|
||||
~PyLOCK() { wxPyEndBlockThreads( b ); }
|
||||
};
|
||||
#else
|
||||
class PyLOCK
|
||||
{
|
||||
PyGILState_STATE gil_state;
|
||||
@ -119,7 +98,6 @@ public:
|
||||
PyLOCK() { gil_state = PyGILState_Ensure(); }
|
||||
~PyLOCK() { PyGILState_Release( gil_state ); }
|
||||
};
|
||||
#endif
|
||||
|
||||
wxString PyStringToWx( PyObject* str );
|
||||
wxArrayString PyArrayStringToWx( PyObject* arr );
|
||||
|
@ -56,9 +56,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
|
||||
|
||||
// Set up toolbar
|
||||
m_mainToolBar->Add( PCB_ACTIONS::newFootprint );
|
||||
#ifdef KICAD_SCRIPTING
|
||||
m_mainToolBar->Add( PCB_ACTIONS::createFootprint );
|
||||
#endif
|
||||
m_mainToolBar->Add( ACTIONS::save );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user