972 self.debugProjectAct.setEnabled(self.projectOpen) |
972 self.debugProjectAct.setEnabled(self.projectOpen) |
973 self.runProjectAct.setEnabled(self.projectOpen) |
973 self.runProjectAct.setEnabled(self.projectOpen) |
974 self.profileProjectAct.setEnabled(self.projectOpen) |
974 self.profileProjectAct.setEnabled(self.projectOpen) |
975 self.coverageProjectAct.setEnabled(self.projectOpen) |
975 self.coverageProjectAct.setEnabled(self.projectOpen) |
976 if self.lastDebuggedFile is not None and \ |
976 if self.lastDebuggedFile is not None and \ |
977 (self.editorOpen or self.projectOpen): |
977 (self.editorOpen or self.projectOpen): |
978 self.restartAct.setEnabled(True) |
978 self.restartAct.setEnabled(True) |
979 else: |
979 else: |
980 self.restartAct.setEnabled(False) |
980 self.restartAct.setEnabled(False) |
981 self.stopAct.setEnabled(False) |
981 self.stopAct.setEnabled(False) |
982 self.resetUI.emit() |
982 self.resetUI.emit() |
1027 msg = self.trUtf8('The program has terminated with an exit' |
1027 msg = self.trUtf8('The program has terminated with an exit' |
1028 ' status of {0}.').format(status) |
1028 ' status of {0}.').format(status) |
1029 else: |
1029 else: |
1030 msg = self.trUtf8('"{0}" has terminated with an exit' |
1030 msg = self.trUtf8('"{0}" has terminated with an exit' |
1031 ' status of {1}.')\ |
1031 ' status of {1}.')\ |
1032 .format(os.path.basename(self.ui.currentProg), |
1032 .format(os.path.basename(self.ui.currentProg), |
1033 status) |
1033 status) |
1034 self.ui.showNotification( |
1034 self.ui.showNotification( |
1035 UI.PixmapCache.getPixmap("debug48.png"), |
1035 UI.PixmapCache.getPixmap("debug48.png"), |
1036 self.trUtf8("Program terminated"), msg) |
1036 self.trUtf8("Program terminated"), msg) |
1037 else: |
1037 else: |
1038 if self.ui.currentProg is None: |
1038 if self.ui.currentProg is None: |
1103 self.ui, Program, |
1103 self.ui, Program, |
1104 self.trUtf8('An unhandled exception occured.' |
1104 self.trUtf8('An unhandled exception occured.' |
1105 ' See the shell window for details.')) |
1105 ' See the shell window for details.')) |
1106 return |
1106 return |
1107 |
1107 |
1108 if (self.exceptions and \ |
1108 if (self.exceptions and |
1109 exceptionType not in self.excIgnoreList and \ |
1109 exceptionType not in self.excIgnoreList and |
1110 (not len(self.excList) or \ |
1110 (not len(self.excList) or |
1111 (len(self.excList) and exceptionType in self.excList)))\ |
1111 (len(self.excList) and exceptionType in self.excList)))\ |
1112 or exceptionType.startswith('unhandled'): |
1112 or exceptionType.startswith('unhandled'): |
1113 res = None |
1113 res = None |
1114 if stackTrace: |
1114 if stackTrace: |
1115 try: |
1115 try: |
1130 res = E5MessageBox.Yes |
1130 res = E5MessageBox.Yes |
1131 else: |
1131 else: |
1132 if stackTrace: |
1132 if stackTrace: |
1133 if exceptionType.startswith('unhandled'): |
1133 if exceptionType.startswith('unhandled'): |
1134 buttons = E5MessageBox.StandardButtons( |
1134 buttons = E5MessageBox.StandardButtons( |
1135 E5MessageBox.No | \ |
1135 E5MessageBox.No | |
1136 E5MessageBox.Yes) |
1136 E5MessageBox.Yes) |
1137 else: |
1137 else: |
1138 buttons = E5MessageBox.StandardButtons( |
1138 buttons = E5MessageBox.StandardButtons( |
1139 E5MessageBox.No | \ |
1139 E5MessageBox.No | |
1140 E5MessageBox.Yes | \ |
1140 E5MessageBox.Yes | |
1141 E5MessageBox.Ignore) |
1141 E5MessageBox.Ignore) |
1142 res = E5MessageBox.critical( |
1142 res = E5MessageBox.critical( |
1143 self.ui, Program, |
1143 self.ui, Program, |
1144 self.trUtf8( |
1144 self.trUtf8( |
1145 '<p>The debugged program raised the exception' |
1145 '<p>The debugged program raised the exception' |
1146 ' <b>{0}</b><br>"<b>{1}</b>"<br>' |
1146 ' <b>{0}</b><br>"<b>{1}</b>"<br>' |
1147 'File: <b>{2}</b>, Line: <b>{3}</b></p>' |
1147 'File: <b>{2}</b>, Line: <b>{3}</b></p>' |
1148 '<p>Break here?</p>') |
1148 '<p>Break here?</p>') |
1149 .format( |
1149 .format( |
1150 exceptionType, |
1150 exceptionType, |
1151 Utilities.html_encode(exceptionMessage), |
1151 Utilities.html_encode(exceptionMessage), |
1152 stackTrace[0][0], |
1152 stackTrace[0][0], |
1153 stackTrace[0][1]), |
1153 stackTrace[0][1]), |
1154 buttons, |
1154 buttons, |
1155 E5MessageBox.No) |
1155 E5MessageBox.No) |
1156 else: |
1156 else: |
1157 res = E5MessageBox.critical( |
1157 res = E5MessageBox.critical( |
1158 self.ui, Program, |
1158 self.ui, Program, |
1159 self.trUtf8( |
1159 self.trUtf8( |
1160 '<p>The debugged program raised the exception' |
1160 '<p>The debugged program raised the exception' |
1161 ' <b>{0}</b><br>"<b>{1}</b>"</p>') |
1161 ' <b>{0}</b><br>"<b>{1}</b>"</p>') |
1162 .format( |
1162 .format( |
1163 exceptionType, |
1163 exceptionType, |
1164 Utilities.html_encode(exceptionMessage))) |
1164 Utilities.html_encode(exceptionMessage))) |
1165 if res == E5MessageBox.Yes: |
1165 if res == E5MessageBox.Yes: |
1166 self.exceptionInterrupt.emit() |
1166 self.exceptionInterrupt.emit() |
1167 stack = [] |
1167 stack = [] |
1168 for fn, ln, func, args in stackTrace: |
1168 for fn, ln, func, args in stackTrace: |
1169 stack.append((fn, ln, func, args)) |
1169 stack.append((fn, ln, func, args)) |
1267 E5MessageBox.critical( |
1267 E5MessageBox.critical( |
1268 self.ui, |
1268 self.ui, |
1269 self.trUtf8("Breakpoint Condition Error"), |
1269 self.trUtf8("Breakpoint Condition Error"), |
1270 self.trUtf8( |
1270 self.trUtf8( |
1271 """<p>The condition of the breakpoint <b>{0}, {1}</b>""" |
1271 """<p>The condition of the breakpoint <b>{0}, {1}</b>""" |
1272 """ contains a syntax error.</p>""")\ |
1272 """ contains a syntax error.</p>""") |
1273 .format(filename, lineno)) |
1273 .format(filename, lineno)) |
1274 |
1274 |
1275 model = self.debugServer.getBreakPointModel() |
1275 model = self.debugServer.getBreakPointModel() |
1276 index = model.getBreakPointIndex(filename, lineno) |
1276 index = model.getBreakPointIndex(filename, lineno) |
1277 if not index.isValid(): |
1277 if not index.isValid(): |
1278 return |
1278 return |
1302 """ |
1302 """ |
1303 E5MessageBox.critical( |
1303 E5MessageBox.critical( |
1304 self.ui, |
1304 self.ui, |
1305 self.trUtf8("Watch Expression Error"), |
1305 self.trUtf8("Watch Expression Error"), |
1306 self.trUtf8("""<p>The watch expression <b>{0}</b>""" |
1306 self.trUtf8("""<p>The watch expression <b>{0}</b>""" |
1307 """ contains a syntax error.</p>""")\ |
1307 """ contains a syntax error.</p>""") |
1308 .format(cond)) |
1308 .format(cond)) |
1309 |
1309 |
1310 model = self.debugServer.getWatchPointModel() |
1310 model = self.debugServer.getWatchPointModel() |
1311 index = model.getWatchPointIndex(cond) |
1311 index = model.getWatchPointIndex(cond) |
1312 if not index.isValid(): |
1312 if not index.isValid(): |
1313 return |
1313 return |
1330 idx.internalPointer() != index.internalPointer() |
1330 idx.internalPointer() != index.internalPointer() |
1331 if duplicate: |
1331 if duplicate: |
1332 if not special: |
1332 if not special: |
1333 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" |
1333 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" |
1334 """ already exists.</p>""")\ |
1334 """ already exists.</p>""")\ |
1335 .format(Utilities.html_encode(cond)) |
1335 .format(Utilities.html_encode(cond)) |
1336 else: |
1336 else: |
1337 msg = self.trUtf8( |
1337 msg = self.trUtf8( |
1338 """<p>A watch expression '<b>{0}</b>'""" |
1338 """<p>A watch expression '<b>{0}</b>'""" |
1339 """ for the variable <b>{1}</b> already""" |
1339 """ for the variable <b>{1}</b> already""" |
1340 """ exists.</p>""")\ |
1340 """ exists.</p>""")\ |
1345 self.trUtf8("Watch expression already exists"), |
1345 self.trUtf8("Watch expression already exists"), |
1346 msg) |
1346 msg) |
1347 model.deleteWatchPointByIndex(index) |
1347 model.deleteWatchPointByIndex(index) |
1348 else: |
1348 else: |
1349 model.setWatchPointByIndex(index, cond, special, |
1349 model.setWatchPointByIndex(index, cond, special, |
1350 (temp, enabled, count)) |
1350 (temp, enabled, count)) |
1351 |
1351 |
1352 def __configureVariablesFilters(self): |
1352 def __configureVariablesFilters(self): |
1353 """ |
1353 """ |
1354 Private slot for displaying the variables filter configuration dialog. |
1354 Private slot for displaying the variables filter configuration dialog. |
1355 """ |
1355 """ |
1526 else: |
1526 else: |
1527 editor = self.viewmanager.activeWindow() |
1527 editor = self.viewmanager.activeWindow() |
1528 if editor is None: |
1528 if editor is None: |
1529 return |
1529 return |
1530 |
1530 |
1531 if not self.viewmanager.checkDirty(editor, |
1531 if not self.viewmanager.checkDirty( |
1532 Preferences.getDebugger("Autosave")) or \ |
1532 editor, |
1533 editor.getFileName() is None: |
1533 Preferences.getDebugger("Autosave")) or \ |
|
1534 editor.getFileName() is None: |
1534 return |
1535 return |
1535 |
1536 |
1536 fn = editor.getFileName() |
1537 fn = editor.getFileName() |
1537 self.lastStartAction = 5 |
1538 self.lastStartAction = 5 |
1538 self.clientType = editor.determineFileType() |
1539 self.clientType = editor.determineFileType() |
1643 else: |
1644 else: |
1644 editor = self.viewmanager.activeWindow() |
1645 editor = self.viewmanager.activeWindow() |
1645 if editor is None: |
1646 if editor is None: |
1646 return |
1647 return |
1647 |
1648 |
1648 if not self.viewmanager.checkDirty(editor, |
1649 if not self.viewmanager.checkDirty( |
1649 Preferences.getDebugger("Autosave")) or \ |
1650 editor, |
1650 editor.getFileName() is None: |
1651 Preferences.getDebugger("Autosave")) or \ |
|
1652 editor.getFileName() is None: |
1651 return |
1653 return |
1652 |
1654 |
1653 fn = editor.getFileName() |
1655 fn = editor.getFileName() |
1654 self.lastStartAction = 7 |
1656 self.lastStartAction = 7 |
1655 self.clientType = editor.determineFileType() |
1657 self.clientType = editor.determineFileType() |
1762 else: |
1764 else: |
1763 editor = self.viewmanager.activeWindow() |
1765 editor = self.viewmanager.activeWindow() |
1764 if editor is None: |
1766 if editor is None: |
1765 return |
1767 return |
1766 |
1768 |
1767 if not self.viewmanager.checkDirty(editor, |
1769 if not self.viewmanager.checkDirty( |
1768 Preferences.getDebugger("Autosave")) or \ |
1770 editor, |
1769 editor.getFileName() is None: |
1771 Preferences.getDebugger("Autosave")) or \ |
|
1772 editor.getFileName() is None: |
1770 return |
1773 return |
1771 |
1774 |
1772 fn = editor.getFileName() |
1775 fn = editor.getFileName() |
1773 self.lastStartAction = 3 |
1776 self.lastStartAction = 3 |
1774 self.clientType = editor.determineFileType() |
1777 self.clientType = editor.determineFileType() |
1883 else: |
1886 else: |
1884 editor = self.viewmanager.activeWindow() |
1887 editor = self.viewmanager.activeWindow() |
1885 if editor is None: |
1888 if editor is None: |
1886 return |
1889 return |
1887 |
1890 |
1888 if not self.viewmanager.checkDirty(editor, |
1891 if not self.viewmanager.checkDirty( |
1889 Preferences.getDebugger("Autosave")) or \ |
1892 editor, |
1890 editor.getFileName() is None: |
1893 Preferences.getDebugger("Autosave")) or \ |
|
1894 editor.getFileName() is None: |
1891 return |
1895 return |
1892 |
1896 |
1893 fn = editor.getFileName() |
1897 fn = editor.getFileName() |
1894 self.lastStartAction = 1 |
1898 self.lastStartAction = 1 |
1895 self.clientType = editor.determineFileType() |
1899 self.clientType = editor.determineFileType() |