QtiPlot
0.9.8.2
|
#include <PythonScript.h>
Public Slots | |
bool | compile (bool for_eval=true) |
Compile the Code. Return true if the implementation doesn't support compilation. | |
QVariant | eval () |
Evaluate the Code, returning QVariant() on an error / exception. | |
bool | exec () |
Execute the Code, returning false on an error / exception. | |
void | setContext (QObject *context) |
Set the context in which the code is to be executed. | |
bool | setDouble (double val, const char *name) |
bool | setInt (int val, const char *name) |
bool | setQObject (QObject *val, const char *name) |
Public Member Functions | |
PythonScript (PythonScripting *env, const QString &code, QObject *context=0, const QString &name="<input>") | |
void | write (const QString &text) |
~PythonScript () | |
Private Member Functions | |
void | beginStdoutRedirect () |
void | endStdoutRedirect () |
PythonScripting * | env () |
Private Attributes | |
bool | hasOldGlobals |
bool | isFunction |
PyObject * | modGlobalDict |
PyObject * | modLocalDict |
PyObject * | PyCode |
PyObject * | stderrSave |
PyObject * | stdoutSave |
PythonScript::PythonScript | ( | PythonScripting * | env, |
const QString & | code, | ||
QObject * | context = 0 , |
||
const QString & | name = "<input>" |
||
) |
References Script::Context, env(), modGlobalDict, modLocalDict, PyCode, and setQObject().
References modGlobalDict, modLocalDict, and PyCode.
void PythonScript::beginStdoutRedirect | ( | ) | [private] |
References env(), PythonScripting::setQObject(), stderrSave, and stdoutSave.
bool PythonScript::compile | ( | bool | for_eval = true | ) | [virtual, slot] |
Compile the Code. Return true if the implementation doesn't support compilation.
Reimplemented from Script.
References Script::Code, Script::compiled, Script::compileErr, Script::Context, Script::emit_error(), env(), hasOldGlobals, Script::isCompiled, modGlobalDict, modLocalDict, Script::Name, and PyCode.
void PythonScript::endStdoutRedirect | ( | ) | [private] |
References env(), stderrSave, and stdoutSave.
PythonScripting* PythonScript::env | ( | ) | [inline, private] |
References Script::Env.
Referenced by beginStdoutRedirect(), compile(), endStdoutRedirect(), eval(), exec(), PythonScript(), setDouble(), setInt(), and setQObject().
QVariant PythonScript::eval | ( | ) | [virtual, slot] |
Evaluate the Code, returning QVariant() on an error / exception.
Reimplemented from Script.
References beginStdoutRedirect(), compile(), Script::compiled, Script::emit_error(), endStdoutRedirect(), env(), PythonScripting::globalDict(), hasOldGlobals, Script::isCompiled, isFunction, modGlobalDict, modLocalDict, Script::notCompiled, and PyCode.
bool PythonScript::exec | ( | ) | [virtual, slot] |
Execute the Code, returning false on an error / exception.
Reimplemented from Script.
References beginStdoutRedirect(), compile(), Script::compiled, Script::emit_error(), endStdoutRedirect(), env(), PythonScripting::globalDict(), hasOldGlobals, Script::isCompiled, isFunction, modGlobalDict, modLocalDict, Script::notCompiled, and PyCode.
void PythonScript::setContext | ( | QObject * | context | ) | [virtual, slot] |
Set the context in which the code is to be executed.
Reimplemented from Script.
References Script::Context, and setQObject().
bool PythonScript::setDouble | ( | double | val, |
const char * | name | ||
) | [virtual, slot] |
Reimplemented from Script.
References Script::compiled, env(), modGlobalDict, modLocalDict, and Script::notCompiled.
bool PythonScript::setInt | ( | int | val, |
const char * | name | ||
) | [virtual, slot] |
Reimplemented from Script.
References Script::compiled, env(), modGlobalDict, modLocalDict, and Script::notCompiled.
bool PythonScript::setQObject | ( | QObject * | val, |
const char * | name | ||
) | [slot] |
References Script::compiled, env(), modGlobalDict, modLocalDict, and Script::notCompiled.
Referenced by PythonScript(), and setContext().
void PythonScript::write | ( | const QString & | text | ) | [inline] |
References Script::print().
bool PythonScript::hasOldGlobals [private] |
bool PythonScript::isFunction [private] |
PyObject * PythonScript::modGlobalDict [private] |
Referenced by compile(), eval(), exec(), PythonScript(), setDouble(), setInt(), setQObject(), and ~PythonScript().
PyObject * PythonScript::modLocalDict [private] |
Referenced by compile(), eval(), exec(), PythonScript(), setDouble(), setInt(), setQObject(), and ~PythonScript().
PyObject* PythonScript::PyCode [private] |
Referenced by compile(), eval(), exec(), PythonScript(), and ~PythonScript().
PyObject * PythonScript::stderrSave [private] |
Referenced by beginStdoutRedirect(), and endStdoutRedirect().
PyObject * PythonScript::stdoutSave [private] |
Referenced by beginStdoutRedirect(), and endStdoutRedirect().