|
SciDAVis
1.D4
|
#include <PythonScripting.h>
Public Member Functions | |
| QString | errorMsg () |
| PyObject * | eval (const QString &code, PyObject *argDict=NULL, const char *name="<scidavis>") |
| evaluate a Python expression | |
| bool | exec (const QString &code, PyObject *argDict=NULL, const char *name="<scidavis>") |
| execute a sequence of Python statements | |
| const QStringList | fileExtensions () const |
| Return a list of file extensions commonly used for this language. | |
| PyObject * | globalDict () |
| bool | initialize () |
| Part of the initialization is deferred from the constructor until after the signals have been connected. | |
| bool | isRunning () const |
| whether asynchronuous execution is enabled (if supported by the implementation) | |
| const QString | mathFunctionDoc (const QString &name) const |
| Return a documentation string for the given mathematical function. | |
| const QStringList | mathFunctions () const |
| Return a list of supported mathematical functions. These should be imported into the global namespace. | |
| Script * | newScript (const QString &code, QObject *context, const QString &name="<input>") |
| Instantiate the Script subclass matching the ScriptEnv subclass. | |
| PythonScripting (ApplicationWindow *parent) | |
| bool | setDouble (double, const char *, PyObject *dict=NULL) |
| bool | setInt (int, const char *, PyObject *dict=NULL) |
| bool | setQObject (QObject *, const char *, PyObject *dict) |
| bool | setQObject (QObject *val, const char *name) |
| PyObject * | sysDict () |
| QString | toString (PyObject *object, bool decref=false) |
| like str(object) in Python | |
| void | write (const QString &text) |
| ~PythonScripting () | |
Public Member Functions inherited from ScriptingEnv | |
| const QString | fileFilter () const |
| Construct a filter expression from fileExtension(), suitable for QFileDialog. | |
| bool | initialized () const |
| initialization of the interpreter may fail; or there could be other errors setting up the environment | |
| ScriptingEnv (ApplicationWindow *parent, const char *langName) | |
| virtual QString | stackTraceString () |
| If an exception / error occured, return a nicely formated stack backtrace. | |
Static Public Member Functions | |
| static ScriptingEnv * | constructor (ApplicationWindow *parent) |
Static Public Attributes | |
| static const char * | langName = "Python" |
Private Member Functions | |
| bool | loadInitFile (const QString &path) |
Private Attributes | |
| PyObject * | globals |
| PyObject * | math |
| PyObject * | sys |
Additional Inherited Members | |
Public Slots inherited from ScriptingEnv | |
| virtual void | clear () |
| Clear the global environment. What exactly happens depends on the implementation. | |
| void | decref () |
| Decrease the reference count. This should only be called by scripted and Script to avoid segfaults. | |
| void | incref () |
| Increase the reference count. This should only be called by scripted and Script to avoid memory leaks. | |
| virtual bool | setDouble (double, const char *) |
| virtual bool | setInt (int, const char *) |
| virtual void | startExecution () |
| If the implementation supports asynchronuos execution, activate it. | |
| virtual void | stopExecution () |
| If the implementation supports asynchronuos execution, deactivate it. | |
Signals inherited from ScriptingEnv | |
| void | error (const QString &message, const QString &scriptName, int lineNumber) |
| signal an error condition / exception | |
| void | print (const QString &output) |
| output that is not handled by a Script | |
Protected Attributes inherited from ScriptingEnv | |
| bool | d_initialized |
| whether the interpreter has been successfully initialized | |
| ApplicationWindow * | d_parent |
| the context in which we are running | |
| PythonScripting::PythonScripting | ( | ApplicationWindow * | parent | ) |
References ScriptingEnv::d_initialized, ScriptingEnv::d_parent, globals, initscidavis(), math, setQObject(), and sys.
Referenced by constructor().
|
inlinestatic |
References PythonScripting().
| QString PythonScripting::errorMsg | ( | ) |
References _traceback::tb_frame, _traceback::tb_lineno, _traceback::tb_next, and toString().
| PyObject * PythonScripting::eval | ( | const QString & | code, |
| PyObject * | argDict = NULL, |
||
| const char * | name = "<scidavis>" |
||
| ) |
evaluate a Python expression
Evaluates code, using argDict (borrowed reference) as local dictionary or an empty one if argDict==NULL. name is the filename Python uses when reporting errors. Returns a new reference; NULL means caller has to do exception handling.
References globals.
| bool PythonScripting::exec | ( | const QString & | code, |
| PyObject * | argDict = NULL, |
||
| const char * | name = "<scidavis>" |
||
| ) |
execute a sequence of Python statements
Executes code, using argDict (borrowed reference) as local dictionary or an empty one if argDict==NULL. name is the filename Python uses when reporting errors. A false return value means caller has to do exception handling.
References globals.
|
virtual |
Return a list of file extensions commonly used for this language.
Reimplemented from ScriptingEnv.
|
virtual |
Part of the initialization is deferred from the constructor until after the signals have been connected.
Reimplemented from ScriptingEnv.
References ScriptingEnv::d_initialized, ScriptingEnv::initialized(), loadInitFile(), setQObject(), and sys.
|
virtual |
whether asynchronuous execution is enabled (if supported by the implementation)
Reimplemented from ScriptingEnv.
|
private |
References PYTHON_UTIL_PATH.
Referenced by initialize().
|
virtual |
Return a documentation string for the given mathematical function.
Reimplemented from ScriptingEnv.
References math.
|
virtual |
Return a list of supported mathematical functions. These should be imported into the global namespace.
Reimplemented from ScriptingEnv.
References math.
|
inlinevirtual |
Instantiate the Script subclass matching the ScriptEnv subclass.
Reimplemented from ScriptingEnv.
| bool PythonScripting::setDouble | ( | double | val, |
| const char * | name, | ||
| PyObject * | dict = NULL |
||
| ) |
References globals.
Referenced by PythonScript::setDouble().
| bool PythonScripting::setInt | ( | int | val, |
| const char * | name, | ||
| PyObject * | dict = NULL |
||
| ) |
References globals.
Referenced by PythonScript::setInt().
| bool PythonScripting::setQObject | ( | QObject * | val, |
| const char * | name, | ||
| PyObject * | dict | ||
| ) |
References globals.
Referenced by PythonScript::beginStdoutRedirect(), initialize(), PythonScripting(), and PythonScript::setQObject().
|
inlinevirtual |
| QString PythonScripting::toString | ( | PyObject * | object, |
| bool | decref = false |
||
| ) |
like str(object) in Python
Convert object to a string. Steals a reference to object if decref is true; borrows otherwise.
Referenced by errorMsg().
|
inline |
References ScriptingEnv::print().
|
private |
Referenced by eval(), exec(), globalDict(), PythonScripting(), setDouble(), setInt(), setQObject(), and ~PythonScripting().
|
static |
|
private |
Referenced by mathFunctionDoc(), mathFunctions(), PythonScripting(), and ~PythonScripting().
|
private |
Referenced by initialize(), PythonScripting(), sysDict(), and ~PythonScripting().
1.8.1