Debugger/DebugUI.py

changeset 795
917f1945355c
parent 791
9ec2ac20e54e
child 816
53e282890577
equal deleted inserted replaced
794:e338e1e8f3ca 795:917f1945355c
102 102
103 self.evalHistory = [] 103 self.evalHistory = []
104 self.execHistory = [] 104 self.execHistory = []
105 self.lastDebuggedFile = None 105 self.lastDebuggedFile = None
106 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project 106 self.lastStartAction = 0 # 0=None, 1=Script, 2=Project
107 self.clientType = ""
107 self.lastAction = -1 108 self.lastAction = -1
108 self.debugActions = [self.__continue, self.__step,\ 109 self.debugActions = [self.__continue, self.__step,\
109 self.__stepOver, self.__stepOut,\ 110 self.__stepOver, self.__stepOut,\
110 self.__stepQuit, self.__runToCursor] 111 self.__stepQuit, self.__runToCursor]
111 self.localsVarFilter, self.globalsVarFilter = Preferences.getVarFilters() 112 self.localsVarFilter, self.globalsVarFilter = Preferences.getVarFilters()
744 self.lastAction = -1 745 self.lastAction = -1
745 if not self.projectOpen: 746 if not self.projectOpen:
746 self.restartAct.setEnabled(False) 747 self.restartAct.setEnabled(False)
747 self.lastDebuggedFile = None 748 self.lastDebuggedFile = None
748 self.lastStartAction = 0 749 self.lastStartAction = 0
750 self.clientType = ""
749 751
750 def __checkActions(self, editor): 752 def __checkActions(self, editor):
751 """ 753 """
752 Private slot to check some actions for their enable/disable status. 754 Private slot to check some actions for their enable/disable status.
753 755
842 844
843 if not self.editorOpen: 845 if not self.editorOpen:
844 self.restartAct.setEnabled(False) 846 self.restartAct.setEnabled(False)
845 self.lastDebuggedFile = None 847 self.lastDebuggedFile = None
846 self.lastStartAction = 0 848 self.lastStartAction = 0
849 self.clientType = ""
847 850
848 def shutdown(self): 851 def shutdown(self):
849 """ 852 """
850 Public method to perform shutdown actions. 853 Public method to perform shutdown actions.
851 """ 854 """
1374 # save the info for later use 1377 # save the info for later use
1375 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1378 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1376 self.excIgnoreList, clearShell) 1379 self.excIgnoreList, clearShell)
1377 1380
1378 self.lastStartAction = 6 1381 self.lastStartAction = 6
1382 self.clientType = ""
1379 else: 1383 else:
1380 editor = self.viewmanager.activeWindow() 1384 editor = self.viewmanager.activeWindow()
1381 if editor is None: 1385 if editor is None:
1382 return 1386 return
1383 1387
1386 editor.getFileName() is None: 1390 editor.getFileName() is None:
1387 return 1391 return
1388 1392
1389 fn = editor.getFileName() 1393 fn = editor.getFileName()
1390 self.lastStartAction = 5 1394 self.lastStartAction = 5
1395 self.clientType = editor.getFileTypeByFlag()
1391 1396
1392 # save the filename for use by the restart method 1397 # save the filename for use by the restart method
1393 self.lastDebuggedFile = fn 1398 self.lastDebuggedFile = fn
1394 self.restartAct.setEnabled(True) 1399 self.restartAct.setEnabled(True)
1395 1400
1420 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1425 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1421 1426
1422 # Ask the client to open the new program. 1427 # Ask the client to open the new program.
1423 self.debugServer.remoteCoverage(fn, argv, wd, env, 1428 self.debugServer.remoteCoverage(fn, argv, wd, env,
1424 autoClearShell = self.autoClearShell, erase = eraseCoverage, 1429 autoClearShell = self.autoClearShell, erase = eraseCoverage,
1425 forProject = runProject, runInConsole = console) 1430 forProject = runProject, runInConsole = console,
1431 clientType = self.clientType)
1426 1432
1427 self.stopAct.setEnabled(True) 1433 self.stopAct.setEnabled(True)
1428 1434
1429 def __profileScript(self): 1435 def __profileScript(self):
1430 """ 1436 """
1478 # save the info for later use 1484 # save the info for later use
1479 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1485 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1480 self.excIgnoreList, clearShell) 1486 self.excIgnoreList, clearShell)
1481 1487
1482 self.lastStartAction = 8 1488 self.lastStartAction = 8
1489 self.clientType = ""
1483 else: 1490 else:
1484 editor = self.viewmanager.activeWindow() 1491 editor = self.viewmanager.activeWindow()
1485 if editor is None: 1492 if editor is None:
1486 return 1493 return
1487 1494
1490 editor.getFileName() is None: 1497 editor.getFileName() is None:
1491 return 1498 return
1492 1499
1493 fn = editor.getFileName() 1500 fn = editor.getFileName()
1494 self.lastStartAction = 7 1501 self.lastStartAction = 7
1502 self.clientType = editor.getFileTypeByFlag()
1495 1503
1496 # save the filename for use by the restart method 1504 # save the filename for use by the restart method
1497 self.lastDebuggedFile = fn 1505 self.lastDebuggedFile = fn
1498 self.restartAct.setEnabled(True) 1506 self.restartAct.setEnabled(True)
1499 1507
1524 fn = os.path.join(getConfig('ericDir'), "eric5.py") 1532 fn = os.path.join(getConfig('ericDir'), "eric5.py")
1525 1533
1526 # Ask the client to open the new program. 1534 # Ask the client to open the new program.
1527 self.debugServer.remoteProfile(fn, argv, wd, env, 1535 self.debugServer.remoteProfile(fn, argv, wd, env,
1528 autoClearShell = self.autoClearShell, erase = eraseTimings, 1536 autoClearShell = self.autoClearShell, erase = eraseTimings,
1529 forProject = runProject, runInConsole = console) 1537 forProject = runProject, runInConsole = console,
1538 clientType = self.clientType)
1530 1539
1531 self.stopAct.setEnabled(True) 1540 self.stopAct.setEnabled(True)
1532 1541
1533 def __runScript(self): 1542 def __runScript(self):
1534 """ 1543 """
1584 # save the info for later use 1593 # save the info for later use
1585 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1594 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1586 self.excIgnoreList, clearShell) 1595 self.excIgnoreList, clearShell)
1587 1596
1588 self.lastStartAction = 4 1597 self.lastStartAction = 4
1598 self.clientType = ""
1589 else: 1599 else:
1590 editor = self.viewmanager.activeWindow() 1600 editor = self.viewmanager.activeWindow()
1591 if editor is None: 1601 if editor is None:
1592 return 1602 return
1593 1603
1596 editor.getFileName() is None: 1606 editor.getFileName() is None:
1597 return 1607 return
1598 1608
1599 fn = editor.getFileName() 1609 fn = editor.getFileName()
1600 self.lastStartAction = 3 1610 self.lastStartAction = 3
1611 self.clientType = editor.getFileTypeByFlag()
1601 1612
1602 # save the filename for use by the restart method 1613 # save the filename for use by the restart method
1603 self.lastDebuggedFile = fn 1614 self.lastDebuggedFile = fn
1604 self.restartAct.setEnabled(True) 1615 self.restartAct.setEnabled(True)
1605 1616
1632 1643
1633 # Ask the client to open the new program. 1644 # Ask the client to open the new program.
1634 self.debugServer.remoteRun(fn, argv, wd, env, 1645 self.debugServer.remoteRun(fn, argv, wd, env,
1635 autoClearShell = self.autoClearShell, forProject = runProject, 1646 autoClearShell = self.autoClearShell, forProject = runProject,
1636 runInConsole = console, autoFork = forkAutomatically, 1647 runInConsole = console, autoFork = forkAutomatically,
1637 forkChild = forkIntoChild) 1648 forkChild = forkIntoChild, clientType = self.clientType)
1638 1649
1639 self.stopAct.setEnabled(True) 1650 self.stopAct.setEnabled(True)
1640 1651
1641 def __debugScript(self): 1652 def __debugScript(self):
1642 """ 1653 """
1693 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList, 1704 self.project.setDbgInfo(argv, wd, env, exceptions, self.excList,
1694 self.excIgnoreList, clearShell, tracePython = tracePython, 1705 self.excIgnoreList, clearShell, tracePython = tracePython,
1695 autoContinue = self.autoContinue) 1706 autoContinue = self.autoContinue)
1696 1707
1697 self.lastStartAction = 2 1708 self.lastStartAction = 2
1709 self.clientType = ""
1698 else: 1710 else:
1699 editor = self.viewmanager.activeWindow() 1711 editor = self.viewmanager.activeWindow()
1700 if editor is None: 1712 if editor is None:
1701 return 1713 return
1702 1714
1705 editor.getFileName() is None: 1717 editor.getFileName() is None:
1706 return 1718 return
1707 1719
1708 fn = editor.getFileName() 1720 fn = editor.getFileName()
1709 self.lastStartAction = 1 1721 self.lastStartAction = 1
1710 1722 self.clientType = editor.getFileTypeByFlag()
1723
1711 # save the filename for use by the restart method 1724 # save the filename for use by the restart method
1712 self.lastDebuggedFile = fn 1725 self.lastDebuggedFile = fn
1713 self.restartAct.setEnabled(True) 1726 self.restartAct.setEnabled(True)
1714 1727
1715 # This moves any previous occurrence of these arguments to the head 1728 # This moves any previous occurrence of these arguments to the head
1749 # Ask the client to open the new program. 1762 # Ask the client to open the new program.
1750 self.debugServer.remoteLoad(fn, argv, wd, env, 1763 self.debugServer.remoteLoad(fn, argv, wd, env,
1751 autoClearShell = self.autoClearShell, tracePython = tracePython, 1764 autoClearShell = self.autoClearShell, tracePython = tracePython,
1752 autoContinue = autoContinue, forProject = debugProject, 1765 autoContinue = autoContinue, forProject = debugProject,
1753 runInConsole = console, autoFork = forkAutomatically, 1766 runInConsole = console, autoFork = forkAutomatically,
1754 forkChild = forkIntoChild) 1767 forkChild = forkIntoChild, clientType = self.clientType)
1755 1768
1756 # Signal that we have started a debugging session 1769 # Signal that we have started a debugging session
1757 self.debuggingStarted.emit(fn) 1770 self.debuggingStarted.emit(fn)
1758 1771
1759 self.stopAct.setEnabled(True) 1772 self.stopAct.setEnabled(True)
1800 # Ask the client to debug the new program. 1813 # Ask the client to debug the new program.
1801 self.debugServer.remoteLoad(fn, argv, wd, env, 1814 self.debugServer.remoteLoad(fn, argv, wd, env,
1802 autoClearShell = self.autoClearShell, tracePython = self.tracePython, 1815 autoClearShell = self.autoClearShell, tracePython = self.tracePython,
1803 autoContinue = self.autoContinue, forProject = forProject, 1816 autoContinue = self.autoContinue, forProject = forProject,
1804 runInConsole = self.runInConsole, autoFork = self.forkAutomatically, 1817 runInConsole = self.runInConsole, autoFork = self.forkAutomatically,
1805 forkChild = self.forkIntoChild) 1818 forkChild = self.forkIntoChild, clientType = self.clientType)
1806 1819
1807 # Signal that we have started a debugging session 1820 # Signal that we have started a debugging session
1808 self.debuggingStarted.emit(fn) 1821 self.debuggingStarted.emit(fn)
1809 1822
1810 elif self.lastStartAction in [3, 4]: 1823 elif self.lastStartAction in [3, 4]:
1811 # Ask the client to run the new program. 1824 # Ask the client to run the new program.
1812 self.debugServer.remoteRun(fn, argv, wd, env, 1825 self.debugServer.remoteRun(fn, argv, wd, env,
1813 autoClearShell = self.autoClearShell, forProject = forProject, 1826 autoClearShell = self.autoClearShell, forProject = forProject,
1814 runInConsole = self.runInConsole, autoFork = self.forkAutomatically, 1827 runInConsole = self.runInConsole, autoFork = self.forkAutomatically,
1815 forkChild = self.forkIntoChild) 1828 forkChild = self.forkIntoChild, clientType = self.clientType)
1816 1829
1817 elif self.lastStartAction in [5, 6]: 1830 elif self.lastStartAction in [5, 6]:
1818 # Ask the client to coverage run the new program. 1831 # Ask the client to coverage run the new program.
1819 self.debugServer.remoteCoverage(fn, argv, wd, env, 1832 self.debugServer.remoteCoverage(fn, argv, wd, env,
1820 autoClearShell = self.autoClearShell, erase = self.eraseCoverage, 1833 autoClearShell = self.autoClearShell, erase = self.eraseCoverage,
1821 forProject = forProject, runInConsole = self.runInConsole) 1834 forProject = forProject, runInConsole = self.runInConsole,
1835 clientType = self.clientType)
1822 1836
1823 elif self.lastStartAction in [7, 8]: 1837 elif self.lastStartAction in [7, 8]:
1824 # Ask the client to profile run the new program. 1838 # Ask the client to profile run the new program.
1825 self.debugServer.remoteProfile(fn, argv, wd, env, 1839 self.debugServer.remoteProfile(fn, argv, wd, env,
1826 autoClearShell = self.autoClearShell, erase = self.eraseTimings, 1840 autoClearShell = self.autoClearShell, erase = self.eraseTimings,
1827 forProject = forProject, runInConsole = self.runInConsole) 1841 forProject = forProject, runInConsole = self.runInConsole,
1842 clientType = self.clientType)
1828 1843
1829 self.stopAct.setEnabled(True) 1844 self.stopAct.setEnabled(True)
1830 1845
1831 def __stopScript(self): 1846 def __stopScript(self):
1832 """ 1847 """

eric ide

mercurial