Skip to content

Commit

Permalink
Show Python error stack trace when in blocking dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Oct 1, 2015
1 parent e263e9e commit 2819668
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/utils.py
Expand Up @@ -29,7 +29,7 @@
"""

from PyQt4.QtCore import QCoreApplication, QLocale
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QPushButton, QApplication
from qgis.core import QGis, QgsExpression, QgsMessageLog, qgsfunction, QgsMessageOutput
from qgis.gui import QgsMessageBar

Expand Down Expand Up @@ -74,7 +74,9 @@ def showException(type, value, tb, msg, messagebar=False):
title = QCoreApplication.translate('Python', 'Python error')
QgsMessageLog.logMessage(logmessage, title)

if messagebar and iface:
blockingdialog = QApplication.instance().activeModalWidget()

if messagebar and iface and not blockingdialog:
item = iface.messageBar().currentItem()
if item and item.property("Error") == msg:
# Return of we already have a message with the same error message
Expand Down

3 comments on commit 2819668

@slarosa
Copy link
Member

@slarosa slarosa commented on 2819668 Oct 4, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NathanW2 this is good change, but might to happen that the user misses the messagebar whether the mapcanvas is behind some dialog (e.g the DBManager window), especially with small screen.

How we can pop up the error stacktrace for some window like DBManager?

@NathanW2
Copy link
Member Author

@NathanW2 NathanW2 commented on 2819668 Oct 4, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slarosa
Copy link
Member

@slarosa slarosa commented on 2819668 Oct 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks.

Please sign in to comment.