RefactoringRope/ErrorDialog.py

Sat, 24 Apr 2021 11:19:08 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 24 Apr 2021 11:19:08 +0200
changeset 354
a967ff16629a
parent 347
b5048b5ff454
child 365
f740b50380df
permissions
-rw-r--r--

- implemented some code simplifications
- removed support for some outdated eric6 versions

251
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
346
877cac2e8d94 Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 326
diff changeset
3 # Copyright (c) 2018 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
251
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to show an error message and optionally a
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 traceback.
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtWidgets import QDialog
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .Ui_ErrorDialog import Ui_ErrorDialog
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 class ErrorDialog(QDialog, Ui_ErrorDialog):
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 """
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 Class implementing a dialog to show an error message and optionally a
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 traceback.
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 def __init__(self, title, errorMessage, traceback=None, parent=None):
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Constructor
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param title title of the dialog
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @type str
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param errorMessage error message to be shown
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @type str
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param traceback list of traceback entries
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type list of str
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param parent reference to the parent widget
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @type QWidget
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
354
a967ff16629a - implemented some code simplifications
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 347
diff changeset
34 super().__init__(parent)
251
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.setupUi(self)
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.tracebackEdit.hide()
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.setWindowTitle(title)
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.errorMessageLabel.setText(errorMessage)
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 if traceback:
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 tbIntro = self.tr("Traceback (most recent call first):\n\n")
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.tracebackEdit.setPlainText(
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 tbIntro + "\n".join(reversed(traceback)))
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 else:
4dcc73076100 Removed the Python3 only rope variant and introduced an extended error dialog showing a traceback for errors within the rope library.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.tracebackEdit.setEnabled(False)

eric ide

mercurial