![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Python/PythonInterpreter.h>
Interface for the embedded PythonInterpreter that prevents linking to an explicit Python version. More...
Inheritance diagram for PythonInterpreterInterface:Interface for the embedded PythonInterpreter that prevents linking to an explicit Python version.
Classes | |
| class | GILScopeGuard |
Public Types | |
| using | dict = std::unordered_map<std::string, std::shared_ptr<Data>> |
Public Member Functions | |
| virtual std::string | version () const =0 |
| Returns the Python version of this interpreter (e.g. "3.6") | |
| virtual const std::string & | bridgeDirectory () const =0 |
| Returns the runtime directory from where interpreter bridge plugins can be loaded. | |
| virtual std::unique_ptr< GILScopeGuard > | gil_scoped_acquire ()=0 |
| virtual std::unique_ptr< GILScopeGuard > | gil_scoped_release ()=0 |
| virtual std::vector< std::shared_ptr< Data > > | eval (const std::string &expr, const dict &localData=dict())=0 |
| Evaluates a Python expression via pybind11::eval, passing it a set of local data, and returns a vector of Data returned by the expression. | |
| virtual void | eval_file (std::string filename)=0 |
| Calls pybind11::eval_file Raises an exception on error. | |
| virtual void | exec (std::string expr)=0 |
| Calls pybind11::exec Raises an exception on error. | |
| virtual void | createInteractiveConsole (MainWindowBase *main)=0 |
| Creates an interactive console widget in the MainWindow. | |
Protected Member Functions | |
| PythonInterpreterInterface (const std::string &) | |
| virtual void | start ()=0 |
| virtual std::unique_ptr< ImFusionPlugin > | createFactoriesPlugin ()=0 |
| virtual void | setApplicationController (ApplicationController &app)=0 |
|
pure virtual |
Returns the Python version of this interpreter (e.g. "3.6")
Implemented in PythonInterpreter.
|
pure virtual |
Returns the runtime directory from where interpreter bridge plugins can be loaded.
Implemented in PythonInterpreter.
|
pure virtual |
Evaluates a Python expression via pybind11::eval, passing it a set of local data, and returns a vector of Data returned by the expression.
The Python expression is expected to return a Data or a list/tuple/dictionary of Data that are bound. Throws a C++ exception if the expression raises a Python exception.
Implemented in PythonInterpreter.
|
pure virtual |
Calls pybind11::eval_file Raises an exception on error.
Implemented in PythonInterpreter.
|
pure virtual |
Calls pybind11::exec Raises an exception on error.
Implemented in PythonInterpreter.
|
pure virtual |
Creates an interactive console widget in the MainWindow.
The widget is added to a layout with the object name of "logViewerContainer". If no such widget exists in main, the console is launch in a separate window.
What kind of widget is created depends on the PythonSettings::consoleType setting value. With the default value of PythonSettings::NoConsole, no widget is created.
The created widget has an object name of "pythonConsoleWidget". Any existing "pythonConsoleWidget" is deleted when this method is called.
Implemented in PythonInterpreter.
|
protectedpure virtual |
Implemented in PythonInterpreter.