Avogadro  1.1.0
Signals | Public Member Functions | Static Public Member Functions
Avogadro::PythonError Class Reference

Singleton object to store all python errors. More...

#include <pythonerror.h>

Inheritance diagram for Avogadro::PythonError:
Inheritance graph
[legend]

List of all members.

Signals

void message (const QString &)

Public Member Functions

void append (const QString &str)
QStringstring ()
void setListening (bool listening)

Static Public Member Functions

static PythonErrorinstance ()

Detailed Description

Singleton object to store all python errors.

To be able to display all python errors in the GUI later, it is needed to store python errors somewhere until the GUI objects are created. This class stores the appended errors and when the GUI is created, the preceding errors can be retrieved for display. The PythonError class has a message signal which is emitted if the object is in listening mode (see setListening()).

All calls to python functions (directly to the Python C API or through boost::python), should use the following form:

 try {
   prepareToCatchError();
   // Do python stuff here...
 } catch(error_already_set const &) {
   catchError(); 
   // additional error handling here... 
 }

Member Function Documentation

void Avogadro::PythonError::append ( const QString str)

This method has 2 behaviours depening on the listening mode.

1) When a class is listening, calling this method will emit the message signal.

2) When there is no class listening, calling this method will append str to the internal error log.

References message().

Get a pointer to the singleton instance.

void Avogadro::PythonError::message ( const QString ) [signal]

In listening mode, this signal is emitted when a new python error is caught by catchError().

Referenced by append().

void Avogadro::PythonError::setListening ( bool  listening)

Set listening mode.

Get the internal error log containing all errors when listening was disabled.


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