QtiPlot  0.9.8.2
Public Slots | Public Member Functions | Private Member Functions | Private Attributes | List of all members
PythonScript Class Reference

#include <PythonScript.h>

Inheritance diagram for PythonScript:
Script

Public Slots

bool compile (bool for_eval=true)
 
QVariant eval ()
 
bool exec ()
 
void setContext (QObject *context)
 
bool setDouble (double val, const char *name)
 
bool setInt (int val, const char *name)
 
bool setQObject (QObject *val, const char *name)
 
- Public Slots inherited from Script
virtual bool compile (bool for_eval=true)
 Compile the Code. Return true if the implementation doesn't support compilation. More...
 
virtual QVariant eval ()
 Evaluate the Code, returning QVariant() on an error / exception. More...
 
virtual bool exec ()
 Execute the Code, returning false on an error / exception. More...
 
virtual bool setDouble (double, const char *)
 
virtual bool setInt (int, const char *)
 
virtual bool setQObject (const QObject *, const char *)
 

Public Member Functions

 PythonScript (PythonScripting *env, const QString &code, QObject *context=0, const QString &name="<input>")
 
void write (const QString &text)
 
 ~PythonScript ()
 
- Public Member Functions inherited from Script
virtual void addCode (const QString &code)
 Append to the code that will be executed when calling exec() or eval() More...
 
const QString code () const
 Return the code that will be executed when calling exec() or eval() More...
 
QObject * context () const
 Return the context in which the code is to be executed. More...
 
bool emitErrors () const
 Return whether errors / exceptions are to be emitted or silently ignored. More...
 
const QString name () const
 Like QObject::name, but with unicode support. More...
 
 Script (ScriptingEnv *env, const QString &code, QObject *context=0, const QString &name="<input>")
 
ScriptingEnvscriptingEnv ()
 
virtual void setCode (const QString &code)
 Set the code that will be executed when calling exec() or eval() More...
 
virtual void setContext (QObject *context)
 Set the context in which the code is to be executed. More...
 
void setEmitErrors (bool yes)
 Set whether errors / exceptions are to be emitted or silently ignored. More...
 
void setName (const QString &name)
 Like QObject::setName, but with unicode support. More...
 
 ~Script ()
 

Private Member Functions

void beginStdoutRedirect ()
 
void endStdoutRedirect ()
 
PythonScriptingenv ()
 

Private Attributes

bool hasOldGlobals
 
bool isFunction
 
PyObjectmodGlobalDict
 
PyObjectmodLocalDict
 
PyObjectPyCode
 
PyObjectstderrSave
 
PyObjectstdoutSave
 

Additional Inherited Members

- Signals inherited from Script
void codeChanged ()
 This is emitted whenever the code to be executed by exec() and eval() is changed. More...
 
void error (const QString &message, const QString &scriptName, int lineNumber)
 signal an error condition / exception More...
 
void print (const QString &output)
 output generated by the code More...
 
- Protected Types inherited from Script
enum  compileStatus { notCompiled, isCompiled, compileErr }
 
- Protected Member Functions inherited from Script
void emit_error (const QString &message, int lineNumber)
 
- Protected Attributes inherited from Script
QString Code
 
enum Script::compileStatus compiled
 
QObject * Context
 
bool EmitErrors
 
ScriptingEnvEnv
 
QString Name
 

Constructor & Destructor Documentation

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

References modGlobalDict, modLocalDict, 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)
slot
void PythonScript::endStdoutRedirect ( )
private

References env(), stderrSave, and stdoutSave.

Referenced by eval(), and exec().

PythonScripting* PythonScript::env ( )
inlineprivate
QVariant PythonScript::eval ( )
slot
bool PythonScript::exec ( )
slot
void PythonScript::setContext ( QObject *  context)
slot
bool PythonScript::setDouble ( double  val,
const char *  name 
)
slot
bool PythonScript::setInt ( int  val,
const char *  name 
)
slot
bool PythonScript::setQObject ( QObject *  val,
const char *  name 
)
slot
void PythonScript::write ( const QString &  text)
inline

References Script::print().

Member Data Documentation

bool PythonScript::hasOldGlobals
private

Referenced by compile(), eval(), and exec().

bool PythonScript::isFunction
private

Referenced by eval(), and exec().

PyObject * PythonScript::modGlobalDict
private
PyObject * PythonScript::modLocalDict
private
PyObject* PythonScript::PyCode
private
PyObject * PythonScript::stderrSave
private
PyObject * PythonScript::stdoutSave
private

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