scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

PythonScript.h
Go to the documentation of this file.
1 
11 
29 #ifndef PYTHON_SCRIPT_H
30 #define PYTHON_SCRIPT_H
31 
32 #include "Script.h"
33 
34 class QString;
35 class QObject;
36 
37 typedef struct _object PyObject;
38 class PythonScripting;
39 class ScriptingEnv;
40 
41 class PythonScript : public Script
42 {
43  Q_OBJECT
44 
45 public:
46  PythonScript(PythonScripting *env, const QString &code, QObject *context=0, const QString &name="<input>");
47  ~PythonScript();
48 
49  void write(const QString &text) { emit print(text); }
50 
51 public slots:
52  bool compile(bool for_eval=true) override;
53  QVariant eval() override;
54  bool exec() override;
55  bool setQObject(QObject *val, const char *name) override;
56  bool setInt(int val, const char* name) override;
57  bool setDouble(double val, const char* name) override;
58  void setContext(QObject *context) override;
59 
60 private:
62  void beginStdoutRedirect();
63  void endStdoutRedirect();
64 
67 };
68 
69 
70 #endif
PythonScript::stderrSave
PyObject * stderrSave
Definition: PythonScript.h:65
PythonScript::eval
QVariant eval() override
Definition: PythonScript.cpp:203
PythonScript::stdoutSave
PyObject * stdoutSave
Definition: PythonScript.h:65
PythonScript::compile
bool compile(bool for_eval=true) override
Definition: PythonScript.cpp:108
Script::code
const QString code() const
Return the code that will be executed when calling exec() or eval()
Definition: Script.h:63
PythonScript
Definition: PythonScript.h:42
PythonScript::env
PythonScripting * env()
Definition: PythonScript.h:61
PythonScript::PythonScript
PythonScript(PythonScripting *env, const QString &code, QObject *context=0, const QString &name="<input>")
Definition: PythonScript.cpp:58
PythonScript::endStdoutRedirect
void endStdoutRedirect()
Definition: PythonScript.cpp:328
PythonScript::beginStdoutRedirect
void beginStdoutRedirect()
Definition: PythonScript.cpp:315
Script.h
PythonScript::modGlobalDict
PyObject * modGlobalDict
Definition: PythonScript.h:65
Script::Env
ScriptingEnv * Env
Definition: Script.h:106
PythonScript::isFunction
bool isFunction
Definition: PythonScript.h:66
ScriptingEnv
An interpreter for evaluating scripting code. Abstract.
Definition: ScriptingEnv.h:53
PythonScript::exec
bool exec() override
Definition: PythonScript.cpp:282
PythonScript::modLocalDict
PyObject * modLocalDict
Definition: PythonScript.h:65
Script
A chunk of scripting code. Abstract.
Definition: Script.h:53
PythonScript::write
void write(const QString &text)
Definition: PythonScript.h:49
Script::context
const QObject * context() const
Return the context in which the code is to be executed.
Definition: Script.h:65
PythonScript::~PythonScript
~PythonScript()
Definition: PythonScript.cpp:95
PythonScript::setContext
void setContext(QObject *context) override
Definition: PythonScript.cpp:102
PythonScript::setQObject
bool setQObject(QObject *val, const char *name) override
Definition: PythonScript.cpp:339
PythonScript::setInt
bool setInt(int val, const char *name) override
Definition: PythonScript.cpp:346
PythonScript::setDouble
bool setDouble(double val, const char *name) override
Definition: PythonScript.cpp:353
PythonScript::PyCode
PyObject * PyCode
Definition: PythonScript.h:65
Script::print
void print(const QString &output)
output generated by the code
Script::name
const QString name() const
Like QObject::name, but with unicode support.
Definition: Script.h:67
PythonScripting
Definition: PythonScripting.h:41
PyObject
struct _object PyObject
Definition: PythonScript.h:37
PythonScript::hasOldGlobals
bool hasOldGlobals
Definition: PythonScript.h:66