eric6/Debugger/DebugUI.py

branch
maintenance
changeset 8176
31965986ecd1
parent 8142
43248bafe9b2
parent 8163
29fb6d420a25
child 8273
698ae46f40a4
equal deleted inserted replaced
8153:e01ae92db699 8176:31965986ecd1
6 """ 6 """
7 Module implementing the debugger UI. 7 Module implementing the debugger UI.
8 """ 8 """
9 9
10 import os 10 import os
11 import copy
11 12
12 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, Qt 13 from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, Qt
13 from PyQt5.QtGui import QKeySequence 14 from PyQt5.QtGui import QKeySequence
14 from PyQt5.QtWidgets import QMenu, QToolBar, QApplication, QDialog 15 from PyQt5.QtWidgets import QMenu, QToolBar, QApplication, QDialog
15 16
108 Preferences.Prefs.settings.value( 109 Preferences.Prefs.settings.value(
109 'DebugInfo/EnableMultiprocess', False)) 110 'DebugInfo/EnableMultiprocess', False))
110 self.multiprocessNoDebugHistory = Preferences.toList( 111 self.multiprocessNoDebugHistory = Preferences.toList(
111 Preferences.Prefs.settings.value( 112 Preferences.Prefs.settings.value(
112 'DebugInfo/MultiprocessNoDebugHistory')) 113 'DebugInfo/MultiprocessNoDebugHistory'))
114 self.overrideGlobalConfig = {
115 "enable": Preferences.toBool(Preferences.Prefs.settings.value(
116 'DebugInfo/OverrideGlobal', False)),
117 "redirect": Preferences.toBool(Preferences.Prefs.settings.value(
118 'DebugInfo/RedirectStdinStdout', True)),
119 }
113 120
114 self.lastDebuggedFile = None 121 self.lastDebuggedFile = None
115 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project 122 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project
116 self.clientType = "" 123 self.clientType = ""
117 self.lastAction = -1 124 self.lastAction = -1
199 206
200 self.runAct = E5Action( 207 self.runAct = E5Action(
201 self.tr('Run Script'), 208 self.tr('Run Script'),
202 UI.PixmapCache.getIcon("runScript"), 209 UI.PixmapCache.getIcon("runScript"),
203 self.tr('&Run Script...'), 210 self.tr('&Run Script...'),
204 Qt.Key_F2, 0, self, 'dbg_run_script') 211 Qt.Key.Key_F2, 0, self, 'dbg_run_script')
205 self.runAct.setStatusTip(self.tr('Run the current Script')) 212 self.runAct.setStatusTip(self.tr('Run the current Script'))
206 self.runAct.setWhatsThis(self.tr( 213 self.runAct.setWhatsThis(self.tr(
207 """<b>Run Script</b>""" 214 """<b>Run Script</b>"""
208 """<p>Set the command line arguments and run the script outside""" 215 """<p>Set the command line arguments and run the script outside"""
209 """ the debugger. If the file has unsaved changes it may be""" 216 """ the debugger. If the file has unsaved changes it may be"""
213 self.actions.append(self.runAct) 220 self.actions.append(self.runAct)
214 221
215 self.runProjectAct = E5Action( 222 self.runProjectAct = E5Action(
216 self.tr('Run Project'), 223 self.tr('Run Project'),
217 UI.PixmapCache.getIcon("runProject"), 224 UI.PixmapCache.getIcon("runProject"),
218 self.tr('Run &Project...'), Qt.SHIFT + Qt.Key_F2, 0, self, 225 self.tr('Run &Project...'),
219 'dbg_run_project') 226 Qt.Modifier.SHIFT + Qt.Key.Key_F2,
227 0, self, 'dbg_run_project')
220 self.runProjectAct.setStatusTip(self.tr('Run the current Project')) 228 self.runProjectAct.setStatusTip(self.tr('Run the current Project'))
221 self.runProjectAct.setWhatsThis(self.tr( 229 self.runProjectAct.setWhatsThis(self.tr(
222 """<b>Run Project</b>""" 230 """<b>Run Project</b>"""
223 """<p>Set the command line arguments and run the current project""" 231 """<p>Set the command line arguments and run the current project"""
224 """ outside the debugger.""" 232 """ outside the debugger."""
291 self.actions.append(self.profileProjectAct) 299 self.actions.append(self.profileProjectAct)
292 300
293 self.debugAct = E5Action( 301 self.debugAct = E5Action(
294 self.tr('Debug Script'), 302 self.tr('Debug Script'),
295 UI.PixmapCache.getIcon("debugScript"), 303 UI.PixmapCache.getIcon("debugScript"),
296 self.tr('&Debug Script...'), Qt.Key_F5, 0, self, 304 self.tr('&Debug Script...'), Qt.Key.Key_F5, 0, self,
297 'dbg_debug_script') 305 'dbg_debug_script')
298 self.debugAct.setStatusTip(self.tr('Debug the current Script')) 306 self.debugAct.setStatusTip(self.tr('Debug the current Script'))
299 self.debugAct.setWhatsThis(self.tr( 307 self.debugAct.setWhatsThis(self.tr(
300 """<b>Debug Script</b>""" 308 """<b>Debug Script</b>"""
301 """<p>Set the command line arguments and set the current line""" 309 """<p>Set the command line arguments and set the current line"""
307 self.actions.append(self.debugAct) 315 self.actions.append(self.debugAct)
308 316
309 self.debugProjectAct = E5Action( 317 self.debugProjectAct = E5Action(
310 self.tr('Debug Project'), 318 self.tr('Debug Project'),
311 UI.PixmapCache.getIcon("debugProject"), 319 UI.PixmapCache.getIcon("debugProject"),
312 self.tr('Debug &Project...'), Qt.SHIFT + Qt.Key_F5, 0, self, 320 self.tr('Debug &Project...'),
313 'dbg_debug_project') 321 Qt.Modifier.SHIFT + Qt.Key.Key_F5,
322 0, self, 'dbg_debug_project')
314 self.debugProjectAct.setStatusTip(self.tr( 323 self.debugProjectAct.setStatusTip(self.tr(
315 'Debug the current Project')) 324 'Debug the current Project'))
316 self.debugProjectAct.setWhatsThis(self.tr( 325 self.debugProjectAct.setWhatsThis(self.tr(
317 """<b>Debug Project</b>""" 326 """<b>Debug Project</b>"""
318 """<p>Set the command line arguments and set the current line""" 327 """<p>Set the command line arguments and set the current line"""
324 self.actions.append(self.debugProjectAct) 333 self.actions.append(self.debugProjectAct)
325 334
326 self.restartAct = E5Action( 335 self.restartAct = E5Action(
327 self.tr('Restart'), 336 self.tr('Restart'),
328 UI.PixmapCache.getIcon("debugRestart"), 337 UI.PixmapCache.getIcon("debugRestart"),
329 self.tr('Restart'), Qt.Key_F4, 0, self, 'dbg_restart_script') 338 self.tr('Restart'), Qt.Key.Key_F4, 0, self, 'dbg_restart_script')
330 self.restartAct.setStatusTip(self.tr( 339 self.restartAct.setStatusTip(self.tr(
331 'Restart the last debugged script')) 340 'Restart the last debugged script'))
332 self.restartAct.setWhatsThis(self.tr( 341 self.restartAct.setWhatsThis(self.tr(
333 """<b>Restart</b>""" 342 """<b>Restart</b>"""
334 """<p>Set the command line arguments and set the current line""" 343 """<p>Set the command line arguments and set the current line"""
340 self.actions.append(self.restartAct) 349 self.actions.append(self.restartAct)
341 350
342 self.stopAct = E5Action( 351 self.stopAct = E5Action(
343 self.tr('Stop'), 352 self.tr('Stop'),
344 UI.PixmapCache.getIcon("stopScript"), 353 UI.PixmapCache.getIcon("stopScript"),
345 self.tr('Stop'), Qt.SHIFT + Qt.Key_F10, 0, 354 self.tr('Stop'), Qt.Modifier.SHIFT + Qt.Key.Key_F10, 0,
346 self, 'dbg_stop_script') 355 self, 'dbg_stop_script')
347 self.stopAct.setStatusTip(self.tr("""Stop the running script.""")) 356 self.stopAct.setStatusTip(self.tr("""Stop the running script."""))
348 self.stopAct.setWhatsThis(self.tr( 357 self.stopAct.setWhatsThis(self.tr(
349 """<b>Stop</b>""" 358 """<b>Stop</b>"""
350 """<p>This stops the script running in the debugger backend.</p>""" 359 """<p>This stops the script running in the debugger backend.</p>"""
355 self.debugActGrp = createActionGroup(self) 364 self.debugActGrp = createActionGroup(self)
356 365
357 act = E5Action( 366 act = E5Action(
358 self.tr('Continue'), 367 self.tr('Continue'),
359 UI.PixmapCache.getIcon("continue"), 368 UI.PixmapCache.getIcon("continue"),
360 self.tr('&Continue'), Qt.Key_F6, 0, 369 self.tr('&Continue'), Qt.Key.Key_F6, 0,
361 self.debugActGrp, 'dbg_continue') 370 self.debugActGrp, 'dbg_continue')
362 act.setStatusTip( 371 act.setStatusTip(
363 self.tr('Continue running the program from the current line')) 372 self.tr('Continue running the program from the current line'))
364 act.setWhatsThis(self.tr( 373 act.setWhatsThis(self.tr(
365 """<b>Continue</b>""" 374 """<b>Continue</b>"""
371 self.actions.append(act) 380 self.actions.append(act)
372 381
373 act = E5Action( 382 act = E5Action(
374 self.tr('Continue to Cursor'), 383 self.tr('Continue to Cursor'),
375 UI.PixmapCache.getIcon("continueToCursor"), 384 UI.PixmapCache.getIcon("continueToCursor"),
376 self.tr('Continue &To Cursor'), Qt.SHIFT + Qt.Key_F6, 0, 385 self.tr('Continue &To Cursor'),
377 self.debugActGrp, 'dbg_continue_to_cursor') 386 Qt.Modifier.SHIFT + Qt.Key.Key_F6,
387 0, self.debugActGrp, 'dbg_continue_to_cursor')
378 act.setStatusTip(self.tr( 388 act.setStatusTip(self.tr(
379 """Continue running the program from the""" 389 """Continue running the program from the"""
380 """ current line to the current cursor position""")) 390 """ current line to the current cursor position"""))
381 act.setWhatsThis(self.tr( 391 act.setWhatsThis(self.tr(
382 """<b>Continue To Cursor</b>""" 392 """<b>Continue To Cursor</b>"""
387 self.actions.append(act) 397 self.actions.append(act)
388 398
389 act = E5Action( 399 act = E5Action(
390 self.tr('Continue Until'), 400 self.tr('Continue Until'),
391 UI.PixmapCache.getIcon("continueUntil"), 401 UI.PixmapCache.getIcon("continueUntil"),
392 self.tr('Continue &Until'), Qt.CTRL + Qt.Key_F6, 0, 402 self.tr('Continue &Until'), Qt.Modifier.CTRL + Qt.Key.Key_F6, 0,
393 self.debugActGrp, 'dbg_continue_until') 403 self.debugActGrp, 'dbg_continue_until')
394 act.setStatusTip(self.tr( 404 act.setStatusTip(self.tr(
395 """Continue running the program from the current line to the""" 405 """Continue running the program from the current line to the"""
396 """ current cursor position or until leaving the current frame""")) 406 """ current cursor position or until leaving the current frame"""))
397 act.setWhatsThis(self.tr( 407 act.setWhatsThis(self.tr(
404 self.actions.append(act) 414 self.actions.append(act)
405 415
406 act = E5Action( 416 act = E5Action(
407 self.tr('Move Instruction Pointer to Cursor'), 417 self.tr('Move Instruction Pointer to Cursor'),
408 UI.PixmapCache.getIcon("moveInstructionPointer"), 418 UI.PixmapCache.getIcon("moveInstructionPointer"),
409 self.tr('&Jump To Cursor'), Qt.Key_F12, 0, 419 self.tr('&Jump To Cursor'), Qt.Key.Key_F12, 0,
410 self.debugActGrp, 'dbg_jump_to_cursor') 420 self.debugActGrp, 'dbg_jump_to_cursor')
411 act.setStatusTip(self.tr( 421 act.setStatusTip(self.tr(
412 """Skip the code from the""" 422 """Skip the code from the"""
413 """ current line to the current cursor position""")) 423 """ current line to the current cursor position"""))
414 act.setWhatsThis(self.tr( 424 act.setWhatsThis(self.tr(
424 self.actions.append(act) 434 self.actions.append(act)
425 435
426 act = E5Action( 436 act = E5Action(
427 self.tr('Single Step'), 437 self.tr('Single Step'),
428 UI.PixmapCache.getIcon("step"), 438 UI.PixmapCache.getIcon("step"),
429 self.tr('Sin&gle Step'), Qt.Key_F7, 0, 439 self.tr('Sin&gle Step'), Qt.Key.Key_F7, 0,
430 self.debugActGrp, 'dbg_single_step') 440 self.debugActGrp, 'dbg_single_step')
431 act.setStatusTip(self.tr('Execute a single Python statement')) 441 act.setStatusTip(self.tr('Execute a single Python statement'))
432 act.setWhatsThis(self.tr( 442 act.setWhatsThis(self.tr(
433 """<b>Single Step</b>""" 443 """<b>Single Step</b>"""
434 """<p>Execute a single Python statement. If the statement""" 444 """<p>Execute a single Python statement. If the statement"""
440 self.actions.append(act) 450 self.actions.append(act)
441 451
442 act = E5Action( 452 act = E5Action(
443 self.tr('Step Over'), 453 self.tr('Step Over'),
444 UI.PixmapCache.getIcon("stepOver"), 454 UI.PixmapCache.getIcon("stepOver"),
445 self.tr('Step &Over'), Qt.Key_F8, 0, 455 self.tr('Step &Over'), Qt.Key.Key_F8, 0,
446 self.debugActGrp, 'dbg_step_over') 456 self.debugActGrp, 'dbg_step_over')
447 act.setStatusTip(self.tr( 457 act.setStatusTip(self.tr(
448 """Execute a single Python statement staying""" 458 """Execute a single Python statement staying"""
449 """ in the current frame""")) 459 """ in the current frame"""))
450 act.setWhatsThis(self.tr( 460 act.setWhatsThis(self.tr(
459 self.actions.append(act) 469 self.actions.append(act)
460 470
461 act = E5Action( 471 act = E5Action(
462 self.tr('Step Out'), 472 self.tr('Step Out'),
463 UI.PixmapCache.getIcon("stepOut"), 473 UI.PixmapCache.getIcon("stepOut"),
464 self.tr('Step Ou&t'), Qt.Key_F9, 0, 474 self.tr('Step Ou&t'), Qt.Key.Key_F9, 0,
465 self.debugActGrp, 'dbg_step_out') 475 self.debugActGrp, 'dbg_step_out')
466 act.setStatusTip(self.tr( 476 act.setStatusTip(self.tr(
467 """Execute Python statements until leaving""" 477 """Execute Python statements until leaving"""
468 """ the current frame""")) 478 """ the current frame"""))
469 act.setWhatsThis(self.tr( 479 act.setWhatsThis(self.tr(
478 self.actions.append(act) 488 self.actions.append(act)
479 489
480 act = E5Action( 490 act = E5Action(
481 self.tr('Stop'), 491 self.tr('Stop'),
482 UI.PixmapCache.getIcon("stepQuit"), 492 UI.PixmapCache.getIcon("stepQuit"),
483 self.tr('&Stop'), Qt.Key_F10, 0, 493 self.tr('&Stop'), Qt.Key.Key_F10, 0,
484 self.debugActGrp, 'dbg_stop') 494 self.debugActGrp, 'dbg_stop')
485 act.setStatusTip(self.tr('Stop debugging')) 495 act.setStatusTip(self.tr('Stop debugging'))
486 act.setWhatsThis(self.tr( 496 act.setWhatsThis(self.tr(
487 """<b>Stop</b>""" 497 """<b>Stop</b>"""
488 """<p>Stop the running debugging session.</p>""" 498 """<p>Stop the running debugging session.</p>"""
999 Preferences.Prefs.settings.setValue( 1009 Preferences.Prefs.settings.setValue(
1000 'DebugInfo/EnableMultiprocess', self.enableMultiprocess) 1010 'DebugInfo/EnableMultiprocess', self.enableMultiprocess)
1001 Preferences.Prefs.settings.setValue( 1011 Preferences.Prefs.settings.setValue(
1002 'DebugInfo/MultiprocessNoDebugHistory', 1012 'DebugInfo/MultiprocessNoDebugHistory',
1003 self.multiprocessNoDebugHistory) 1013 self.multiprocessNoDebugHistory)
1014 Preferences.Prefs.settings.setValue(
1015 'DebugInfo/OverrideGlobal',
1016 self.overrideGlobalConfig["enable"])
1017 Preferences.Prefs.settings.setValue(
1018 'DebugInfo/RedirectStdinStdout',
1019 self.overrideGlobalConfig["redirect"])
1004 1020
1005 def shutdownServer(self): 1021 def shutdownServer(self):
1006 """ 1022 """
1007 Public method to shut down the debug server. 1023 Public method to shut down the debug server.
1008 1024
1470 1486
1471 from .EditBreakpointDialog import EditBreakpointDialog 1487 from .EditBreakpointDialog import EditBreakpointDialog
1472 dlg = EditBreakpointDialog( 1488 dlg = EditBreakpointDialog(
1473 (fn, line), (cond, temp, enabled, count), 1489 (fn, line), (cond, temp, enabled, count),
1474 [], self.ui, modal=True) 1490 [], self.ui, modal=True)
1475 if dlg.exec() == QDialog.Accepted: 1491 if dlg.exec() == QDialog.DialogCode.Accepted:
1476 cond, temp, enabled, count = dlg.getData() 1492 cond, temp, enabled, count = dlg.getData()
1477 model.setBreakPointByIndex(index, fn, line, 1493 model.setBreakPointByIndex(index, fn, line,
1478 (cond, temp, enabled, count)) 1494 (cond, temp, enabled, count))
1479 1495
1480 def __clientWatchConditionError(self, cond, debuggerId): 1496 def __clientWatchConditionError(self, cond, debuggerId):
1507 cond, special, temp, enabled, count = wp[:5] 1523 cond, special, temp, enabled, count = wp[:5]
1508 1524
1509 from .EditWatchpointDialog import EditWatchpointDialog 1525 from .EditWatchpointDialog import EditWatchpointDialog
1510 dlg = EditWatchpointDialog( 1526 dlg = EditWatchpointDialog(
1511 (cond, temp, enabled, count, special), self.ui) 1527 (cond, temp, enabled, count, special), self.ui)
1512 if dlg.exec() == QDialog.Accepted: 1528 if dlg.exec() == QDialog.DialogCode.Accepted:
1513 cond, temp, enabled, count, special = dlg.getData() 1529 cond, temp, enabled, count, special = dlg.getData()
1514 1530
1515 # check for duplicates 1531 # check for duplicates
1516 idx = model.getWatchPointIndex(cond, special) 1532 idx = model.getWatchPointIndex(cond, special)
1517 duplicate = (idx.isValid() and 1533 duplicate = (idx.isValid() and
1543 """ 1559 """
1544 from .VariablesFilterDialog import VariablesFilterDialog 1560 from .VariablesFilterDialog import VariablesFilterDialog
1545 dlg = VariablesFilterDialog(self.ui, 'Filter Dialog', True) 1561 dlg = VariablesFilterDialog(self.ui, 'Filter Dialog', True)
1546 dlg.setSelection(self.__localsVarFilterList, 1562 dlg.setSelection(self.__localsVarFilterList,
1547 self.__globalsVarFilterList) 1563 self.__globalsVarFilterList)
1548 if dlg.exec() == QDialog.Accepted: 1564 if dlg.exec() == QDialog.DialogCode.Accepted:
1549 self.__localsVarFilterList, self.__globalsVarFilterList = ( 1565 self.__localsVarFilterList, self.__globalsVarFilterList = (
1550 dlg.getSelection() 1566 dlg.getSelection()
1551 ) 1567 )
1552 self.debugViewer.setVariablesFilter( 1568 self.debugViewer.setVariablesFilter(
1553 self.__globalsVarFilterList, self.__localsVarFilterList) 1569 self.__globalsVarFilterList, self.__localsVarFilterList)
1556 """ 1572 """
1557 Private slot for displaying the exception filter dialog. 1573 Private slot for displaying the exception filter dialog.
1558 """ 1574 """
1559 from .ExceptionsFilterDialog import ExceptionsFilterDialog 1575 from .ExceptionsFilterDialog import ExceptionsFilterDialog
1560 dlg = ExceptionsFilterDialog(self.excList, ignore=False) 1576 dlg = ExceptionsFilterDialog(self.excList, ignore=False)
1561 if dlg.exec() == QDialog.Accepted: 1577 if dlg.exec() == QDialog.DialogCode.Accepted:
1562 self.excList = dlg.getExceptionsList()[:] # keep a copy 1578 self.excList = dlg.getExceptionsList()[:] # keep a copy
1563 1579
1564 def __configureIgnoredExceptions(self): 1580 def __configureIgnoredExceptions(self):
1565 """ 1581 """
1566 Private slot for displaying the ignored exceptions dialog. 1582 Private slot for displaying the ignored exceptions dialog.
1567 """ 1583 """
1568 from .ExceptionsFilterDialog import ExceptionsFilterDialog 1584 from .ExceptionsFilterDialog import ExceptionsFilterDialog
1569 dlg = ExceptionsFilterDialog(self.excIgnoreList, ignore=True) 1585 dlg = ExceptionsFilterDialog(self.excIgnoreList, ignore=True)
1570 if dlg.exec() == QDialog.Accepted: 1586 if dlg.exec() == QDialog.DialogCode.Accepted:
1571 self.excIgnoreList = dlg.getExceptionsList()[:] # keep a copy 1587 self.excIgnoreList = dlg.getExceptionsList()[:] # keep a copy
1572 1588
1573 def __toggleBreakpoint(self): 1589 def __toggleBreakpoint(self):
1574 """ 1590 """
1575 Private slot to handle the 'Set/Reset breakpoint' action. 1591 Private slot to handle the 'Set/Reset breakpoint' action.
1686 else: 1702 else:
1687 cap = self.tr("Coverage of Script") 1703 cap = self.tr("Coverage of Script")
1688 dlg = StartDialog( 1704 dlg = StartDialog(
1689 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory, 1705 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory,
1690 self.envHistory, self.exceptions, self.ui, 2, 1706 self.envHistory, self.exceptions, self.ui, 2,
1691 autoClearShell=self.autoClearShell) 1707 autoClearShell=self.autoClearShell,
1692 if dlg.exec() == QDialog.Accepted: 1708 configOverride=self.overrideGlobalConfig)
1709 if dlg.exec() == QDialog.DialogCode.Accepted:
1693 (lastUsedVenvName, argv, wd, env, exceptions, clearShell, 1710 (lastUsedVenvName, argv, wd, env, exceptions, clearShell,
1694 console) = dlg.getData() 1711 console) = dlg.getData()
1712 configOverride = dlg.getGlobalOverrideData()
1695 eraseCoverage = dlg.getCoverageData() 1713 eraseCoverage = dlg.getCoverageData()
1696 1714
1697 if runProject: 1715 if runProject:
1698 fn = self.project.getMainScript(True) 1716 fn = self.project.getMainScript(True)
1699 if fn is None: 1717 if fn is None:
1712 doNotStart = True 1730 doNotStart = True
1713 1731
1714 # save the info for later use 1732 # save the info for later use
1715 self.project.setDbgInfo( 1733 self.project.setDbgInfo(
1716 lastUsedVenvName, argv, wd, env, exceptions, self.excList, 1734 lastUsedVenvName, argv, wd, env, exceptions, self.excList,
1717 self.excIgnoreList, clearShell 1735 self.excIgnoreList, clearShell,
1736 configOverride=configOverride
1718 ) 1737 )
1719 1738
1720 self.lastStartAction = 6 1739 self.lastStartAction = 6
1721 self.clientType = self.project.getProjectLanguage() 1740 self.clientType = self.project.getProjectLanguage()
1722 else: 1741 else:
1758 self.autoClearShell = clearShell 1777 self.autoClearShell = clearShell
1759 1778
1760 # Save the run in console flag 1779 # Save the run in console flag
1761 self.runInConsole = console 1780 self.runInConsole = console
1762 1781
1782 # Save the global config override data
1783 self.overrideGlobalConfig = copy.deepcopy(configOverride)
1784
1763 # Hide all error highlights 1785 # Hide all error highlights
1764 self.viewmanager.unhighlight() 1786 self.viewmanager.unhighlight()
1765 1787
1766 if not doNotStart: 1788 if not doNotStart:
1767 if runProject and self.project.getProjectType() in [ 1789 if runProject and self.project.getProjectType() in [
1774 # Ask the client to open the new program. 1796 # Ask the client to open the new program.
1775 self.debugServer.remoteCoverage( 1797 self.debugServer.remoteCoverage(
1776 lastUsedVenvName, fn, argv, wd, env, 1798 lastUsedVenvName, fn, argv, wd, env,
1777 autoClearShell=self.autoClearShell, erase=eraseCoverage, 1799 autoClearShell=self.autoClearShell, erase=eraseCoverage,
1778 forProject=runProject, runInConsole=console, 1800 forProject=runProject, runInConsole=console,
1779 clientType=self.clientType) 1801 clientType=self.clientType,
1802 configOverride=self.overrideGlobalConfig)
1780 1803
1781 self.stopAct.setEnabled(True) 1804 self.stopAct.setEnabled(True)
1782 1805
1783 if dlg.clearHistories(): 1806 if dlg.clearHistories():
1784 self.setArgvHistory("", clearHistories=True) 1807 self.setArgvHistory("", clearHistories=True)
1823 else: 1846 else:
1824 cap = self.tr("Profile of Script") 1847 cap = self.tr("Profile of Script")
1825 dlg = StartDialog( 1848 dlg = StartDialog(
1826 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory, 1849 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory,
1827 self.envHistory, self.exceptions, self.ui, 3, 1850 self.envHistory, self.exceptions, self.ui, 3,
1828 autoClearShell=self.autoClearShell) 1851 autoClearShell=self.autoClearShell,
1829 if dlg.exec() == QDialog.Accepted: 1852 configOverride=self.overrideGlobalConfig)
1853 if dlg.exec() == QDialog.DialogCode.Accepted:
1830 (lastUsedVenvName, argv, wd, env, exceptions, clearShell, 1854 (lastUsedVenvName, argv, wd, env, exceptions, clearShell,
1831 console) = dlg.getData() 1855 console) = dlg.getData()
1856 configOverride = dlg.getGlobalOverrideData()
1832 eraseTimings = dlg.getProfilingData() 1857 eraseTimings = dlg.getProfilingData()
1833 1858
1834 if runProject: 1859 if runProject:
1835 fn = self.project.getMainScript(True) 1860 fn = self.project.getMainScript(True)
1836 if fn is None: 1861 if fn is None:
1849 doNotStart = True 1874 doNotStart = True
1850 1875
1851 # save the info for later use 1876 # save the info for later use
1852 self.project.setDbgInfo( 1877 self.project.setDbgInfo(
1853 lastUsedVenvName, argv, wd, env, exceptions, self.excList, 1878 lastUsedVenvName, argv, wd, env, exceptions, self.excList,
1854 self.excIgnoreList, clearShell 1879 self.excIgnoreList, clearShell,
1880 configOverride=configOverride
1855 ) 1881 )
1856 1882
1857 self.lastStartAction = 8 1883 self.lastStartAction = 8
1858 self.clientType = self.project.getProjectLanguage() 1884 self.clientType = self.project.getProjectLanguage()
1859 else: 1885 else:
1895 self.autoClearShell = clearShell 1921 self.autoClearShell = clearShell
1896 1922
1897 # Save the run in console flag 1923 # Save the run in console flag
1898 self.runInConsole = console 1924 self.runInConsole = console
1899 1925
1926 # Save the global config override data
1927 self.overrideGlobalConfig = copy.deepcopy(configOverride)
1928
1900 # Hide all error highlights 1929 # Hide all error highlights
1901 self.viewmanager.unhighlight() 1930 self.viewmanager.unhighlight()
1902 1931
1903 if not doNotStart: 1932 if not doNotStart:
1904 if runProject and self.project.getProjectType() in [ 1933 if runProject and self.project.getProjectType() in [
1911 # Ask the client to open the new program. 1940 # Ask the client to open the new program.
1912 self.debugServer.remoteProfile( 1941 self.debugServer.remoteProfile(
1913 lastUsedVenvName, fn, argv, wd, env, 1942 lastUsedVenvName, fn, argv, wd, env,
1914 autoClearShell=self.autoClearShell, erase=eraseTimings, 1943 autoClearShell=self.autoClearShell, erase=eraseTimings,
1915 forProject=runProject, runInConsole=console, 1944 forProject=runProject, runInConsole=console,
1916 clientType=self.clientType) 1945 clientType=self.clientType,
1946 configOverride=self.overrideGlobalConfig)
1917 1947
1918 self.stopAct.setEnabled(True) 1948 self.stopAct.setEnabled(True)
1919 1949
1920 if dlg.clearHistories(): 1950 if dlg.clearHistories():
1921 self.setArgvHistory("", clearHistories=True) 1951 self.setArgvHistory("", clearHistories=True)
1960 else: 1990 else:
1961 cap = self.tr("Run Script") 1991 cap = self.tr("Run Script")
1962 dlg = StartDialog( 1992 dlg = StartDialog(
1963 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory, 1993 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory,
1964 self.envHistory, self.exceptions, self.ui, 1, 1994 self.envHistory, self.exceptions, self.ui, 1,
1965 autoClearShell=self.autoClearShell) 1995 autoClearShell=self.autoClearShell,
1966 if dlg.exec() == QDialog.Accepted: 1996 configOverride=self.overrideGlobalConfig)
1997 if dlg.exec() == QDialog.DialogCode.Accepted:
1967 (lastUsedVenvName, argv, wd, env, exceptions, clearShell, 1998 (lastUsedVenvName, argv, wd, env, exceptions, clearShell,
1968 console) = dlg.getData() 1999 console) = dlg.getData()
2000 configOverride = dlg.getGlobalOverrideData()
1969 2001
1970 if runProject: 2002 if runProject:
1971 fn = self.project.getMainScript(True) 2003 fn = self.project.getMainScript(True)
1972 if fn is None: 2004 if fn is None:
1973 E5MessageBox.critical( 2005 E5MessageBox.critical(
1985 doNotStart = True 2017 doNotStart = True
1986 2018
1987 # save the info for later use 2019 # save the info for later use
1988 self.project.setDbgInfo( 2020 self.project.setDbgInfo(
1989 lastUsedVenvName, argv, wd, env, exceptions, self.excList, 2021 lastUsedVenvName, argv, wd, env, exceptions, self.excList,
1990 self.excIgnoreList, clearShell 2022 self.excIgnoreList, clearShell,
2023 configOverride=configOverride
1991 ) 2024 )
1992 2025
1993 self.lastStartAction = 4 2026 self.lastStartAction = 4
1994 self.clientType = self.project.getProjectLanguage() 2027 self.clientType = self.project.getProjectLanguage()
1995 else: 2028 else:
2029 self.autoClearShell = clearShell 2062 self.autoClearShell = clearShell
2030 2063
2031 # Save the run in console flag 2064 # Save the run in console flag
2032 self.runInConsole = console 2065 self.runInConsole = console
2033 2066
2067 # Save the global config override data
2068 self.overrideGlobalConfig = copy.deepcopy(configOverride)
2069
2034 # Hide all error highlights 2070 # Hide all error highlights
2035 self.viewmanager.unhighlight() 2071 self.viewmanager.unhighlight()
2036 2072
2037 if not doNotStart: 2073 if not doNotStart:
2038 if runProject and self.project.getProjectType() in [ 2074 if runProject and self.project.getProjectType() in [
2044 2080
2045 # Ask the client to open the new program. 2081 # Ask the client to open the new program.
2046 self.debugServer.remoteRun( 2082 self.debugServer.remoteRun(
2047 lastUsedVenvName, fn, argv, wd, env, 2083 lastUsedVenvName, fn, argv, wd, env,
2048 autoClearShell=self.autoClearShell, forProject=runProject, 2084 autoClearShell=self.autoClearShell, forProject=runProject,
2049 runInConsole=console, clientType=self.clientType) 2085 runInConsole=console, clientType=self.clientType,
2086 configOverride=self.overrideGlobalConfig)
2050 2087
2051 self.stopAct.setEnabled(True) 2088 self.stopAct.setEnabled(True)
2052 2089
2053 if dlg.clearHistories(): 2090 if dlg.clearHistories():
2054 self.setArgvHistory("", clearHistories=True) 2091 self.setArgvHistory("", clearHistories=True)
2096 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory, 2133 cap, self.lastUsedVenvName, self.argvHistory, self.wdHistory,
2097 self.envHistory, self.exceptions, self.ui, 0, 2134 self.envHistory, self.exceptions, self.ui, 0,
2098 tracePython=self.tracePython, autoClearShell=self.autoClearShell, 2135 tracePython=self.tracePython, autoClearShell=self.autoClearShell,
2099 autoContinue=self.autoContinue, 2136 autoContinue=self.autoContinue,
2100 enableMultiprocess=self.enableMultiprocess, 2137 enableMultiprocess=self.enableMultiprocess,
2101 multiprocessNoDebugHistory=self.multiprocessNoDebugHistory) 2138 multiprocessNoDebugHistory=self.multiprocessNoDebugHistory,
2102 if dlg.exec() == QDialog.Accepted: 2139 configOverride=self.overrideGlobalConfig)
2140 if dlg.exec() == QDialog.DialogCode.Accepted:
2103 (lastUsedVenvName, argv, wd, env, exceptions, clearShell, 2141 (lastUsedVenvName, argv, wd, env, exceptions, clearShell,
2104 console) = dlg.getData() 2142 console) = dlg.getData()
2143 configOverride = dlg.getGlobalOverrideData()
2105 (tracePython, autoContinue, enableMultiprocess, 2144 (tracePython, autoContinue, enableMultiprocess,
2106 multiprocessNoDebug) = dlg.getDebugData() 2145 multiprocessNoDebug) = dlg.getDebugData()
2107 2146
2108 if debugProject: 2147 if debugProject:
2109 fn = self.project.getMainScript(True) 2148 fn = self.project.getMainScript(True)
2126 self.project.setDbgInfo( 2165 self.project.setDbgInfo(
2127 lastUsedVenvName, argv, wd, env, exceptions, self.excList, 2166 lastUsedVenvName, argv, wd, env, exceptions, self.excList,
2128 self.excIgnoreList, clearShell, tracePython=tracePython, 2167 self.excIgnoreList, clearShell, tracePython=tracePython,
2129 autoContinue=autoContinue, 2168 autoContinue=autoContinue,
2130 enableMultiprocess=enableMultiprocess, 2169 enableMultiprocess=enableMultiprocess,
2131 multiprocessNoDebug=multiprocessNoDebug 2170 multiprocessNoDebug=multiprocessNoDebug,
2171 configOverride=configOverride
2132 ) 2172 )
2133 2173
2134 self.lastStartAction = 2 2174 self.lastStartAction = 2
2135 self.clientType = self.project.getProjectLanguage() 2175 self.clientType = self.project.getProjectLanguage()
2136 else: 2176 else:
2179 2219
2180 # Save the multiprocess debugging data 2220 # Save the multiprocess debugging data
2181 self.enableMultiprocess = enableMultiprocess 2221 self.enableMultiprocess = enableMultiprocess
2182 self.setMultiprocessNoDebugHistory(multiprocessNoDebug) 2222 self.setMultiprocessNoDebugHistory(multiprocessNoDebug)
2183 2223
2224 # Save the global config override data
2225 self.overrideGlobalConfig = copy.deepcopy(configOverride)
2226
2184 # Hide all error highlights 2227 # Hide all error highlights
2185 self.viewmanager.unhighlight() 2228 self.viewmanager.unhighlight()
2186 2229
2187 if not doNotStart: 2230 if not doNotStart:
2188 if debugProject and self.project.getProjectType() in [ 2231 if debugProject and self.project.getProjectType() in [
2205 tracePython=tracePython, 2248 tracePython=tracePython,
2206 autoContinue=autoContinue, forProject=debugProject, 2249 autoContinue=autoContinue, forProject=debugProject,
2207 runInConsole=console, clientType=self.clientType, 2250 runInConsole=console, clientType=self.clientType,
2208 enableCallTrace=enableCallTrace, 2251 enableCallTrace=enableCallTrace,
2209 enableMultiprocess=enableMultiprocess, 2252 enableMultiprocess=enableMultiprocess,
2210 multiprocessNoDebug=multiprocessNoDebug) 2253 multiprocessNoDebug=multiprocessNoDebug,
2254 configOverride=self.overrideGlobalConfig)
2211 2255
2212 if ( 2256 if (
2213 self.debugServer.isClientProcessUp() and 2257 self.debugServer.isClientProcessUp() and
2214 self.debugServer.getClientType() == self.clientType 2258 self.debugServer.getClientType() == self.clientType
2215 ): 2259 ):
2294 forProject=forProject, 2338 forProject=forProject,
2295 runInConsole=self.runInConsole, 2339 runInConsole=self.runInConsole,
2296 clientType=self.clientType, 2340 clientType=self.clientType,
2297 enableCallTrace=enableCallTrace, 2341 enableCallTrace=enableCallTrace,
2298 enableMultiprocess=self.enableMultiprocess, 2342 enableMultiprocess=self.enableMultiprocess,
2299 multiprocessNoDebug=multiprocessNoDebug) 2343 multiprocessNoDebug=multiprocessNoDebug,
2344 configOverride=self.overrideGlobalConfig)
2300 2345
2301 # Signal that we have started a debugging session 2346 # Signal that we have started a debugging session
2302 self.debuggingStarted.emit(fn) 2347 self.debuggingStarted.emit(fn)
2303 2348
2304 elif self.lastStartAction in [3, 4]: 2349 elif self.lastStartAction in [3, 4]:
2306 self.debugServer.remoteRun( 2351 self.debugServer.remoteRun(
2307 venvName, fn, argv, wd, env, 2352 venvName, fn, argv, wd, env,
2308 autoClearShell=self.autoClearShell, 2353 autoClearShell=self.autoClearShell,
2309 forProject=forProject, 2354 forProject=forProject,
2310 runInConsole=self.runInConsole, 2355 runInConsole=self.runInConsole,
2311 clientType=self.clientType) 2356 clientType=self.clientType,
2357 configOverride=self.overrideGlobalConfig)
2312 2358
2313 elif self.lastStartAction in [5, 6]: 2359 elif self.lastStartAction in [5, 6]:
2314 # Ask the client to coverage run the new program. 2360 # Ask the client to coverage run the new program.
2315 self.debugServer.remoteCoverage( 2361 self.debugServer.remoteCoverage(
2316 venvName, fn, argv, wd, env, 2362 venvName, fn, argv, wd, env,
2317 autoClearShell=self.autoClearShell, 2363 autoClearShell=self.autoClearShell,
2318 erase=self.eraseCoverage, 2364 erase=self.eraseCoverage,
2319 forProject=forProject, 2365 forProject=forProject,
2320 runInConsole=self.runInConsole, 2366 runInConsole=self.runInConsole,
2321 clientType=self.clientType) 2367 clientType=self.clientType,
2368 configOverride=self.overrideGlobalConfig)
2322 2369
2323 elif self.lastStartAction in [7, 8]: 2370 elif self.lastStartAction in [7, 8]:
2324 # Ask the client to profile run the new program. 2371 # Ask the client to profile run the new program.
2325 self.debugServer.remoteProfile( 2372 self.debugServer.remoteProfile(
2326 venvName, fn, argv, wd, env, 2373 venvName, fn, argv, wd, env,
2327 autoClearShell=self.autoClearShell, 2374 autoClearShell=self.autoClearShell,
2328 erase=self.eraseTimings, 2375 erase=self.eraseTimings,
2329 forProject=forProject, 2376 forProject=forProject,
2330 runInConsole=self.runInConsole, 2377 runInConsole=self.runInConsole,
2331 clientType=self.clientType) 2378 clientType=self.clientType,
2379 configOverride=self.overrideGlobalConfig)
2332 2380
2333 self.stopAct.setEnabled(True) 2381 self.stopAct.setEnabled(True)
2334 2382
2335 def __stopScript(self): 2383 def __stopScript(self):
2336 """ 2384 """
2562 @param enableMultiprocess flag indicating, that the debugger should be 2610 @param enableMultiprocess flag indicating, that the debugger should be
2563 run in multi process mode 2611 run in multi process mode
2564 @type bool 2612 @type bool
2565 """ 2613 """
2566 self.enableMultiprocess = enableMultiprocess 2614 self.enableMultiprocess = enableMultiprocess
2615
2616 def setEnableGlobalConfigOverride(self, overrideData):
2617 """
2618 Public method to initialize the global config override data.
2619
2620 @param overrideData dictionary containing a flag indicating to enable
2621 global config override and a flag indicating to redirect
2622 stdin/stdout/stderr
2623 @type dict
2624 """
2625 self.overrideGlobalConfig = copy.deepcopy(overrideData)

eric ide

mercurial