Ensure console can be loaded from Eeschema standalone
PcbNew sets up the correct path as a side-effect of loading the action plugins. Fixes https://gitlab.com/kicad/code/kicad/-/issues/8661
This commit is contained in:
parent
a7eb611744
commit
b611da161e
|
@ -32,6 +32,19 @@
|
||||||
|
|
||||||
void KIPYTHON_FRAME::SetupPythonEditor()
|
void KIPYTHON_FRAME::SetupPythonEditor()
|
||||||
{
|
{
|
||||||
|
using namespace pybind11::literals;
|
||||||
|
|
||||||
|
// As always, first grab the GIL
|
||||||
|
PyLOCK lock;
|
||||||
|
|
||||||
|
// Make sure the kicad_pyshell module is in the path
|
||||||
|
wxString sysPath = SCRIPTING::PyScriptingPath( false );
|
||||||
|
auto locals = pybind11::dict( "stock_path"_a = sysPath.ToStdString() );
|
||||||
|
|
||||||
|
pybind11::exec( R"(
|
||||||
|
import sys
|
||||||
|
sys.path.append( stock_path )
|
||||||
|
)", pybind11::globals(), locals );
|
||||||
|
|
||||||
// passing window ids instead of pointers is because wxPython is not
|
// passing window ids instead of pointers is because wxPython is not
|
||||||
// exposing the needed c++ apis to make that possible.
|
// exposing the needed c++ apis to make that possible.
|
||||||
|
@ -39,9 +52,6 @@ void KIPYTHON_FRAME::SetupPythonEditor()
|
||||||
pcbnew_pyshell_one_step << "import kicad_pyshell\n";
|
pcbnew_pyshell_one_step << "import kicad_pyshell\n";
|
||||||
pcbnew_pyshell_one_step << "newshell = kicad_pyshell.makePcbnewShellWindow( " << GetId() << " )\n";
|
pcbnew_pyshell_one_step << "newshell = kicad_pyshell.makePcbnewShellWindow( " << GetId() << " )\n";
|
||||||
|
|
||||||
// As always, first grab the GIL
|
|
||||||
PyLOCK lock;
|
|
||||||
|
|
||||||
// Execute the code to make the makeWindow function we defined above
|
// Execute the code to make the makeWindow function we defined above
|
||||||
PyRun_SimpleString( pcbnew_pyshell_one_step.str().c_str() );
|
PyRun_SimpleString( pcbnew_pyshell_one_step.str().c_str() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue