eric6/Debugger/StartDialog.py

branch
multi_processing
changeset 7411
6d8dcb3551b3
parent 7409
1413bfe73d41
child 7422
9a008ab4811b
equal deleted inserted replaced
7410:401791e6f50f 7411:6d8dcb3551b3
27 """ 27 """
28 def __init__(self, caption, lastUsedVenvName, argvList, wdList, envList, 28 def __init__(self, caption, lastUsedVenvName, argvList, wdList, envList,
29 exceptions, 29 exceptions,
30 parent=None, dialogType=0, modfuncList=None, 30 parent=None, dialogType=0, modfuncList=None,
31 tracePython=False, autoClearShell=True, autoContinue=True, 31 tracePython=False, autoClearShell=True, autoContinue=True,
32 autoFork=False, forkChild=False, enableMultiprocess=False): 32 autoFork=False, forkChild=False, enableMultiprocess=False,
33 multiprocessNoDebugHistory=None):
33 """ 34 """
34 Constructor 35 Constructor
35 36
36 @param caption the caption to be displayed 37 @param caption the caption to be displayed
37 @type str 38 @type str
72 @param forkChild flag indicating to debug the child after forking 73 @param forkChild flag indicating to debug the child after forking
73 @type bool 74 @type bool
74 @param enableMultiprocess flag indicating the support for multi process 75 @param enableMultiprocess flag indicating the support for multi process
75 debugging 76 debugging
76 @type bool 77 @type bool
78 @param multiprocessNoDebugHistory list of lists with programs not to be
79 debugged
80 @type list of str
77 """ 81 """
78 super(StartDialog, self).__init__(parent) 82 super(StartDialog, self).__init__(parent)
79 self.setModal(True) 83 self.setModal(True)
80 84
81 self.dialogType = dialogType 85 self.dialogType = dialogType
133 self.ui.tracePythonCheckBox.setChecked(tracePython) 137 self.ui.tracePythonCheckBox.setChecked(tracePython)
134 self.ui.tracePythonCheckBox.show() 138 self.ui.tracePythonCheckBox.show()
135 self.ui.autoContinueCheckBox.setChecked(autoContinue) 139 self.ui.autoContinueCheckBox.setChecked(autoContinue)
136 self.ui.forkModeCheckBox.setChecked(autoFork) 140 self.ui.forkModeCheckBox.setChecked(autoFork)
137 self.ui.forkChildCheckBox.setChecked(forkChild) 141 self.ui.forkChildCheckBox.setChecked(forkChild)
138 self.ui.multiprocessEnableCheckBox.setChecked(enableMultiprocess) 142 self.ui.multiprocessGroup.setChecked(enableMultiprocess)
143 self.ui.multiprocessNoDebugCombo.clear()
144 if multiprocessNoDebugHistory:
145 self.ui.multiprocessNoDebugCombo.addItems(
146 multiprocessNoDebugHistory)
147 self.ui.multiprocessNoDebugCombo.setCurrentIndex(0)
139 148
140 if dialogType == 1: # start run dialog 149 if dialogType == 1: # start run dialog
141 self.ui.forkModeCheckBox.setChecked(autoFork) 150 self.ui.forkModeCheckBox.setChecked(autoFork)
142 self.ui.forkChildCheckBox.setChecked(forkChild) 151 self.ui.forkChildCheckBox.setChecked(forkChild)
143 152
184 Public method to retrieve the debug related data entered into this 193 Public method to retrieve the debug related data entered into this
185 dialog. 194 dialog.
186 195
187 @return a tuple of a flag indicating, if the Python library should be 196 @return a tuple of a flag indicating, if the Python library should be
188 traced as well, a flag indicating, that the debugger should not 197 traced as well, a flag indicating, that the debugger should not
189 stop at the first executable line (boolean), a flag indicating, 198 stop at the first executable line, a flag indicating, that the
190 that the debugger should fork automatically (boolean) and a flag 199 debugger should fork automatically, a flag indicating, that the
191 indicating, that the debugger should debug the child process after 200 debugger should debug the child process after forking
192 forking automatically (boolean) 201 automatically, a flag indicating to support multi process debugging
202 and a space separated list of programs not to be debugged
203 @rtype tuple of (bool, bool, bool, bool, bool, str)
193 """ 204 """
194 if self.dialogType == 0: 205 if self.dialogType == 0:
195 return (self.ui.tracePythonCheckBox.isChecked(), 206 return (self.ui.tracePythonCheckBox.isChecked(),
196 self.ui.autoContinueCheckBox.isChecked(), 207 self.ui.autoContinueCheckBox.isChecked(),
197 self.ui.forkModeCheckBox.isChecked(), 208 self.ui.forkModeCheckBox.isChecked(),
198 self.ui.forkChildCheckBox.isChecked(), 209 self.ui.forkChildCheckBox.isChecked(),
199 self.ui.multiprocessEnableCheckBox.isChecked()) 210 self.ui.multiprocessGroup.isChecked(),
200 else: 211 self.ui.multiprocessNoDebugCombo.currentText())
201 return (False, False, False, False, False) 212 else:
213 return (False, False, False, False, False, [])
202 214
203 def getRunData(self): 215 def getRunData(self):
204 """ 216 """
205 Public method to retrieve the debug related data entered into this 217 Public method to retrieve the debug related data entered into this
206 dialog. 218 dialog.
257 self.ui.environmentCombo.clear() 269 self.ui.environmentCombo.clear()
258 270
259 self.ui.cmdlineCombo.addItem(cmdLine) 271 self.ui.cmdlineCombo.addItem(cmdLine)
260 self.ui.workdirPicker.addItem(workdir) 272 self.ui.workdirPicker.addItem(workdir)
261 self.ui.environmentCombo.addItem(environment) 273 self.ui.environmentCombo.addItem(environment)
274
275 if self.dialogType == 0:
276 noDebugList = self.ui.multiprocessNoDebugCombo.currentText()
277 self.ui.multiprocessNoDebugCombo.clear()
278 self.ui.multiprocessNoDebugCombo.addItem(noDebugList)
262 279
263 def __editHistory(self): 280 def __editHistory(self):
264 """ 281 """
265 Private slot to edit a history list. 282 Private slot to edit a history list.
266 """ 283 """
268 "", 285 "",
269 self.tr("Command Line"), 286 self.tr("Command Line"),
270 self.tr("Working Directory"), 287 self.tr("Working Directory"),
271 self.tr("Environment"), 288 self.tr("Environment"),
272 ] 289 ]
290 combos = [
291 None,
292 self.ui.cmdlineCombo,
293 self.ui.workdirPicker,
294 self.ui.environmentCombo,
295 ]
296 if self.dialogType == 0:
297 histories.append(self.tr("No Debug Programs"))
298 combos.append(self.ui.multiprocessNoDebugCombo)
273 historyKind, ok = QInputDialog.getItem( 299 historyKind, ok = QInputDialog.getItem(
274 self, 300 self,
275 self.tr("Edit History"), 301 self.tr("Edit History"),
276 self.tr("Select the history list to be edited:"), 302 self.tr("Select the history list to be edited:"),
277 histories, 303 histories,
278 0, False) 304 0, False)
279 if ok and historyKind: 305 if ok and historyKind:
306 history = []
280 historiesIndex = histories.index(historyKind) 307 historiesIndex = histories.index(historyKind)
281 if historiesIndex == 2: 308 if historiesIndex == 2:
282 history = self.ui.workdirPicker.getPathItems() 309 history = self.ui.workdirPicker.getPathItems()
283 else: 310 else:
284 history = [] 311 combo = combos[historiesIndex]
285 if historiesIndex == 1: 312 if combo:
286 combo = self.ui.cmdlineCombo 313 for index in range(combo.count()):
287 else: 314 history.append(combo.itemText(index))
288 combo = self.ui.environmentCombo
289 for index in range(combo.count()):
290 history.append(combo.itemText(index))
291 315
292 from .StartHistoryEditDialog import StartHistoryEditDialog 316 if history:
293 dlg = StartHistoryEditDialog(history, self) 317 from .StartHistoryEditDialog import StartHistoryEditDialog
294 if dlg.exec_() == QDialog.Accepted: 318 dlg = StartHistoryEditDialog(history, self)
295 history = dlg.getHistory() 319 if dlg.exec_() == QDialog.Accepted:
296 if historiesIndex == 1: 320 history = dlg.getHistory()
297 combo = self.ui.cmdlineCombo 321 combo = combos[historiesIndex]
298 elif historiesIndex == 2: 322 if combo:
299 combo = self.ui.workdirPicker 323 combo.clear()
300 else: 324 combo.addItems(history)
301 combo = self.ui.environmentCombo 325
302 combo.clear() 326 self.__historiesModified = True
303 combo.addItems(history)
304
305 self.__historiesModified = True
306 327
307 def historiesModified(self): 328 def historiesModified(self):
308 """ 329 """
309 Public method to test for modified histories. 330 Public method to test for modified histories.
310 331
325 def getHistories(self): 346 def getHistories(self):
326 """ 347 """
327 Public method to get the lists of histories. 348 Public method to get the lists of histories.
328 349
329 @return tuple containing the histories of command line arguments, 350 @return tuple containing the histories of command line arguments,
330 working directories, environment settings and interpreters 351 working directories, environment settings and no debug programs
352 lists
331 @rtype tuple of four list of str 353 @rtype tuple of four list of str
332 """ 354 """
355 if self.dialogType == 0:
356 noDebugHistory = [
357 self.ui.multiprocessNoDebugCombo.itemText(index)
358 for index in range(self.ui.multiprocessNoDebugCombo.count())
359 ]
360 else:
361 noDebugHistory = None
333 return ( 362 return (
334 [self.ui.cmdlineCombo.itemText(index) for index in range( 363 [self.ui.cmdlineCombo.itemText(index) for index in range(
335 self.ui.cmdlineCombo.count())], 364 self.ui.cmdlineCombo.count())],
336 self.ui.workdirPicker.getPathItems(), 365 self.ui.workdirPicker.getPathItems(),
337 [self.ui.environmentCombo.itemText(index) for index in range( 366 [self.ui.environmentCombo.itemText(index) for index in range(
338 self.ui.environmentCombo.count())], 367 self.ui.environmentCombo.count())],
368 noDebugHistory,
339 ) 369 )
340 370
341 def on_buttonBox_clicked(self, button): 371 def on_buttonBox_clicked(self, button):
342 """ 372 """
343 Private slot called by a button of the button box clicked. 373 Private slot called by a button of the button box clicked.

eric ide

mercurial