Loading CMakeLists.txt +8 −0 Original line number Original line Diff line number Diff line Loading @@ -129,6 +129,14 @@ if(USE_WX_OVERLAY OR APPLE) add_definitions(-DUSE_WX_OVERLAY) add_definitions(-DUSE_WX_OVERLAY) endif(USE_WX_OVERLAY OR APPLE) endif(USE_WX_OVERLAY OR APPLE) if(KICAD_SCRIPTING) add_definitions(-DKICAD_SCRIPTING) endif(KICAD_SCRIPTING) if(KICAD_SCRIPTING_MODULES) add_definitions(-DKICAD_SCRIPTING_MODULES) endif(KICAD_SCRIPTING_MODULES) if(USE_WX_GRAPHICS_CONTEXT) if(USE_WX_GRAPHICS_CONTEXT) add_definitions(-DUSE_WX_GRAPHICS_CONTEXT) add_definitions(-DUSE_WX_GRAPHICS_CONTEXT) Loading common/basicframe.cpp +9 −1 Original line number Original line Diff line number Diff line Loading @@ -539,7 +539,15 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event ) tmp << wxT( "OFF\n" ); tmp << wxT( "OFF\n" ); #endif #endif tmp << wxT( " USE_BOOST_POLYGON_LIBRARY" ); tmp << wxT( " USE_BOOST_POLYGON_LIBRARY\n" ); tmp << wxT( " KICAD_SCRIPTING=" ); #ifdef KICAD_SCRIPTING tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif wxTheClipboard->SetData( new wxTextDataObject( tmp ) ); wxTheClipboard->SetData( new wxTextDataObject( tmp ) ); wxTheClipboard->Close(); wxTheClipboard->Close(); Loading pcbnew/CMakeLists.txt +18 −12 Original line number Original line Diff line number Diff line Loading @@ -8,8 +8,9 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) INCLUDE(${SWIG_USE_FILE}) INCLUDE(${SWIG_USE_FILE}) FIND_PACKAGE(PythonLibs) FIND_PACKAGE(PythonLibs) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) add_definitions(-DPCBNEW -DKICAD_SCRIPTING) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKICAD_SCRIPTING -DKICAD_SCRIPTING_MODULES") endif() endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) ### ### # Includes # Includes Loading Loading @@ -259,7 +260,7 @@ if (KICAD_SCRIPTING) pcbnew_wrap.cxx pcbnew_wrap.cxx ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ) ) endif() endif(KICAD_SCRIPTING) ## ## # Scripting build # Scripting build Loading @@ -270,7 +271,7 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting ) set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting ) if (DEBUG) if (DEBUG) set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG) set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG) endif() endif(DEBUG) # collect CFLAGS , and pass them to swig later # collect CFLAGS , and pass them to swig later get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS ) get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS ) Loading @@ -281,12 +282,13 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) # check if we have IO_MGR and KICAD_PLUGIN available # check if we have IO_MGR and KICAD_PLUGIN available if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE ) if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE ) SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN) SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN) endif() endif(USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE) if ( USE_PCBNEW_NANOMETRES ) if ( USE_PCBNEW_NANOMETRES ) SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES) SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES) endif() endif( USE_PCBNEW_NANOMETRES ) endif() endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) if (KICAD_SCRIPTING) if (KICAD_SCRIPTING) Loading Loading @@ -337,9 +339,9 @@ if (KICAD_SCRIPTING_MODULES) endif (KICAD_SCRIPTING_MODULES) endif (KICAD_SCRIPTING_MODULES) if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) if ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32) set ( PCBNEW_EXTRA_LIBS "rt" ) set ( PCBNEW_EXTRA_LIBS "rt" ) endif (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) endif ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32) ### ### Loading Loading @@ -459,9 +461,13 @@ if (KICAD_SCRIPTING_MODULES) install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST}) DESTINATION ${PYTHON_DEST}) if (WIN32) install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.dso DESTINATION ${PYTHON_DEST}) else(WIN32) install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST}) DESTINATION ${PYTHON_DEST}) endif(WIN32) endif(KICAD_SCRIPTING_MODULES) endif(KICAD_SCRIPTING_MODULES) Loading scripting/kicadplugins.i +20 −7 Original line number Original line Diff line number Diff line Loading @@ -45,10 +45,23 @@ def LoadPlugins(): import os import os import sys import sys plugins_dir = os.environ['HOME']+'/.kicad_plugins/' # Use environment variable KICAD_PATH to derive path to plugins as a temporary solution kicad_path = os.environ.get('KICAD_PATH') plugin_directories=[] sys.path.append(plugins_dir) if kicad_path and os.path.isdir(kicad_path): plugin_directories.append(os.path.join(kicad_path, 'scripting', 'plugins')) if sys.platform.startswith('linux'): plugin_directories.append(os.environ['HOME']+'/.kicad_plugins/') plugin_directories.append(os.environ['HOME']+'/.kicad/scripting/plugins/') # scan all possible directories for plugins, and load them for plugins_dir in plugin_directories: sys.path.append(plugins_dir) if not os.path.isdir(plugins_dir): continue for module in os.listdir(plugins_dir): for module in os.listdir(plugins_dir): if os.path.isdir(plugins_dir+module): if os.path.isdir(plugins_dir+module): __import__(module, locals(), globals()) __import__(module, locals(), globals()) Loading Loading
CMakeLists.txt +8 −0 Original line number Original line Diff line number Diff line Loading @@ -129,6 +129,14 @@ if(USE_WX_OVERLAY OR APPLE) add_definitions(-DUSE_WX_OVERLAY) add_definitions(-DUSE_WX_OVERLAY) endif(USE_WX_OVERLAY OR APPLE) endif(USE_WX_OVERLAY OR APPLE) if(KICAD_SCRIPTING) add_definitions(-DKICAD_SCRIPTING) endif(KICAD_SCRIPTING) if(KICAD_SCRIPTING_MODULES) add_definitions(-DKICAD_SCRIPTING_MODULES) endif(KICAD_SCRIPTING_MODULES) if(USE_WX_GRAPHICS_CONTEXT) if(USE_WX_GRAPHICS_CONTEXT) add_definitions(-DUSE_WX_GRAPHICS_CONTEXT) add_definitions(-DUSE_WX_GRAPHICS_CONTEXT) Loading
common/basicframe.cpp +9 −1 Original line number Original line Diff line number Diff line Loading @@ -539,7 +539,15 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event ) tmp << wxT( "OFF\n" ); tmp << wxT( "OFF\n" ); #endif #endif tmp << wxT( " USE_BOOST_POLYGON_LIBRARY" ); tmp << wxT( " USE_BOOST_POLYGON_LIBRARY\n" ); tmp << wxT( " KICAD_SCRIPTING=" ); #ifdef KICAD_SCRIPTING tmp << wxT( "ON\n" ); #else tmp << wxT( "OFF\n" ); #endif wxTheClipboard->SetData( new wxTextDataObject( tmp ) ); wxTheClipboard->SetData( new wxTextDataObject( tmp ) ); wxTheClipboard->Close(); wxTheClipboard->Close(); Loading
pcbnew/CMakeLists.txt +18 −12 Original line number Original line Diff line number Diff line Loading @@ -8,8 +8,9 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) INCLUDE(${SWIG_USE_FILE}) INCLUDE(${SWIG_USE_FILE}) FIND_PACKAGE(PythonLibs) FIND_PACKAGE(PythonLibs) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) add_definitions(-DPCBNEW -DKICAD_SCRIPTING) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKICAD_SCRIPTING -DKICAD_SCRIPTING_MODULES") endif() endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) ### ### # Includes # Includes Loading Loading @@ -259,7 +260,7 @@ if (KICAD_SCRIPTING) pcbnew_wrap.cxx pcbnew_wrap.cxx ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ${PCBNEW_SCRIPTING_PYTHON_HELPERS} ) ) endif() endif(KICAD_SCRIPTING) ## ## # Scripting build # Scripting build Loading @@ -270,7 +271,7 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting ) set(SWIG_FLAGS -I${CMAKE_CURRENT_SOURCE_DIR}/../.. -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting ) if (DEBUG) if (DEBUG) set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG) set(SWIG_FLAGS ${SWIG_FLAGS} -DDEBUG) endif() endif(DEBUG) # collect CFLAGS , and pass them to swig later # collect CFLAGS , and pass them to swig later get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS ) get_directory_property( DirDefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS ) Loading @@ -281,12 +282,13 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) # check if we have IO_MGR and KICAD_PLUGIN available # check if we have IO_MGR and KICAD_PLUGIN available if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE ) if ( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE ) SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN) SET(SWIG_FLAGS ${SWIG_FLAGS} -DBUILD_WITH_PLUGIN) endif() endif(USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE) if ( USE_PCBNEW_NANOMETRES ) if ( USE_PCBNEW_NANOMETRES ) SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES) SET(SWIG_FLAGS ${SWIG_FLAGS} -DUSE_PCBNEW_NANOMETRES) endif() endif( USE_PCBNEW_NANOMETRES ) endif() endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) if (KICAD_SCRIPTING) if (KICAD_SCRIPTING) Loading Loading @@ -337,9 +339,9 @@ if (KICAD_SCRIPTING_MODULES) endif (KICAD_SCRIPTING_MODULES) endif (KICAD_SCRIPTING_MODULES) if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) if ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32) set ( PCBNEW_EXTRA_LIBS "rt" ) set ( PCBNEW_EXTRA_LIBS "rt" ) endif (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) endif ((KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES) AND NOT WIN32) ### ### Loading Loading @@ -459,9 +461,13 @@ if (KICAD_SCRIPTING_MODULES) install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py install(FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST}) DESTINATION ${PYTHON_DEST}) if (WIN32) install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.dso DESTINATION ${PYTHON_DEST}) else(WIN32) install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so install(FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST}) DESTINATION ${PYTHON_DEST}) endif(WIN32) endif(KICAD_SCRIPTING_MODULES) endif(KICAD_SCRIPTING_MODULES) Loading
scripting/kicadplugins.i +20 −7 Original line number Original line Diff line number Diff line Loading @@ -45,10 +45,23 @@ def LoadPlugins(): import os import os import sys import sys plugins_dir = os.environ['HOME']+'/.kicad_plugins/' # Use environment variable KICAD_PATH to derive path to plugins as a temporary solution kicad_path = os.environ.get('KICAD_PATH') plugin_directories=[] sys.path.append(plugins_dir) if kicad_path and os.path.isdir(kicad_path): plugin_directories.append(os.path.join(kicad_path, 'scripting', 'plugins')) if sys.platform.startswith('linux'): plugin_directories.append(os.environ['HOME']+'/.kicad_plugins/') plugin_directories.append(os.environ['HOME']+'/.kicad/scripting/plugins/') # scan all possible directories for plugins, and load them for plugins_dir in plugin_directories: sys.path.append(plugins_dir) if not os.path.isdir(plugins_dir): continue for module in os.listdir(plugins_dir): for module in os.listdir(plugins_dir): if os.path.isdir(plugins_dir+module): if os.path.isdir(plugins_dir+module): __import__(module, locals(), globals()) __import__(module, locals(), globals()) Loading