104 @type str |
118 @type str |
105 @param scriptsList history list of script names |
119 @param scriptsList history list of script names |
106 @type list of str |
120 @type list of str |
107 """ |
121 """ |
108 super().__init__(parent) |
122 super().__init__(parent) |
|
123 self.setupUi(self) |
109 self.setModal(True) |
124 self.setModal(True) |
110 |
125 |
111 self.dialogType = dialogType |
126 self.__dialogMode = dialogMode |
112 if dialogType == 0: |
127 self.debugGroup.setVisible(self.__dialogMode == StartDialogMode.Debug) |
113 from .Ui_StartDebugDialog import ( # __IGNORE_WARNING_I101__ |
128 self.coverageGroup.setVisible(self.__dialogMode == StartDialogMode.Coverage) |
114 Ui_StartDebugDialog, |
129 self.profileGroup.setVisible(self.__dialogMode == StartDialogMode.Profile) |
115 ) |
130 # nothing special for 'Run' mode |
116 |
131 |
117 self.ui = Ui_StartDebugDialog() |
132 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 = ( |
133 projectEnvironmentString = ( |
138 ericApp().getObject("DebugServer").getProjectEnvironmentString() |
134 ericApp().getObject("DebugServer").getProjectEnvironmentString() |
139 ) |
135 ) |
140 if projectEnvironmentString: |
136 if projectEnvironmentString: |
141 self.ui.venvComboBox.addItem(projectEnvironmentString) |
137 self.venvComboBox.addItem(projectEnvironmentString) |
142 self.ui.venvComboBox.addItems( |
138 self.venvComboBox.addItems( |
143 sorted(ericApp().getObject("VirtualEnvManager").getVirtualenvNames()) |
139 sorted(ericApp().getObject("VirtualEnvManager").getVirtualenvNames()) |
144 ) |
140 ) |
145 |
141 |
146 self.ui.scriptnamePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
142 self.scriptnamePicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
147 self.ui.scriptnamePicker.setDefaultDirectory( |
143 self.scriptnamePicker.setDefaultDirectory( |
148 Preferences.getMultiProject("Workspace") |
144 Preferences.getMultiProject("Workspace") |
149 ) |
145 ) |
150 self.ui.scriptnamePicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
146 self.scriptnamePicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
151 self.ui.scriptnamePicker.setSizeAdjustPolicy( |
147 self.scriptnamePicker.setSizeAdjustPolicy( |
152 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
148 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
153 ) |
149 ) |
154 self.ui.scriptnamePicker.setFilters( |
150 self.scriptnamePicker.setFilters( |
155 self.tr( |
151 self.tr( |
156 "Python Files (*.py *.py3);;" |
152 "Python Files (*.py *.py3);;" |
157 "Python GUI Files (*.pyw *.pyw3);;" |
153 "Python GUI Files (*.pyw *.pyw3);;" |
158 "All Files (*)" |
154 "All Files (*)" |
159 ) |
155 ) |
160 ) |
156 ) |
161 self.ui.scriptnamePicker.setEnabled(not forProject) |
157 self.scriptnamePicker.setEnabled(not forProject) |
162 |
158 |
163 self.ui.workdirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
159 self.workdirPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
164 self.ui.workdirPicker.setDefaultDirectory( |
160 self.workdirPicker.setDefaultDirectory(Preferences.getMultiProject("Workspace")) |
165 Preferences.getMultiProject("Workspace") |
161 self.workdirPicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
166 ) |
162 self.workdirPicker.setSizeAdjustPolicy( |
167 self.ui.workdirPicker.setInsertPolicy(QComboBox.InsertPolicy.InsertAtTop) |
|
168 self.ui.workdirPicker.setSizeAdjustPolicy( |
|
169 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
163 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon |
170 ) |
164 ) |
171 |
165 |
172 self.clearButton = self.ui.buttonBox.addButton( |
166 self.clearButton = self.buttonBox.addButton( |
173 self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole |
167 self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole |
174 ) |
168 ) |
175 self.editButton = self.ui.buttonBox.addButton( |
169 self.editButton = self.buttonBox.addButton( |
176 self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole |
170 self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole |
177 ) |
171 ) |
178 |
172 |
179 self.setWindowTitle(caption) |
173 self.setWindowTitle(caption) |
180 self.ui.cmdlineCombo.completer().setCaseSensitivity( |
174 self.cmdlineCombo.completer().setCaseSensitivity( |
181 Qt.CaseSensitivity.CaseSensitive |
175 Qt.CaseSensitivity.CaseSensitive |
182 ) |
176 ) |
183 self.ui.cmdlineCombo.clear() |
177 self.cmdlineCombo.lineEdit().setClearButtonEnabled(True) |
184 self.ui.cmdlineCombo.addItems(argvList) |
178 self.cmdlineCombo.clear() |
|
179 self.cmdlineCombo.addItems(argvList) |
185 if len(argvList) > 0: |
180 if len(argvList) > 0: |
186 self.ui.cmdlineCombo.setCurrentIndex(0) |
181 self.cmdlineCombo.setCurrentIndex(0) |
187 |
182 |
188 self.ui.workdirPicker.clear() |
183 self.workdirPicker.clear() |
189 self.ui.workdirPicker.addItems(wdList) |
184 self.workdirPicker.addItems(wdList) |
190 if len(wdList) > 0: |
185 if len(wdList) > 0: |
191 self.ui.workdirPicker.setCurrentIndex(0) |
186 self.workdirPicker.setCurrentIndex(0) |
192 |
187 |
193 self.ui.environmentCombo.completer().setCaseSensitivity( |
188 self.environmentCombo.completer().setCaseSensitivity( |
194 Qt.CaseSensitivity.CaseSensitive |
189 Qt.CaseSensitivity.CaseSensitive |
195 ) |
190 ) |
196 self.ui.environmentCombo.clear() |
191 self.environmentCombo.lineEdit().setClearButtonEnabled(True) |
197 self.ui.environmentCombo.addItems(envList) |
192 self.environmentCombo.clear() |
198 |
193 self.environmentCombo.addItems(envList) |
199 self.ui.exceptionCheckBox.setChecked(exceptions) |
194 |
200 self.ui.unhandledExceptionCheckBox.setChecked(unhandledExceptions) |
195 self.exceptionCheckBox.setChecked(exceptions) |
201 self.ui.clearShellCheckBox.setChecked(autoClearShell) |
196 self.unhandledExceptionCheckBox.setChecked(unhandledExceptions) |
202 self.ui.consoleCheckBox.setEnabled( |
197 self.clearShellCheckBox.setChecked(autoClearShell) |
|
198 self.consoleCheckBox.setEnabled( |
203 Preferences.getDebugger("ConsoleDbgCommand") != "" |
199 Preferences.getDebugger("ConsoleDbgCommand") != "" |
204 ) |
200 ) |
205 self.ui.consoleCheckBox.setChecked(False) |
201 self.consoleCheckBox.setChecked(False) |
206 |
202 |
207 venvIndex = max(0, self.ui.venvComboBox.findText(lastUsedVenvName)) |
203 venvIndex = max(0, self.venvComboBox.findText(lastUsedVenvName)) |
208 self.ui.venvComboBox.setCurrentIndex(venvIndex) |
204 self.venvComboBox.setCurrentIndex(venvIndex) |
209 self.ui.globalOverrideGroup.setChecked(configOverride["enable"]) |
205 self.globalOverrideGroup.setChecked(configOverride["enable"]) |
210 self.ui.redirectCheckBox.setChecked(configOverride["redirect"]) |
206 self.redirectCheckBox.setChecked(configOverride["redirect"]) |
211 |
207 |
212 self.ui.scriptnamePicker.addItems(scriptsList) |
208 self.scriptnamePicker.addItems(scriptsList) |
213 self.ui.scriptnamePicker.setText(scriptName) |
209 self.scriptnamePicker.setText(scriptName) |
214 |
210 |
215 if dialogType == 0: # start debug dialog |
211 if dialogMode == StartDialogMode.Debug: |
216 enableMultiprocessGlobal = Preferences.getDebugger("MultiProcessEnabled") |
212 enableMultiprocessGlobal = Preferences.getDebugger("MultiProcessEnabled") |
217 self.ui.tracePythonCheckBox.setChecked(tracePython) |
213 self.tracePythonCheckBox.setChecked(tracePython) |
218 self.ui.tracePythonCheckBox.show() |
214 self.tracePythonCheckBox.show() |
219 self.ui.autoContinueCheckBox.setChecked(autoContinue) |
215 self.autoContinueCheckBox.setChecked(autoContinue) |
220 self.ui.multiprocessGroup.setEnabled(enableMultiprocessGlobal) |
216 self.multiprocessGroup.setEnabled(enableMultiprocessGlobal) |
221 self.ui.multiprocessGroup.setChecked( |
217 self.multiprocessGroup.setChecked( |
222 enableMultiprocess & enableMultiprocessGlobal |
218 enableMultiprocess & enableMultiprocessGlobal |
223 ) |
219 ) |
224 self.ui.multiprocessNoDebugCombo.clear() |
220 self.multiprocessNoDebugCombo.clear() |
225 self.ui.multiprocessNoDebugCombo.setToolTip( |
221 self.multiprocessNoDebugCombo.setToolTip( |
226 self.tr( |
222 self.tr( |
227 "Enter the list of programs or program patterns not to be" |
223 "Enter the list of programs or program patterns not to be" |
228 " debugged separated by '{0}'." |
224 " debugged separated by '{0}'." |
229 ).format(os.pathsep) |
225 ).format(os.pathsep) |
230 ) |
226 ) |
|
227 self.multiprocessNoDebugCombo.lineEdit().setClearButtonEnabled(True) |
231 if multiprocessNoDebugHistory: |
228 if multiprocessNoDebugHistory: |
232 self.ui.multiprocessNoDebugCombo.completer().setCaseSensitivity( |
229 self.multiprocessNoDebugCombo.completer().setCaseSensitivity( |
233 Qt.CaseSensitivity.CaseSensitive |
230 Qt.CaseSensitivity.CaseSensitive |
234 ) |
231 ) |
235 self.ui.multiprocessNoDebugCombo.addItems(multiprocessNoDebugHistory) |
232 self.multiprocessNoDebugCombo.addItems(multiprocessNoDebugHistory) |
236 self.ui.multiprocessNoDebugCombo.setCurrentIndex(0) |
233 self.multiprocessNoDebugCombo.setCurrentIndex(0) |
237 |
234 |
238 if dialogType == 3: # start coverage or profile dialog |
235 if dialogMode == StartDialogMode.Coverage: |
239 self.ui.eraseCheckBox.setChecked(True) |
236 self.eraseCoverageCheckBox.setChecked(True) |
240 |
237 |
241 self.ui.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setFocus( |
238 if dialogMode == StartDialogMode.Profile: |
|
239 self.eraseProfileCheckBox.setChecked(True) |
|
240 |
|
241 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setFocus( |
242 Qt.FocusReason.OtherFocusReason |
242 Qt.FocusReason.OtherFocusReason |
243 ) |
243 ) |
244 |
244 |
245 self.__clearHistoryLists = False |
245 self.__clearHistoryLists = False |
246 self.__historiesModified = False |
246 self.__historiesModified = False |
263 @return a tuple of virtual environment, script name, argv, workdir, |
263 @return a tuple of virtual environment, script name, argv, workdir, |
264 environment, exceptions flag, unhandled exceptions flag, clear interpreter |
264 environment, exceptions flag, unhandled exceptions flag, clear interpreter |
265 flag and run in console flag |
265 flag and run in console flag |
266 @rtype tuple of (str, str, str, str, str, bool, bool, bool, bool) |
266 @rtype tuple of (str, str, str, str, str, bool, bool, bool, bool) |
267 """ |
267 """ |
268 cmdLine = self.ui.cmdlineCombo.currentText() |
268 cmdLine = self.cmdlineCombo.currentText() |
269 workdir = self.ui.workdirPicker.currentText(toNative=False) |
269 workdir = self.workdirPicker.currentText(toNative=False) |
270 environment = self.ui.environmentCombo.currentText() |
270 environment = self.environmentCombo.currentText() |
271 venvName = self.ui.venvComboBox.currentText() |
271 venvName = self.venvComboBox.currentText() |
272 scriptName = ( |
272 scriptName = ( |
273 self.ui.scriptnamePicker.currentText() |
273 self.scriptnamePicker.currentText() |
274 if self.ui.scriptnamePicker.isEnabled() |
274 if self.scriptnamePicker.isEnabled() |
275 else "" |
275 else "" |
276 ) |
276 ) |
277 |
277 |
278 return ( |
278 return ( |
279 venvName, |
279 venvName, |
280 scriptName, |
280 scriptName, |
281 cmdLine, |
281 cmdLine, |
282 workdir, |
282 workdir, |
283 environment, |
283 environment, |
284 self.ui.exceptionCheckBox.isChecked(), |
284 self.exceptionCheckBox.isChecked(), |
285 self.ui.unhandledExceptionCheckBox.isChecked(), |
285 self.unhandledExceptionCheckBox.isChecked(), |
286 self.ui.clearShellCheckBox.isChecked(), |
286 self.clearShellCheckBox.isChecked(), |
287 self.ui.consoleCheckBox.isChecked(), |
287 self.consoleCheckBox.isChecked(), |
288 ) |
288 ) |
289 |
289 |
290 def getGlobalOverrideData(self): |
290 def getGlobalOverrideData(self): |
291 """ |
291 """ |
292 Public method to retrieve the global configuration override data |
292 Public method to retrieve the global configuration override data |
355 clear the lists. |
355 clear the lists. |
356 """ |
356 """ |
357 self.__clearHistoryLists = True |
357 self.__clearHistoryLists = True |
358 self.__historiesModified = False # clear catches it all |
358 self.__historiesModified = False # clear catches it all |
359 |
359 |
360 cmdLine = self.ui.cmdlineCombo.currentText() |
360 cmdLine = self.cmdlineCombo.currentText() |
361 workdir = self.ui.workdirPicker.currentText() |
361 workdir = self.workdirPicker.currentText() |
362 environment = self.ui.environmentCombo.currentText() |
362 environment = self.environmentCombo.currentText() |
363 scriptName = self.ui.scriptnamePicker.currentText() |
363 scriptName = self.scriptnamePicker.currentText() |
364 |
364 |
365 self.ui.cmdlineCombo.clear() |
365 self.cmdlineCombo.clear() |
366 self.ui.workdirPicker.clear() |
366 self.workdirPicker.clear() |
367 self.ui.environmentCombo.clear() |
367 self.environmentCombo.clear() |
368 self.ui.scriptnamePicker.clear() |
368 self.scriptnamePicker.clear() |
369 |
369 |
370 self.ui.cmdlineCombo.addItem(cmdLine) |
370 self.cmdlineCombo.addItem(cmdLine) |
371 self.ui.workdirPicker.addItem(workdir) |
371 self.workdirPicker.addItem(workdir) |
372 self.ui.environmentCombo.addItem(environment) |
372 self.environmentCombo.addItem(environment) |
373 self.ui.scriptnamePicker.addItem("") |
373 self.scriptnamePicker.addItem("") |
374 self.ui.scriptnamePicker.setCurrentText(scriptName) |
374 self.scriptnamePicker.setCurrentText(scriptName) |
375 |
375 |
376 if self.dialogType == 0: |
376 if self.__dialogMode == StartDialogMode.Debug: |
377 noDebugList = self.ui.multiprocessNoDebugCombo.currentText() |
377 noDebugList = self.multiprocessNoDebugCombo.currentText() |
378 self.ui.multiprocessNoDebugCombo.clear() |
378 self.multiprocessNoDebugCombo.clear() |
379 self.ui.multiprocessNoDebugCombo.addItem(noDebugList) |
379 self.multiprocessNoDebugCombo.addItem(noDebugList) |
380 |
380 |
381 def __editHistory(self): |
381 def __editHistory(self): |
382 """ |
382 """ |
383 Private slot to edit a history list. |
383 Private slot to edit a history list. |
384 """ |
384 """ |