Mantid
|
#include <MantidDialog.h>
Signals | |
void | runAsPythonScript (const QString &code, bool) |
Public Member Functions | |
MantidDialog (QWidget *parent=nullptr, const Qt::WindowFlags &flags=Qt::WindowCloseButtonHint|Qt::WindowType::WindowTitleHint) | |
DefaultConstructor. More... | |
~MantidDialog () override | |
Destructor. More... | |
Static Public Member Functions | |
static bool | handle (QObject *receiver, const std::exception &e) |
Handles the exception caught in an event handler. More... | |
Protected Member Functions | |
virtual void | handleException (const std::exception &e) |
Override this method to handle an exception in a derived class. More... | |
QString | runPythonCode (const QString &code, bool no_output=false) |
Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string. More... | |
Private Attributes | |
PythonRunner | m_pyRunner |
This object implements the runPythonCode() function, by emitting the code as a runAsPythonScript signal. More... | |
Dialog derived from this class can capture and handle exceptions raised in its event handlers. To be able to do this override QAplication::notify
method:
bool MyApplication::notify( QObject * receiver, QEvent * event ) { bool res = false; try { res = QApplication::notify(receiver,event); } catch(std::exception& e) { if (MantidQt::API::MantidDialog::handle(receiver,e)) return true; // stops event propagation else
do somethig else ... }
return res; }
@author Roman Tolchenov, Tessella plc @date 24/04/2009
Definition at line 54 of file MantidDialog.h.
MantidDialog::MantidDialog | ( | QWidget * | parent = nullptr , |
const Qt::WindowFlags & | flags = Qt::WindowCloseButtonHint | Qt::WindowType::WindowTitleHint |
||
) |
DefaultConstructor.
Default Constructor.
Definition at line 22 of file MantidDialog.cpp.
References m_pyRunner, and runAsPythonScript().
|
overridedefault |
Destructor.
|
static |
Handles the exception caught in an event handler.
Checks if receiver derives from MantidDialog.
If it does calls the virtual handleException method.
receiver | :: The Qt event receiver |
e | :: The exception |
Definition at line 41 of file MantidDialog.cpp.
References obj.
|
protectedvirtual |
Override this method to handle an exception in a derived class.
e | :: exception to handle |
Definition at line 56 of file MantidDialog.cpp.
|
signal |
Referenced by MantidDialog().
|
protected |
Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string.
Run a piece of python code and return any output that it writes to stdout.
code | :: the Python commands to execute |
no_output | :: if set to true this method returns an empty string, if false it returns the output from any Python print statements |
Definition at line 68 of file MantidDialog.cpp.
References m_pyRunner, and MantidQt::API::PythonRunner::runPythonCode().
Referenced by MantidQt::MantidWidgets::SaveWorkspaces::saveSel().
|
private |
This object implements the runPythonCode() function, by emitting the code as a runAsPythonScript signal.
Definition at line 82 of file MantidDialog.h.
Referenced by MantidDialog(), and runPythonCode().