16 class ErrorDialog(QDialog, Ui_ErrorDialog): |
16 class ErrorDialog(QDialog, Ui_ErrorDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to show an error message and optionally a |
18 Class implementing a dialog to show an error message and optionally a |
19 traceback. |
19 traceback. |
20 """ |
20 """ |
|
21 |
21 def __init__(self, title, errorMessage, traceback=None, parent=None): |
22 def __init__(self, title, errorMessage, traceback=None, parent=None): |
22 """ |
23 """ |
23 Constructor |
24 Constructor |
24 |
25 |
25 @param title title of the dialog |
26 @param title title of the dialog |
26 @type str |
27 @type str |
27 @param errorMessage error message to be shown |
28 @param errorMessage error message to be shown |
28 @type str |
29 @type str |
29 @param traceback list of traceback entries |
30 @param traceback list of traceback entries |
31 @param parent reference to the parent widget |
32 @param parent reference to the parent widget |
32 @type QWidget |
33 @type QWidget |
33 """ |
34 """ |
34 super().__init__(parent) |
35 super().__init__(parent) |
35 self.setupUi(self) |
36 self.setupUi(self) |
36 |
37 |
37 self.tracebackEdit.hide() |
38 self.tracebackEdit.hide() |
38 |
39 |
39 self.setWindowTitle(title) |
40 self.setWindowTitle(title) |
40 self.errorMessageLabel.setText(errorMessage) |
41 self.errorMessageLabel.setText(errorMessage) |
41 if traceback: |
42 if traceback: |
42 tbIntro = self.tr("Traceback (most recent call first):\n\n") |
43 tbIntro = self.tr("Traceback (most recent call first):\n\n") |
43 self.tracebackEdit.setPlainText( |
44 self.tracebackEdit.setPlainText(tbIntro + "\n".join(reversed(traceback))) |
44 tbIntro + "\n".join(reversed(traceback))) |
|
45 else: |
45 else: |
46 self.tracebackEdit.setEnabled(False) |
46 self.tracebackEdit.setEnabled(False) |