Avogadro
1.1.0
|
00001 /********************************************************************** 00002 PythonError - Handle python errors 00003 00004 Copyright (C) 2008,2009 by Tim Vandermeersch 00005 00006 This file is part of the Avogadro molecular editor project. 00007 For more information, see <http://avogadro.openmolecules.net/> 00008 00009 Avogadro is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 Avogadro is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00022 02110-1301, USA. 00023 ***********************************************************************/ 00024 00025 #ifndef PYTHONERROR_H 00026 #define PYTHONERROR_H 00027 00028 #include <avogadro/global.h> 00029 00030 #include <QObject> 00031 #include <QString> 00032 00033 namespace Avogadro { 00034 00059 class A_EXPORT PythonError : public QObject 00060 { 00061 Q_OBJECT 00062 00063 Q_SIGNALS: 00068 void message(const QString&); 00069 00070 public: 00074 static PythonError* instance(); 00083 void append(const QString &str); 00088 QString& string(); 00092 void setListening(bool listening); 00093 private: 00094 PythonError(); 00095 QString m_str; 00096 bool m_listening; 00097 }; 00098 00112 A_EXPORT bool initializePython(const QString &addToSearchPath = QString()); 00113 00119 A_EXPORT void prepareToCatchError(); 00120 00125 A_EXPORT void catchError(); 00126 00127 } // namespace 00128 00129 #endif