46 @type QWidget |
46 @type QWidget |
47 """ |
47 """ |
48 super(E5ProcessDialog, self).__init__(parent) |
48 super(E5ProcessDialog, self).__init__(parent) |
49 self.setupUi(self) |
49 self.setupUi(self) |
50 |
50 |
51 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
51 self.buttonBox.button( |
52 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
52 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
53 self.buttonBox.button( |
|
54 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
53 |
55 |
54 font = Preferences.getEditorOtherFonts("MonospacedFont") |
56 font = Preferences.getEditorOtherFonts("MonospacedFont") |
55 self.resultbox.setFontFamily(font.family()) |
57 self.resultbox.setFontFamily(font.family()) |
56 self.resultbox.setFontPointSize(font.pointSize()) |
58 self.resultbox.setFontPointSize(font.pointSize()) |
57 self.errors.setFontFamily(font.family()) |
59 self.errors.setFontFamily(font.family()) |
75 Private slot called when the process finished or the user pressed |
77 Private slot called when the process finished or the user pressed |
76 the button. |
78 the button. |
77 """ |
79 """ |
78 if ( |
80 if ( |
79 self.__process is not None and |
81 self.__process is not None and |
80 self.__process.state() != QProcess.NotRunning |
82 self.__process.state() != QProcess.ProcessState.NotRunning |
81 ): |
83 ): |
82 self.__process.terminate() |
84 self.__process.terminate() |
83 QTimer.singleShot(2000, self.__process.kill) |
85 QTimer.singleShot(2000, self.__process.kill) |
84 self.__process.waitForFinished(3000) |
86 self.__process.waitForFinished(3000) |
85 |
87 |
86 self.inputGroup.setEnabled(False) |
88 self.inputGroup.setEnabled(False) |
87 self.inputGroup.hide() |
89 self.inputGroup.hide() |
88 |
90 |
89 self.__process = None |
91 self.__process = None |
90 |
92 |
91 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
93 self.buttonBox.button( |
92 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
94 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
93 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
95 self.buttonBox.button( |
94 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
96 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
95 Qt.OtherFocusReason) |
97 self.buttonBox.button( |
|
98 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
99 self.buttonBox.button( |
|
100 QDialogButtonBox.StandardButton.Close).setFocus( |
|
101 Qt.FocusReason.OtherFocusReason) |
96 |
102 |
97 def on_buttonBox_clicked(self, button): |
103 def on_buttonBox_clicked(self, button): |
98 """ |
104 """ |
99 Private slot called by a button of the button box clicked. |
105 Private slot called by a button of the button box clicked. |
100 |
106 |
101 @param button button that was clicked |
107 @param button button that was clicked |
102 @type QAbstractButton |
108 @type QAbstractButton |
103 """ |
109 """ |
104 if button == self.buttonBox.button(QDialogButtonBox.Close): |
110 if button == self.buttonBox.button( |
|
111 QDialogButtonBox.StandardButton.Close |
|
112 ): |
105 self.close() |
113 self.close() |
106 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
114 elif button == self.buttonBox.button( |
|
115 QDialogButtonBox.StandardButton.Cancel |
|
116 ): |
107 self.statusLabel.setText(self.tr("Process canceled.")) |
117 self.statusLabel.setText(self.tr("Process canceled.")) |
108 self.__finish() |
118 self.__finish() |
109 |
119 |
110 def __procFinished(self, exitCode, exitStatus): |
120 def __procFinished(self, exitCode, exitStatus): |
111 """ |
121 """ |
114 @param exitCode exit code of the process |
124 @param exitCode exit code of the process |
115 @type int |
125 @type int |
116 @param exitStatus exit status of the process |
126 @param exitStatus exit status of the process |
117 @type QProcess.ExitStatus |
127 @type QProcess.ExitStatus |
118 """ |
128 """ |
119 self.__normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) |
129 self.__normal = ( |
|
130 (exitStatus == QProcess.ExitStatus.NormalExit) and |
|
131 (exitCode == 0) |
|
132 ) |
120 if self.__normal: |
133 if self.__normal: |
121 self.statusLabel.setText(self.tr("Process finished successfully.")) |
134 self.statusLabel.setText(self.tr("Process finished successfully.")) |
122 elif exitStatus == QProcess.CrashExit: |
135 elif exitStatus == QProcess.ExitStatus.CrashExit: |
123 self.statusLabel.setText(self.tr("Process crashed.")) |
136 self.statusLabel.setText(self.tr("Process crashed.")) |
124 else: |
137 else: |
125 self.statusLabel.setText( |
138 self.statusLabel.setText( |
126 self.tr("Process finished with exit code {0}") |
139 self.tr("Process finished with exit code {0}") |
127 .format(exitCode)) |
140 .format(exitCode)) |