ImFusion C++ SDK 4.4.0
ImFusion::PythonInterpreterInterface Class Referenceabstract

#include <ImFusion/Python/PythonInterpreter.h>

Interface for the embedded PythonInterpreter that prevents linking to an explicit Python version. More...

Inheritance diagram for ImFusion::PythonInterpreterInterface:

Detailed Description

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::stringbridgeDirectory () const =0
 Returns the runtime directory from where interpreter bridge plugins can be loaded.
virtual std::unique_ptr< GILScopeGuardgil_scoped_acquire ()=0
virtual std::unique_ptr< GILScopeGuardgil_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 void setApplicationController (ApplicationController &app)=0
virtual std::unique_ptr< ImFusionPlugincreateFactoriesPlugin ()=0

Member Function Documentation

◆ version()

virtual std::string ImFusion::PythonInterpreterInterface::version ( ) const
pure virtual

Returns the Python version of this interpreter (e.g. "3.6").

Implemented in ImFusion::PythonInterpreter.

◆ bridgeDirectory()

virtual const std::string & ImFusion::PythonInterpreterInterface::bridgeDirectory ( ) const
pure virtual

Returns the runtime directory from where interpreter bridge plugins can be loaded.

Implemented in ImFusion::PythonInterpreter.

◆ eval()

virtual std::vector< std::shared_ptr< Data > > ImFusion::PythonInterpreterInterface::eval ( const std::string & expr,
const dict & localData = dict() )
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 ImFusion::PythonInterpreter.

◆ eval_file()

virtual void ImFusion::PythonInterpreterInterface::eval_file ( std::string filename)
pure virtual

Calls pybind11::eval_file Raises an exception on error.

Implemented in ImFusion::PythonInterpreter.

◆ exec()

virtual void ImFusion::PythonInterpreterInterface::exec ( std::string expr)
pure virtual

Calls pybind11::exec Raises an exception on error.

Implemented in ImFusion::PythonInterpreter.

◆ createInteractiveConsole()

virtual void ImFusion::PythonInterpreterInterface::createInteractiveConsole ( MainWindowBase * main)
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 ImFusion::PythonInterpreter.

◆ start()

virtual void ImFusion::PythonInterpreterInterface::start ( )
protectedpure virtual

Implemented in ImFusion::PythonInterpreter.


The documentation for this class was generated from the following file:
  • ImFusion/Python/PythonInterpreter.h
Search Tab / S to search, Esc to close