-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
PR: Show internal errors in a QMessageBox #4040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
a67aef0
c40b0f9
98dfe7a
f93a99f
a4bba99
8762aaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,9 @@ | |
# Third party imports | ||
from qtpy import PYQT5 | ||
from qtpy.compat import getopenfilename | ||
from qtpy.QtCore import Signal, Slot | ||
from qtpy.QtWidgets import QInputDialog, QLineEdit, QMenu, QVBoxLayout | ||
from qtpy.QtCore import Signal, Slot, Qt | ||
from qtpy.QtWidgets import (QInputDialog, QLineEdit, QMenu, QVBoxLayout, | ||
QMessageBox) | ||
|
||
# Local imports | ||
from spyder.config.base import _, debug_print | ||
|
@@ -91,7 +92,11 @@ def __init__(self, parent=None, namespace=None, commands=[], message=None, | |
|
||
# Accepting drops | ||
self.setAcceptDrops(True) | ||
|
||
|
||
# Traceback MessageBox | ||
self.msgbox_traceback= None | ||
self.error_traceback = "" | ||
|
||
#------ Private API -------------------------------------------------------- | ||
def set_historylog(self, historylog): | ||
"""Bind historylog instance to this console | ||
|
@@ -197,13 +202,44 @@ def register_plugin(self): | |
# Connecting the following signal once the dockwidget has been created: | ||
self.shell.traceback_available.connect(self.traceback_available) | ||
|
||
def traceback_available(self): | ||
def traceback_available(self, text): | ||
"""Traceback is available in the internal console: showing the | ||
internal console automatically to warn the user""" | ||
if CONF.get('main', 'show_internal_console_if_traceback', False): | ||
self.dockwidget.show() | ||
self.dockwidget.raise_() | ||
|
||
else: | ||
if self.msgbox_traceback is None: | ||
self.msgbox_traceback = QMessageBox( | ||
QMessageBox.Critical, | ||
_('Error'), | ||
_("<b>Spyder-IDE has encountered a problem.</b>" | ||
"Sorry for the inconvenience." | ||
"<b>Please tell us about this problem.</b>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove this line. |
||
"<br><br>" | ||
"You can submit this error to the github issue tracker"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's change this to
|
||
QMessageBox.Ok, | ||
parent=self) | ||
|
||
self.submit_btn = self.msgbox_traceback.addButton( | ||
_('Submit to github'), QMessageBox.YesRole) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
self.submit_btn.pressed.connect(self.press_submit_btn) | ||
|
||
self.msgbox_traceback.setWindowModality(Qt.NonModal) | ||
self.error_traceback = "" | ||
self.msgbox_traceback.show() | ||
self.msgbox_traceback.finished.connect(self.close_msg) | ||
|
||
self.error_traceback += text | ||
self.msgbox_traceback.setDetailedText(self.error_traceback) | ||
|
||
def close_msg(self): | ||
self.msgbox_traceback = None | ||
|
||
def press_submit_btn(self): | ||
self.main.report_issue(self.error_traceback) | ||
self.msgbox_traceback = None | ||
|
||
#------ Public API --------------------------------------------------------- | ||
@Slot() | ||
def quit(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the
-IDE
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add a
<br>
at the end.