ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
PythonInterpreter Class Referencefinal

#include <PythonInterpreter.h>

Inheritance diagram for PythonInterpreter:
Collaboration diagram for PythonInterpreter:

Classes

struct  State
 Variable state. More...
 

Public Slots

bool executeFile (const std::string &filePath)
 Execution functions (and slots) More...
 
void executeCode (const std::string &code, QListWidget *output)
 
void executeCodeWithState (const std::string &code, QListWidget *output, PythonInterpreter::State &state)
 
void executeStatementWithState (const std::string &code, QListWidget *output, PythonInterpreter::State &state)
 
void executeFunction (const pybind11::object &function)
 

Signals

void executionStarted ()
 
void executionFinished ()
 

Public Member Functions

 PythonInterpreter (QObject *parent=nullptr)
 
bool isExecuting () const
 
void initialize (const PythonConfig &config)
 
void finalize ()
 
const PythonConfigPathsconfig () const
 

Static Public Member Functions

static bool IsInitialized ()
 

Detailed Description

PythonInterpreter.

There should be only one, and it is managed by the PythonPlugin. It centralizes the execution of python scripts.

Only one script can be executed at a time.

Classes that allow user to start the execution of a script should connect the executionStarted & executionFinished to give feedback on when a script is running and whether a new script can be ran

Definition at line 32 of file PythonInterpreter.h.

Constructor & Destructor Documentation

◆ PythonInterpreter()

PythonInterpreter::PythonInterpreter ( QObject *  parent = nullptr)
explicit

Definition at line 50 of file PythonInterpreter.cpp.

Member Function Documentation

◆ config()

const PythonConfigPaths & PythonInterpreter::config ( ) const

Definition at line 320 of file PythonInterpreter.cpp.

Referenced by initialize().

◆ executeCode

void PythonInterpreter::executeCode ( const std::string &  code,
QListWidget *  output 
)
slot

Definition at line 144 of file PythonInterpreter.cpp.

References executeCodeWithState().

Referenced by PythonEditor::PythonEditor().

◆ executeCodeWithState

void PythonInterpreter::executeCodeWithState ( const std::string &  code,
QListWidget *  output,
PythonInterpreter::State state 
)
slot

Definition at line 130 of file PythonInterpreter.cpp.

Referenced by executeCode().

◆ executeFile

bool PythonInterpreter::executeFile ( const std::string &  filePath)
slot

Execution functions (and slots)

Definition at line 52 of file PythonInterpreter.cpp.

References CreateGlobals(), executionFinished(), executionStarted(), and CVLog::Warning().

Referenced by PythonPluginCommand::process().

◆ executeFunction

void PythonInterpreter::executeFunction ( const pybind11::object &  function)
slot

◆ executeStatementWithState

void PythonInterpreter::executeStatementWithState ( const std::string &  code,
QListWidget *  output,
PythonInterpreter::State state 
)
slot

Definition at line 137 of file PythonInterpreter.cpp.

Referenced by PythonRepl::executeCode().

◆ executionFinished

◆ executionStarted

◆ finalize()

void PythonInterpreter::finalize ( )

Definition at line 298 of file PythonInterpreter.cpp.

◆ initialize()

◆ isExecuting()

bool PythonInterpreter::isExecuting ( ) const

Definition at line 315 of file PythonInterpreter.cpp.

Referenced by KeyPressEater::eventFilter().

◆ IsInitialized()

bool PythonInterpreter::IsInitialized ( )
static

Definition at line 293 of file PythonInterpreter.cpp.

Referenced by AboutDialog::AboutDialog(), and PythonPlugin::getActions().


The documentation for this class was generated from the following files: