Public Slots | Public Member Functions | Private Member Functions | Private Attributes

PythonScript Class Reference

#include <PythonScript.h>

Inheritance diagram for PythonScript:
Script

List of all members.

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 ()
PythonScriptingenv ()

Private Attributes

bool isFunction
PyObjectlocalDict
PyObjectPyCode
PyObjectstderrSave
PyObjectstdoutSave

Constructor & Destructor Documentation

PythonScript::PythonScript ( PythonScripting env,
const QString &  code,
QObject *  context = 0,
const QString &  name = "<input>" 
)
PythonScript::~PythonScript (  ) 

References localDict, and PyCode.


Member Function Documentation

void PythonScript::beginStdoutRedirect (  )  [private]

References env(), PythonScripting::setQObject(), stderrSave, and stdoutSave.

Referenced by eval(), and exec().

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::Context, Script::emit_error(), env(), localDict, Script::Name, and PyCode.

Referenced by eval(), and exec().

void PythonScript::endStdoutRedirect (  )  [private]

References env(), stderrSave, and stdoutSave.

Referenced by eval(), and exec().

PythonScripting* PythonScript::env (  )  [inline, private]
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(), Script::isCompiled, isFunction, localDict, 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(), Script::isCompiled, isFunction, localDict, 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(), localDict, and PythonScripting::setDouble().

bool PythonScript::setInt ( int  val,
const char *  name 
) [virtual, slot]

Reimplemented from Script.

References Script::compiled, env(), localDict, and PythonScripting::setInt().

bool PythonScript::setQObject ( QObject *  val,
const char *  name 
) [slot]
void PythonScript::write ( const QString &  text  )  [inline]

References Script::print().


Member Data Documentation

bool PythonScript::isFunction [private]

Referenced by eval(), and exec().


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