eric7/Debugger/StartDialog.py

branch
eric7
changeset 8529
569623270e29
parent 8528
2175f268ad9b
child 8881
54e42bc2437a
equal deleted inserted replaced
8528:2175f268ad9b 8529:569623270e29
30 exceptions, 30 exceptions,
31 parent=None, dialogType=0, modfuncList=None, 31 parent=None, dialogType=0, modfuncList=None,
32 tracePython=False, autoClearShell=True, autoContinue=True, 32 tracePython=False, autoClearShell=True, autoContinue=True,
33 enableMultiprocess=False, multiprocessNoDebugHistory=None, 33 enableMultiprocess=False, multiprocessNoDebugHistory=None,
34 configOverride=None, 34 configOverride=None,
35 forProject=False, lastUsedScriptName="", scriptsList=None): 35 forProject=False, scriptName="", scriptsList=None):
36 """ 36 """
37 Constructor 37 Constructor
38 38
39 @param caption the caption to be displayed 39 @param caption the caption to be displayed
40 @type str 40 @type str
80 data 80 data
81 @type dict 81 @type dict
82 @param forProject flag indicating to get the parameters for a 82 @param forProject flag indicating to get the parameters for a
83 run/debug/... action for a project 83 run/debug/... action for a project
84 @type bool 84 @type bool
85 @param lastUsedScriptName name of the most recently used script 85 @param scriptName name of the script
86 @type str 86 @type str
87 @param scriptsList history list of script names 87 @param scriptsList history list of script names
88 @type list of str 88 @type list of str
89 """ 89 """
90 super().__init__(parent) 90 super().__init__(parent)
130 self.ui.workdirPicker.setInsertPolicy( 130 self.ui.workdirPicker.setInsertPolicy(
131 QComboBox.InsertPolicy.InsertAtTop) 131 QComboBox.InsertPolicy.InsertAtTop)
132 self.ui.workdirPicker.setSizeAdjustPolicy( 132 self.ui.workdirPicker.setSizeAdjustPolicy(
133 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon) 133 QComboBox.SizeAdjustPolicy.AdjustToMinimumContentsLengthWithIcon)
134 134
135 # TODO: extend these History actions
136 self.clearButton = self.ui.buttonBox.addButton( 135 self.clearButton = self.ui.buttonBox.addButton(
137 self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole) 136 self.tr("Clear Histories"), QDialogButtonBox.ButtonRole.ActionRole)
138 self.editButton = self.ui.buttonBox.addButton( 137 self.editButton = self.ui.buttonBox.addButton(
139 self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole) 138 self.tr("Edit History"), QDialogButtonBox.ButtonRole.ActionRole)
140 139
157 venvIndex = max(0, self.ui.venvComboBox.findText(lastUsedVenvName)) 156 venvIndex = max(0, self.ui.venvComboBox.findText(lastUsedVenvName))
158 self.ui.venvComboBox.setCurrentIndex(venvIndex) 157 self.ui.venvComboBox.setCurrentIndex(venvIndex)
159 self.ui.globalOverrideGroup.setChecked(configOverride["enable"]) 158 self.ui.globalOverrideGroup.setChecked(configOverride["enable"])
160 self.ui.redirectCheckBox.setChecked(configOverride["redirect"]) 159 self.ui.redirectCheckBox.setChecked(configOverride["redirect"])
161 160
161 self.ui.scriptnamePicker.addItems(scriptsList)
162 self.ui.scriptnamePicker.setText(scriptName)
163
162 if dialogType == 0: # start debug dialog 164 if dialogType == 0: # start debug dialog
163 enableMultiprocessGlobal = Preferences.getDebugger( 165 enableMultiprocessGlobal = Preferences.getDebugger(
164 "MultiProcessEnabled") 166 "MultiProcessEnabled")
165 self.ui.tracePythonCheckBox.setChecked(tracePython) 167 self.ui.tracePythonCheckBox.setChecked(tracePython)
166 self.ui.tracePythonCheckBox.show() 168 self.ui.tracePythonCheckBox.show()
197 199
198 def getData(self): 200 def getData(self):
199 """ 201 """
200 Public method to retrieve the data entered into this dialog. 202 Public method to retrieve the data entered into this dialog.
201 203
202 @return a tuple of interpreter, argv, workdir, environment, 204 @return a tuple of virtual environment, script name, argv, workdir,
203 exceptions flag, clear interpreter flag and run in console flag 205 environment, exceptions flag, clear interpreter flag and run in
204 @rtype tuple of (str, str, str, str, bool, bool, bool) 206 console flag
207 @rtype tuple of (str, str, str, str, str, bool, bool, bool)
205 """ 208 """
206 cmdLine = self.ui.cmdlineCombo.currentText() 209 cmdLine = self.ui.cmdlineCombo.currentText()
207 workdir = self.ui.workdirPicker.currentText(toNative=False) 210 workdir = self.ui.workdirPicker.currentText(toNative=False)
208 environment = self.ui.environmentCombo.currentText() 211 environment = self.ui.environmentCombo.currentText()
209 venvName = self.ui.venvComboBox.currentText() 212 venvName = self.ui.venvComboBox.currentText()
213 scriptName = (
214 self.ui.scriptnamePicker.currentText()
215 if self.ui.scriptnamePicker.isEnabled() else
216 ""
217 )
210 218
211 return (venvName, 219 return (venvName,
220 scriptName,
212 cmdLine, 221 cmdLine,
213 workdir, 222 workdir,
214 environment, 223 environment,
215 self.ui.exceptionCheckBox.isChecked(), 224 self.ui.exceptionCheckBox.isChecked(),
216 self.ui.clearShellCheckBox.isChecked(), 225 self.ui.clearShellCheckBox.isChecked(),
286 self.__historiesModified = False # clear catches it all 295 self.__historiesModified = False # clear catches it all
287 296
288 cmdLine = self.ui.cmdlineCombo.currentText() 297 cmdLine = self.ui.cmdlineCombo.currentText()
289 workdir = self.ui.workdirPicker.currentText() 298 workdir = self.ui.workdirPicker.currentText()
290 environment = self.ui.environmentCombo.currentText() 299 environment = self.ui.environmentCombo.currentText()
300 scriptName = self.ui.scriptnamePicker.currentText()
291 301
292 self.ui.cmdlineCombo.clear() 302 self.ui.cmdlineCombo.clear()
293 self.ui.workdirPicker.clear() 303 self.ui.workdirPicker.clear()
294 self.ui.environmentCombo.clear() 304 self.ui.environmentCombo.clear()
305 self.ui.scriptnamePicker.clear()
295 306
296 self.ui.cmdlineCombo.addItem(cmdLine) 307 self.ui.cmdlineCombo.addItem(cmdLine)
297 self.ui.workdirPicker.addItem(workdir) 308 self.ui.workdirPicker.addItem(workdir)
298 self.ui.environmentCombo.addItem(environment) 309 self.ui.environmentCombo.addItem(environment)
310 self.ui.scriptnamePicker.addItem("")
311 self.ui.scriptnamePicker.setCurrentText(scriptName)
299 312
300 if self.dialogType == 0: 313 if self.dialogType == 0:
301 noDebugList = self.ui.multiprocessNoDebugCombo.currentText() 314 noDebugList = self.ui.multiprocessNoDebugCombo.currentText()
302 self.ui.multiprocessNoDebugCombo.clear() 315 self.ui.multiprocessNoDebugCombo.clear()
303 self.ui.multiprocessNoDebugCombo.addItem(noDebugList) 316 self.ui.multiprocessNoDebugCombo.addItem(noDebugList)
306 """ 319 """
307 Private slot to edit a history list. 320 Private slot to edit a history list.
308 """ 321 """
309 histories = [ 322 histories = [
310 "", 323 "",
324 self.tr("Script Name"),
311 self.tr("Command Line"), 325 self.tr("Command Line"),
312 self.tr("Working Directory"), 326 self.tr("Working Directory"),
313 self.tr("Environment"), 327 self.tr("Environment"),
314 ] 328 ]
315 combos = [ 329 combos = [
316 None, 330 None,
331 self.ui.scriptnamePicker,
317 self.ui.cmdlineCombo, 332 self.ui.cmdlineCombo,
318 self.ui.workdirPicker, 333 self.ui.workdirPicker,
319 self.ui.environmentCombo, 334 self.ui.environmentCombo,
320 ] 335 ]
321 if self.dialogType == 0: 336 if self.dialogType == 0:
328 histories, 343 histories,
329 0, False) 344 0, False)
330 if ok and historyKind: 345 if ok and historyKind:
331 history = [] 346 history = []
332 historiesIndex = histories.index(historyKind) 347 historiesIndex = histories.index(historyKind)
333 if historiesIndex == 2: 348 if historiesIndex == 1:
349 history = self.ui.scriptnamePicker.getPathItems()
350 elif historiesIndex == 3:
334 history = self.ui.workdirPicker.getPathItems() 351 history = self.ui.workdirPicker.getPathItems()
335 else: 352 else:
336 combo = combos[historiesIndex] 353 combo = combos[historiesIndex]
337 if combo: 354 if combo:
338 for index in range(combo.count()): 355 for index in range(combo.count()):
370 387
371 def getHistories(self): 388 def getHistories(self):
372 """ 389 """
373 Public method to get the lists of histories. 390 Public method to get the lists of histories.
374 391
375 @return tuple containing the histories of command line arguments, 392 @return tuple containing the histories of script names, command line
376 working directories, environment settings and no debug programs 393 arguments, working directories, environment settings and no debug
377 lists 394 programs lists
378 @rtype tuple of four list of str 395 @rtype tuple of five list of str
379 """ 396 """
380 noDebugHistory = ( 397 noDebugHistory = (
381 [ 398 [
382 self.ui.multiprocessNoDebugCombo.itemText(index) 399 self.ui.multiprocessNoDebugCombo.itemText(index)
383 for index in range(self.ui.multiprocessNoDebugCombo.count()) 400 for index in range(self.ui.multiprocessNoDebugCombo.count())
384 ] 401 ]
385 if self.dialogType == 0 else 402 if self.dialogType == 0 else
386 None 403 None
387 ) 404 )
388 return ( 405 return (
406 self.ui.scriptnamePicker.getPathNames(),
389 [self.ui.cmdlineCombo.itemText(index) for index in range( 407 [self.ui.cmdlineCombo.itemText(index) for index in range(
390 self.ui.cmdlineCombo.count())], 408 self.ui.cmdlineCombo.count())],
391 self.ui.workdirPicker.getPathItems(), 409 self.ui.workdirPicker.getPathItems(),
392 [self.ui.environmentCombo.itemText(index) for index in range( 410 [self.ui.environmentCombo.itemText(index) for index in range(
393 self.ui.environmentCombo.count())], 411 self.ui.environmentCombo.count())],

eric ide

mercurial