From be58c264cf042108f0073ce83c01797c72465b9a Mon Sep 17 00:00:00 2001 From: wonder Date: Fri, 23 May 2008 15:35:29 +0000 Subject: [PATCH] Fixed uninstalling redirection from python console git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8498 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/app/qgspythondialog.cpp | 10 +++++++++- src/app/qgspythondialog.h | 5 +++++ src/app/qgspythonutils.cpp | 4 ---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/qgspythondialog.cpp b/src/app/qgspythondialog.cpp index 8e4f9a76fda..e2a2be8ba0b 100644 --- a/src/app/qgspythondialog.cpp +++ b/src/app/qgspythondialog.cpp @@ -17,6 +17,8 @@ #include "qgspythondialog.h" #include "qgspythonutils.h" +#include + QgsPythonDialog::QgsPythonDialog(QgisInterface* pIface, QWidget *parent) : QDialog(parent) { @@ -28,7 +30,6 @@ QgsPythonDialog::QgsPythonDialog(QgisInterface* pIface, QWidget *parent) QgsPythonDialog::~QgsPythonDialog() { - QgsPythonUtils::uninstallConsoleHooks(); } QString QgsPythonDialog::escapeHtml(QString text) @@ -72,3 +73,10 @@ void QgsPythonDialog::on_edtCmdLine_returnPressed() txtHistory->moveCursor(QTextCursor::End); txtHistory->ensureCursorVisible(); } + +void QgsPythonDialog::closeEvent(QCloseEvent* event) +{ + QgsPythonUtils::uninstallConsoleHooks(); + + QDialog::closeEvent(event); +} diff --git a/src/app/qgspythondialog.h b/src/app/qgspythondialog.h index 546d28a0e12..5dd12206f0f 100644 --- a/src/app/qgspythondialog.h +++ b/src/app/qgspythondialog.h @@ -20,6 +20,7 @@ #include "ui_qgspythondialog.h" class QgisInterface; +class QCloseEvent; class QgsPythonDialog : public QDialog, private Ui::QgsPythonDialog { @@ -36,6 +37,10 @@ class QgsPythonDialog : public QDialog, private Ui::QgsPythonDialog void on_edtCmdLine_returnPressed(); + protected: + + void closeEvent(QCloseEvent* event); + private: QgisInterface* mIface; diff --git a/src/app/qgspythonutils.cpp b/src/app/qgspythonutils.cpp index d1307819d34..f803f10c8ff 100644 --- a/src/app/qgspythonutils.cpp +++ b/src/app/qgspythonutils.cpp @@ -150,10 +150,6 @@ void QgsPythonUtils::uninstallConsoleHooks() { runString("sys.displayhook = sys.__displayhook__"); runString("sys.stdout = _old_stdout"); - - // TODO: uninstalling stdout redirection doesn't work - - //installErrorHook(); }