Get python loading the new "user scripting" paths
This commit is contained in:
parent
73b8ae18f4
commit
30ba3aa240
|
@ -287,7 +287,7 @@ static bool scriptingSetup()
|
|||
if( !path.DirExists() && !path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
|
||||
wxLogError( "Warning: could not create user scripting path %s", path.GetPath() );
|
||||
|
||||
if( !pcbnewInitPythonScripting( TO_UTF8( PyScriptingPath() ) ) )
|
||||
if( !pcbnewInitPythonScripting( TO_UTF8( PyScriptingPath() ), TO_UTF8( PyScriptingPath( true ) ) ) )
|
||||
{
|
||||
wxLogError( "pcbnewInitPythonScripting() failed." );
|
||||
return false;
|
||||
|
@ -305,7 +305,8 @@ void PythonPluginsReloadBase()
|
|||
// and load new plugins
|
||||
char cmd[1024];
|
||||
|
||||
snprintf( cmd, sizeof( cmd ), "pcbnew.LoadPlugins(\"%s\")", TO_UTF8( PyScriptingPath() ) );
|
||||
snprintf( cmd, sizeof( cmd ), "pcbnew.LoadPlugins(\"%s\", \"%s\")", TO_UTF8( PyScriptingPath() ),
|
||||
TO_UTF8( PyScriptingPath( true ) ) );
|
||||
|
||||
PyLOCK lock;
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ PyThreadState* g_PythonMainTState;
|
|||
*
|
||||
* This initializes all the wxPython interface and returns the python thread control structure
|
||||
*/
|
||||
bool pcbnewInitPythonScripting( const char * aUserScriptingPath )
|
||||
bool pcbnewInitPythonScripting( const char* aStockScriptingPath, const char* aUserScriptingPath )
|
||||
{
|
||||
int retv;
|
||||
char cmd[1024];
|
||||
|
@ -242,7 +242,8 @@ bool pcbnewInitPythonScripting( const char * aUserScriptingPath )
|
|||
snprintf( cmd, sizeof( cmd ), "import sys, os, traceback\n"
|
||||
"sys.path.append(\".\")\n"
|
||||
"import pcbnew\n"
|
||||
"pcbnew.LoadPlugins(\"%s\")", aUserScriptingPath );
|
||||
"pcbnew.LoadPlugins(\"%s\", \"%s\")",
|
||||
aStockScriptingPath, aUserScriptingPath );
|
||||
retv = PyRun_SimpleString( cmd );
|
||||
|
||||
if( retv != 0 )
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
/**
|
||||
* Initialize the Python engine inside pcbnew.
|
||||
*/
|
||||
bool pcbnewInitPythonScripting( const char * aUserScriptingPath );
|
||||
void pcbnewFinishPythonScripting();
|
||||
bool pcbnewInitPythonScripting( const char* aStockScriptingPath, const char* aUserScriptingPath );
|
||||
void pcbnewFinishPythonScripting();
|
||||
|
||||
/**
|
||||
* Collect the list of python scripts which could not be loaded.
|
||||
|
|
|
@ -137,7 +137,7 @@ def LoadPluginModule(Dirname, ModuleName, FileName):
|
|||
FULL_BACK_TRACE += traceback.format_exc()
|
||||
|
||||
|
||||
def LoadPlugins(bundlepath=None):
|
||||
def LoadPlugins(bundlepath=None, userpath=None):
|
||||
"""
|
||||
Initialise Scripting/Plugin python environment and load plugins.
|
||||
|
||||
|
@ -191,6 +191,9 @@ def LoadPlugins(bundlepath=None):
|
|||
plugin_directories.append(os.path.join(config_path, 'scripting'))
|
||||
plugin_directories.append(os.path.join(config_path, 'scripting', 'plugins'))
|
||||
|
||||
if userpath:
|
||||
plugin_directories.append(userpath)
|
||||
plugin_directories.append(os.path.join(userpath, 'plugins'))
|
||||
|
||||
global PLUGIN_DIRECTORIES_SEARCH
|
||||
PLUGIN_DIRECTORIES_SEARCH=""
|
||||
|
|
Loading…
Reference in New Issue