61 @type list of str |
74 @type list of str |
62 @param wdList history list of working directories |
75 @param wdList history list of working directories |
63 @type list of str |
76 @type list of str |
64 @param envList history list of environment parameter settings |
77 @param envList history list of environment parameter settings |
65 @type list of str |
78 @type list of str |
66 @param exceptions exception reporting flag |
|
67 @type bool |
|
68 @param unhandledExceptions flag indicating to always report unhandled exceptions |
|
69 @type bool |
|
70 @param parent parent widget of this dialog |
79 @param parent parent widget of this dialog |
71 @type QWidget |
80 @type QWidget |
72 @param dialogType type of the start dialog |
81 @param dialogMode mode of the start dialog |
73 <ul> |
82 <ul> |
74 <li>0 = start debug dialog</li> |
83 <li>StartDialogMode.Debug = start debug dialog</li> |
75 <li>1 = start run dialog</li> |
84 <li>StartDialogMode.Run = start run dialog</li> |
76 <li>2 = start coverage dialog</li> |
85 <li>StartDialogMode.Coverage = start coverage dialog</li> |
77 <li>3 = start profile dialog</li> |
86 <li>StartDialogMode.Profile = start profile dialog</li> |
78 </ul> |
87 </ul> |
79 @type int (0 to 3) |
88 @type StartDialogMode |
80 @param modfuncList history list of module functions |
89 @param modfuncList history list of module functions |
81 @type list of str |
90 @type list of str |
|
91 @param autoClearShell flag indicating, that the interpreter window |
|
92 should be cleared automatically |
|
93 @type bool |
82 @param tracePython flag indicating if the Python library should |
94 @param tracePython flag indicating if the Python library should |
83 be traced as well |
95 be traced as well |
84 @type bool |
96 @type bool |
85 @param autoClearShell flag indicating, that the interpreter window |
|
86 should be cleared automatically |
|
87 @type bool |
|
88 @param autoContinue flag indicating, that the debugger should not |
97 @param autoContinue flag indicating, that the debugger should not |
89 stop at the first executable line |
98 stop at the first executable line |
|
99 @type bool |
|
100 @param reportAllExceptions flag indicating to report all exceptions |
90 @type bool |
101 @type bool |
91 @param enableMultiprocess flag indicating the support for multi process |
102 @param enableMultiprocess flag indicating the support for multi process |
92 debugging |
103 debugging |
93 @type bool |
104 @type bool |
94 @param multiprocessNoDebugHistory list of lists with programs not to be |
105 @param multiprocessNoDebugHistory list of lists with programs not to be |
104 @type str |
115 @type str |
105 @param scriptsList history list of script names |
116 @param scriptsList history list of script names |
106 @type list of str |
117 @type list of str |
107 """ |
118 """ |
108 super().__init__(parent) |
119 super().__init__(parent) |
|
120 self.setupUi(self) |
109 self.setModal(True) |
121 self.setModal(True) |
110 |
122 |
111 self.dialogType = dialogType |
123 self.__dialogMode = dialogMode |
112 if dialogType == 0: |
124 self.debugGroup.setVisible(self.__dialogMode == StartDialogMode.Debug) |
113 from .Ui_StartDebugDialog import ( # __IGNORE_WARNING_I101__ |
125 self.coverageGroup.setVisible(self.__dialogMode == StartDialogMode.Coverage) |
114 Ui_StartDebugDialog, |
126 self.profileGroup.setVisible(self.__dialogMode == StartDialogMode.Profile) |
115 ) |
127 # nothing special for 'Run' mode |
116 |
128 |
117 self.ui = Ui_StartDebugDialog() |
129 self.venvComboBox.addItem("") |
118 elif dialogType == 1: |
|
119 from .Ui_StartRunDialog import Ui_StartRunDialog # __IGNORE_WARNING_I101__ |
|
120 |
|
121 self.ui = Ui_StartRunDialog() |
|
122 elif dialogType == 2: |
|
123 from .Ui_StartCoverageDialog import ( # __IGNORE_WARNING_I101__ |
|
124 Ui_StartCoverageDialog, |
|
125 ) |
|
126 |
|
127 self.ui = Ui_StartCoverageDialog() |
|
128 elif dialogType == 3: |
|
129 from .Ui_StartProfileDialog import ( # __IGNORE_WARNING_I101__ |
|
130 Ui_StartProfileDialog, |
|
131 ) |
|
132 |
|
133 self.ui = Ui_StartProfileDialog() |
|
134 self.ui.setupUi(self) |
|
135 |
|
136 self.ui.venvComboBox.addItem("") |
|
137 projectEnvironmentString = ( |
130 projectEnvironmentString = ( |
138 ericApp().getObject("DebugServer").getProjectEnvironmentString() |
131 ericApp().getObject("DebugServer").getProjectEnvironmentString() |
139 ) |
132 ) |
140 if projectEnvironmentString: |
133 if projectEnvironmentString: |
141 self.ui.venvComboBox.addItem(projectEnvironmentString) |
134 self.venvComboBox.addItem(projectEnvironmentString) |
142 self.ui.venvComboBox.addItems( |
135 self.venvComboBox.addItems( |
143 sorted(ericApp().getObject("VirtualEnvManager").getVirtualenvNames()) |
136 sorted(ericApp().getObject("VirtualEnvManager").getVirtualenvNames()) |
144 ) |
137 ) |
145 |
138 |
146 self.ui.scriptnamePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
139 self.scriptnamePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
147 self.ui.scriptnamePicker.setDefaultDirectory( |
140 self.scriptnamePicker.setDefaultDirectory( |
148 Preferences.getMultiProject("Workspace") |
141 Preferences.getMultiProject("Workspace") |
149 ) |
142 ) |
150 self.ui.scriptnamePicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
143 self.scriptnamePicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
151 self.ui.scriptnamePicker.setSizeAdjustPolicy( |
144 self.scriptnamePicker.setSizeAdjustPolicy( |
152 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
145 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
153 ) |
146 ) |
154 self.ui.scriptnamePicker.setFilters( |
147 self.scriptnamePicker.setFilters( |
155 self.tr( |
148 self.tr( |
156 "Python Files (*.py *.py3);;" |
149 "Python Files (*.py *.py3);;" |
157 "Python GUI Files (*.pyw *.pyw3);;" |
150 "Python GUI Files (*.pyw *.pyw3);;" |
158 "All Files (*)" |
151 "All Files (*)" |
159 ) |
152 ) |
160 ) |
153 ) |
161 self.ui.scriptnamePicker.setEnabled(not forProject) |
154 self.scriptnamePicker.setEnabled(not forProject) |
162 |
155 |
163 self.ui.workdirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
156 self.workdirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
164 self.ui.workdirPicker.setDefaultDirectory( |
157 self.workdirPicker.setDefaultDirectory(Preferences.getMultiProject("Workspace")) |
165 Preferences.getMultiProject("Workspace") |
158 self.workdirPicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
166 ) |
159 self.workdirPicker.setSizeAdjustPolicy( |
167 self.ui.workdirPicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
|
168 self.ui.workdirPicker.setSizeAdjustPolicy( |
|
169 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
160 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
170 ) |
161 ) |
171 |
162 |
172 self.clearButton = self.ui.buttonBox.addButton( |
163 self.clearButton = self.buttonBox.addButton( |
173 self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole |
164 self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole |
174 ) |
165 ) |
175 self.editButton = self.ui.buttonBox.addButton( |
166 self.editButton = self.buttonBox.addButton( |
176 self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole |
167 self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole |
177 ) |
168 ) |
178 |
169 |
179 self.setWindowTitle(caption) |
170 self.setWindowTitle(caption) |
180 self.ui.cmdlineCombo.completer().setCaseSensitivity( |
171 self.cmdlineCombo.completer().setCaseSensitivity( |
181 Qt.CaseSensitivity.CaseSensitive |
172 Qt.CaseSensitivity.CaseSensitive |
182 ) |
173 ) |
183 self.ui.cmdlineCombo.clear() |
174 self.cmdlineCombo.lineEdit().setClearButtonEnabled(True) |
184 self.ui.cmdlineCombo.addItems(argvList) |
175 self.cmdlineCombo.clear() |
|
176 self.cmdlineCombo.addItems(argvList) |
185 if len(argvList) > 0: |
177 if len(argvList) > 0: |
186 self.ui.cmdlineCombo.setCurrentIndex(0) |
178 self.cmdlineCombo.setCurrentIndex(0) |
187 |
179 |
188 self.ui.workdirPicker.clear() |
180 self.workdirPicker.clear() |
189 self.ui.workdirPicker.addItems(wdList) |
181 self.workdirPicker.addItems(wdList) |
190 if len(wdList) > 0: |
182 if len(wdList) > 0: |
191 self.ui.workdirPicker.setCurrentIndex(0) |
183 self.workdirPicker.setCurrentIndex(0) |
192 |
184 |
193 self.ui.environmentCombo.completer().setCaseSensitivity( |
185 self.environmentCombo.completer().setCaseSensitivity( |
194 Qt.CaseSensitivity.CaseSensitive |
186 Qt.CaseSensitivity.CaseSensitive |
195 ) |
187 ) |
196 self.ui.environmentCombo.clear() |
188 self.environmentCombo.lineEdit().setClearButtonEnabled(True) |
197 self.ui.environmentCombo.addItems(envList) |
189 self.environmentCombo.clear() |
198 |
190 self.environmentCombo.addItems(envList) |
199 self.ui.exceptionCheckBox.setChecked(exceptions) |
191 |
200 self.ui.unhandledExceptionCheckBox.setChecked(unhandledExceptions) |
192 self.clearShellCheckBox.setChecked(autoClearShell) |
201 self.ui.clearShellCheckBox.setChecked(autoClearShell) |
193 self.consoleCheckBox.setEnabled( |
202 self.ui.consoleCheckBox.setEnabled( |
|
203 Preferences.getDebugger("ConsoleDbgCommand") != "" |
194 Preferences.getDebugger("ConsoleDbgCommand") != "" |
204 ) |
195 ) |
205 self.ui.consoleCheckBox.setChecked(False) |
196 self.consoleCheckBox.setChecked(False) |
206 |
197 |
207 venvIndex = max(0, self.ui.venvComboBox.findText(lastUsedVenvName)) |
198 venvIndex = max(0, self.venvComboBox.findText(lastUsedVenvName)) |
208 self.ui.venvComboBox.setCurrentIndex(venvIndex) |
199 self.venvComboBox.setCurrentIndex(venvIndex) |
209 self.ui.globalOverrideGroup.setChecked(configOverride["enable"]) |
200 self.globalOverrideGroup.setChecked(configOverride["enable"]) |
210 self.ui.redirectCheckBox.setChecked(configOverride["redirect"]) |
201 self.redirectCheckBox.setChecked(configOverride["redirect"]) |
211 |
202 |
212 self.ui.scriptnamePicker.addItems(scriptsList) |
203 self.scriptnamePicker.addItems(scriptsList) |
213 self.ui.scriptnamePicker.setText(scriptName) |
204 self.scriptnamePicker.setText(scriptName) |
214 |
205 |
215 if dialogType == 0: # start debug dialog |
206 if dialogMode == StartDialogMode.Debug: |
216 enableMultiprocessGlobal = Preferences.getDebugger("MultiProcessEnabled") |
207 enableMultiprocessGlobal = Preferences.getDebugger("MultiProcessEnabled") |
217 self.ui.tracePythonCheckBox.setChecked(tracePython) |
208 self.tracePythonCheckBox.setChecked(tracePython) |
218 self.ui.tracePythonCheckBox.show() |
209 self.tracePythonCheckBox.show() |
219 self.ui.autoContinueCheckBox.setChecked(autoContinue) |
210 self.autoContinueCheckBox.setChecked(autoContinue) |
220 self.ui.multiprocessGroup.setEnabled(enableMultiprocessGlobal) |
211 self.allExceptionsCheckBox.setChecked(reportAllExceptions) |
221 self.ui.multiprocessGroup.setChecked( |
212 self.multiprocessGroup.setEnabled(enableMultiprocessGlobal) |
|
213 self.multiprocessGroup.setChecked( |
222 enableMultiprocess & enableMultiprocessGlobal |
214 enableMultiprocess & enableMultiprocessGlobal |
223 ) |
215 ) |
224 self.ui.multiprocessNoDebugCombo.clear() |
216 self.multiprocessNoDebugCombo.clear() |
225 self.ui.multiprocessNoDebugCombo.setToolTip( |
217 self.multiprocessNoDebugCombo.setToolTip( |
226 self.tr( |
218 self.tr( |
227 "Enter the list of programs or program patterns not to be" |
219 "Enter the list of programs or program patterns not to be" |
228 " debugged separated by '{0}'." |
220 " debugged separated by '{0}'." |
229 ).format(os.pathsep) |
221 ).format(os.pathsep) |
230 ) |
222 ) |
|
223 self.multiprocessNoDebugCombo.lineEdit().setClearButtonEnabled(True) |
231 if multiprocessNoDebugHistory: |
224 if multiprocessNoDebugHistory: |
232 self.ui.multiprocessNoDebugCombo.completer().setCaseSensitivity( |
225 self.multiprocessNoDebugCombo.completer().setCaseSensitivity( |
233 Qt.CaseSensitivity.CaseSensitive |
226 Qt.CaseSensitivity.CaseSensitive |
234 ) |
227 ) |
235 self.ui.multiprocessNoDebugCombo.addItems(multiprocessNoDebugHistory) |
228 self.multiprocessNoDebugCombo.addItems(multiprocessNoDebugHistory) |
236 self.ui.multiprocessNoDebugCombo.setCurrentIndex(0) |
229 self.multiprocessNoDebugCombo.setCurrentIndex(0) |
237 |
230 |
238 if dialogType == 3: # start coverage or profile dialog |
231 if dialogMode == StartDialogMode.Coverage: |
239 self.ui.eraseCheckBox.setChecked(True) |
232 self.eraseCoverageCheckBox.setChecked(True) |
240 |
233 |
241 self.ui.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setFocus( |
234 if dialogMode == StartDialogMode.Profile: |
|
235 self.eraseProfileCheckBox.setChecked(True) |
|
236 |
|
237 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setFocus( |
242 Qt.FocusReason.OtherFocusReason |
238 Qt.FocusReason.OtherFocusReason |
243 ) |
239 ) |
244 |
240 |
245 self.__clearHistoryLists = False |
241 self.__clearHistoryLists = False |
246 self.__historiesModified = False |
242 self.__historiesModified = False |
250 |
246 |
251 def on_modFuncCombo_editTextChanged(self): |
247 def on_modFuncCombo_editTextChanged(self): |
252 """ |
248 """ |
253 Private slot to enable/disable the OK button. |
249 Private slot to enable/disable the OK button. |
254 """ |
250 """ |
255 self.ui.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setDisabled( |
251 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setDisabled( |
256 self.ui.modFuncCombo.currentText() == "" |
252 self.modFuncCombo.currentText() == "" |
257 ) |
253 ) |
258 |
254 |
259 def getData(self): |
255 def getData(self): |
260 """ |
256 """ |
261 Public method to retrieve the data entered into this dialog. |
257 Public method to retrieve the data entered into this dialog. |
262 |
258 |
263 @return a tuple of virtual environment, script name, argv, workdir, |
259 @return tuple containing the virtual environment, script name, argv, workdir, |
264 environment, exceptions flag, unhandled exceptions flag, clear interpreter |
260 environment, clear interpreter flag and run in console flag |
265 flag and run in console flag |
261 @rtype tuple of (str, str, str, str, str, bool, bool) |
266 @rtype tuple of (str, str, str, str, str, bool, bool, bool, bool) |
262 """ |
267 """ |
263 cmdLine = self.cmdlineCombo.currentText() |
268 cmdLine = self.ui.cmdlineCombo.currentText() |
264 workdir = self.workdirPicker.currentText(toNative=False) |
269 workdir = self.ui.workdirPicker.currentText(toNative=False) |
265 environment = self.environmentCombo.currentText() |
270 environment = self.ui.environmentCombo.currentText() |
266 venvName = self.venvComboBox.currentText() |
271 venvName = self.ui.venvComboBox.currentText() |
|
272 scriptName = ( |
267 scriptName = ( |
273 self.ui.scriptnamePicker.currentText() |
268 self.scriptnamePicker.currentText() |
274 if self.ui.scriptnamePicker.isEnabled() |
269 if self.scriptnamePicker.isEnabled() |
275 else "" |
270 else "" |
276 ) |
271 ) |
277 |
272 |
278 return ( |
273 return ( |
279 venvName, |
274 venvName, |
280 scriptName, |
275 scriptName, |
281 cmdLine, |
276 cmdLine, |
282 workdir, |
277 workdir, |
283 environment, |
278 environment, |
284 self.ui.exceptionCheckBox.isChecked(), |
279 self.clearShellCheckBox.isChecked(), |
285 self.ui.unhandledExceptionCheckBox.isChecked(), |
280 self.consoleCheckBox.isChecked(), |
286 self.ui.clearShellCheckBox.isChecked(), |
|
287 self.ui.consoleCheckBox.isChecked(), |
|
288 ) |
281 ) |
289 |
282 |
290 def getGlobalOverrideData(self): |
283 def getGlobalOverrideData(self): |
291 """ |
284 """ |
292 Public method to retrieve the global configuration override data |
285 Public method to retrieve the global configuration override data |
295 @return dictionary containing a flag indicating to activate the global |
288 @return dictionary containing a flag indicating to activate the global |
296 override and a flag indicating a redirect of stdin/stdout/stderr |
289 override and a flag indicating a redirect of stdin/stdout/stderr |
297 @rtype dict |
290 @rtype dict |
298 """ |
291 """ |
299 return { |
292 return { |
300 "enable": self.ui.globalOverrideGroup.isChecked(), |
293 "enable": self.globalOverrideGroup.isChecked(), |
301 "redirect": self.ui.redirectCheckBox.isChecked(), |
294 "redirect": self.redirectCheckBox.isChecked(), |
302 } |
295 } |
303 |
296 |
304 def getDebugData(self): |
297 def getDebugData(self): |
305 """ |
298 """ |
306 Public method to retrieve the debug related data entered into this |
299 Public method to retrieve the debug related data entered into this |
307 dialog. |
300 dialog. |
308 |
301 |
309 @return a tuple of a flag indicating, if the Python library should be |
302 @return tuple containing a flag indicating, if the Python library should be |
310 traced as well, a flag indicating, that the debugger should not |
303 traced as well, a flag indicating, that the debugger should not |
311 stop at the first executable line, a flag indicating to support |
304 stop at the first executable line, a flag indicating to report all |
312 multi process debugging and a space separated list of programs not |
305 exceptions, a flag indicating to support multi process debugging and a |
313 to be debugged |
306 space separated list of programs not to be debugged |
314 @rtype tuple of (bool, bool, bool, str) |
307 @rtype tuple of (bool, bool, bool, bool, str) |
315 """ |
308 """ |
316 if self.dialogType == 0: |
309 if self.__dialogMode == StartDialogMode.Debug: |
317 return ( |
310 return ( |
318 self.ui.tracePythonCheckBox.isChecked(), |
311 self.tracePythonCheckBox.isChecked(), |
319 self.ui.autoContinueCheckBox.isChecked(), |
312 self.autoContinueCheckBox.isChecked(), |
320 self.ui.multiprocessGroup.isChecked(), |
313 self.allExceptionsCheckBox.isChecked(), |
321 self.ui.multiprocessNoDebugCombo.currentText(), |
314 self.multiprocessGroup.isChecked(), |
|
315 self.multiprocessNoDebugCombo.currentText(), |
322 ) |
316 ) |
323 else: |
317 else: |
324 return (False, False, False, "") |
318 return (False, False, False, False, "") |
325 |
319 |
326 def getCoverageData(self): |
320 def getCoverageData(self): |
327 """ |
321 """ |
328 Public method to retrieve the coverage related data entered into this |
322 Public method to retrieve the coverage related data entered into this |
329 dialog. |
323 dialog. |
330 |
324 |
331 @return flag indicating erasure of coverage info |
325 @return flag indicating erasure of coverage info |
332 @rtype bool |
326 @rtype bool |
333 """ |
327 """ |
334 if self.dialogType == 2: |
328 if self.__dialogMode == StartDialogMode.Coverage: |
335 return self.ui.eraseCheckBox.isChecked() |
329 return self.eraseCoverageCheckBox.isChecked() |
336 else: |
330 else: |
337 return False |
331 return False |
338 |
332 |
339 def getProfilingData(self): |
333 def getProfilingData(self): |
340 """ |
334 """ |
355 clear the lists. |
349 clear the lists. |
356 """ |
350 """ |
357 self.__clearHistoryLists = True |
351 self.__clearHistoryLists = True |
358 self.__historiesModified = False # clear catches it all |
352 self.__historiesModified = False # clear catches it all |
359 |
353 |
360 cmdLine = self.ui.cmdlineCombo.currentText() |
354 cmdLine = self.cmdlineCombo.currentText() |
361 workdir = self.ui.workdirPicker.currentText() |
355 workdir = self.workdirPicker.currentText() |
362 environment = self.ui.environmentCombo.currentText() |
356 environment = self.environmentCombo.currentText() |
363 scriptName = self.ui.scriptnamePicker.currentText() |
357 scriptName = self.scriptnamePicker.currentText() |
364 |
358 |
365 self.ui.cmdlineCombo.clear() |
359 self.cmdlineCombo.clear() |
366 self.ui.workdirPicker.clear() |
360 self.workdirPicker.clear() |
367 self.ui.environmentCombo.clear() |
361 self.environmentCombo.clear() |
368 self.ui.scriptnamePicker.clear() |
362 self.scriptnamePicker.clear() |
369 |
363 |
370 self.ui.cmdlineCombo.addItem(cmdLine) |
364 self.cmdlineCombo.addItem(cmdLine) |
371 self.ui.workdirPicker.addItem(workdir) |
365 self.workdirPicker.addItem(workdir) |
372 self.ui.environmentCombo.addItem(environment) |
366 self.environmentCombo.addItem(environment) |
373 self.ui.scriptnamePicker.addItem("") |
367 self.scriptnamePicker.addItem("") |
374 self.ui.scriptnamePicker.setCurrentText(scriptName) |
368 self.scriptnamePicker.setCurrentText(scriptName) |
375 |
369 |
376 if self.dialogType == 0: |
370 if self.__dialogMode == StartDialogMode.Debug: |
377 noDebugList = self.ui.multiprocessNoDebugCombo.currentText() |
371 noDebugList = self.multiprocessNoDebugCombo.currentText() |
378 self.ui.multiprocessNoDebugCombo.clear() |
372 self.multiprocessNoDebugCombo.clear() |
379 self.ui.multiprocessNoDebugCombo.addItem(noDebugList) |
373 self.multiprocessNoDebugCombo.addItem(noDebugList) |
380 |
374 |
381 def __editHistory(self): |
375 def __editHistory(self): |
382 """ |
376 """ |
383 Private slot to edit a history list. |
377 Private slot to edit a history list. |
384 """ |
378 """ |