Debugger/DebugUI.py

changeset 3020
542e97d4ecb3
parent 2991
226481ff40d1
child 3021
801289962f4e
equal deleted inserted replaced
3019:7912530a33e2 3020:542e97d4ecb3
980 980
981 self.__resetUI() 981 self.__resetUI()
982 982
983 if not Preferences.getDebugger("SuppressClientExit") or status != 0: 983 if not Preferences.getDebugger("SuppressClientExit") or status != 0:
984 if self.ui.currentProg is None: 984 if self.ui.currentProg is None:
985 E5MessageBox.information(self.ui, Program, 985 E5MessageBox.information(
986 self.ui, Program,
986 self.trUtf8('<p>The program has terminated with an exit' 987 self.trUtf8('<p>The program has terminated with an exit'
987 ' status of {0}.</p>').format(status)) 988 ' status of {0}.</p>').format(status))
988 else: 989 else:
989 E5MessageBox.information(self.ui, Program, 990 E5MessageBox.information(
991 self.ui, Program,
990 self.trUtf8('<p><b>{0}</b> has terminated with an exit' 992 self.trUtf8('<p><b>{0}</b> has terminated with an exit'
991 ' status of {1}.</p>') 993 ' status of {1}.</p>')
992 .format(Utilities.normabspath(self.ui.currentProg), 994 .format(Utilities.normabspath(self.ui.currentProg),
993 status)) 995 status))
994 else: 996 else:
1030 self.__resetUI() 1032 self.__resetUI()
1031 self.ui.raise_() 1033 self.ui.raise_()
1032 self.ui.activateWindow() 1034 self.ui.activateWindow()
1033 1035
1034 if message is None: 1036 if message is None:
1035 E5MessageBox.critical(self.ui, Program, 1037 E5MessageBox.critical(
1038 self.ui, Program,
1036 self.trUtf8( 1039 self.trUtf8(
1037 'The program being debugged contains an unspecified' 1040 'The program being debugged contains an unspecified'
1038 ' syntax error.')) 1041 ' syntax error.'))
1039 return 1042 return
1040 1043
1047 d = os.path.dirname( 1050 d = os.path.dirname(
1048 self.project.getMainScript(normalized=True)) 1051 self.project.getMainScript(normalized=True))
1049 if os.path.exists(os.path.join(d, filename)): 1052 if os.path.exists(os.path.join(d, filename)):
1050 filename = os.path.join(d, filename) 1053 filename = os.path.join(d, filename)
1051 self.viewmanager.setFileLine(filename, lineNo, True, True) 1054 self.viewmanager.setFileLine(filename, lineNo, True, True)
1052 E5MessageBox.critical(self.ui, Program, 1055 E5MessageBox.critical(
1056 self.ui, Program,
1053 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error' 1057 self.trUtf8('<p>The file <b>{0}</b> contains the syntax error'
1054 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.' 1058 ' <b>{1}</b> at line <b>{2}</b>, character <b>{3}</b>.'
1055 '</p>') 1059 '</p>')
1056 .format(filename, message, lineNo, characterNo)) 1060 .format(filename, message, lineNo, characterNo))
1057 1061
1065 """ 1069 """
1066 self.ui.raise_() 1070 self.ui.raise_()
1067 self.ui.activateWindow() 1071 self.ui.activateWindow()
1068 QApplication.processEvents() 1072 QApplication.processEvents()
1069 if exceptionType is None: 1073 if exceptionType is None:
1070 E5MessageBox.critical(self.ui, Program, 1074 E5MessageBox.critical(
1075 self.ui, Program,
1071 self.trUtf8('An unhandled exception occured.' 1076 self.trUtf8('An unhandled exception occured.'
1072 ' See the shell window for details.')) 1077 ' See the shell window for details.'))
1073 return 1078 return
1074 1079
1075 if (self.exceptions and \ 1080 if (self.exceptions and \
1104 else: 1109 else:
1105 buttons = E5MessageBox.StandardButtons( 1110 buttons = E5MessageBox.StandardButtons(
1106 E5MessageBox.No | \ 1111 E5MessageBox.No | \
1107 E5MessageBox.Yes | \ 1112 E5MessageBox.Yes | \
1108 E5MessageBox.Ignore) 1113 E5MessageBox.Ignore)
1109 res = E5MessageBox.critical(self.ui, Program, 1114 res = E5MessageBox.critical(
1115 self.ui, Program,
1110 self.trUtf8( 1116 self.trUtf8(
1111 '<p>The debugged program raised the exception' 1117 '<p>The debugged program raised the exception'
1112 ' <b>{0}</b><br>"<b>{1}</b>"<br>' 1118 ' <b>{0}</b><br>"<b>{1}</b>"<br>'
1113 'File: <b>{2}</b>, Line: <b>{3}</b></p>' 1119 'File: <b>{2}</b>, Line: <b>{3}</b></p>'
1114 '<p>Break here?</p>') 1120 '<p>Break here?</p>')
1118 stackTrace[0][0], 1124 stackTrace[0][0],
1119 stackTrace[0][1]), 1125 stackTrace[0][1]),
1120 buttons, 1126 buttons,
1121 E5MessageBox.No) 1127 E5MessageBox.No)
1122 else: 1128 else:
1123 res = E5MessageBox.critical(self.ui, Program, 1129 res = E5MessageBox.critical(
1130 self.ui, Program,
1124 self.trUtf8( 1131 self.trUtf8(
1125 '<p>The debugged program raised the exception' 1132 '<p>The debugged program raised the exception'
1126 ' <b>{0}</b><br>"<b>{1}</b>"</p>') 1133 ' <b>{0}</b><br>"<b>{1}</b>"</p>')
1127 .format( 1134 .format(
1128 exceptionType, 1135 exceptionType,
1154 1161
1155 @param unplanned True if the client died, False otherwise 1162 @param unplanned True if the client died, False otherwise
1156 """ 1163 """
1157 self.__resetUI() 1164 self.__resetUI()
1158 if unplanned: 1165 if unplanned:
1159 E5MessageBox.information(self.ui, Program, 1166 E5MessageBox.information(
1167 self.ui, Program,
1160 self.trUtf8('The program being debugged has terminated' 1168 self.trUtf8('The program being debugged has terminated'
1161 ' unexpectedly.')) 1169 ' unexpectedly.'))
1162 1170
1163 def __getThreadList(self): 1171 def __getThreadList(self):
1164 """ 1172 """
1226 Private method to handle a condition error of a breakpoint. 1234 Private method to handle a condition error of a breakpoint.
1227 1235
1228 @param filename filename of the breakpoint (string) 1236 @param filename filename of the breakpoint (string)
1229 @param lineno linenumber of the breakpoint (integer) 1237 @param lineno linenumber of the breakpoint (integer)
1230 """ 1238 """
1231 E5MessageBox.critical(self.ui, 1239 E5MessageBox.critical(
1240 self.ui,
1232 self.trUtf8("Breakpoint Condition Error"), 1241 self.trUtf8("Breakpoint Condition Error"),
1233 self.trUtf8( 1242 self.trUtf8(
1234 """<p>The condition of the breakpoint <b>{0}, {1}</b>""" 1243 """<p>The condition of the breakpoint <b>{0}, {1}</b>"""
1235 """ contains a syntax error.</p>""")\ 1244 """ contains a syntax error.</p>""")\
1236 .format(filename, lineno)) 1245 .format(filename, lineno))
1260 1269
1261 Note: This can only happen for normal watch expressions 1270 Note: This can only happen for normal watch expressions
1262 1271
1263 @param cond expression of the watch expression (string) 1272 @param cond expression of the watch expression (string)
1264 """ 1273 """
1265 E5MessageBox.critical(self.ui, 1274 E5MessageBox.critical(
1275 self.ui,
1266 self.trUtf8("Watch Expression Error"), 1276 self.trUtf8("Watch Expression Error"),
1267 self.trUtf8("""<p>The watch expression <b>{0}</b>""" 1277 self.trUtf8("""<p>The watch expression <b>{0}</b>"""
1268 """ contains a syntax error.</p>""")\ 1278 """ contains a syntax error.</p>""")\
1269 .format(cond)) 1279 .format(cond))
1270 1280
1298 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'""" 1308 msg = self.trUtf8("""<p>A watch expression '<b>{0}</b>'"""
1299 """ for the variable <b>{1}</b> already""" 1309 """ for the variable <b>{1}</b> already"""
1300 """ exists.</p>""")\ 1310 """ exists.</p>""")\
1301 .format(special, 1311 .format(special,
1302 Utilities.html_encode(cond)) 1312 Utilities.html_encode(cond))
1303 E5MessageBox.warning(self, 1313 E5MessageBox.warning(
1314 self.ui,
1304 self.trUtf8("Watch expression already exists"), 1315 self.trUtf8("Watch expression already exists"),
1305 msg) 1316 msg)
1306 model.deleteWatchPointByIndex(index) 1317 model.deleteWatchPointByIndex(index)
1307 else: 1318 else:
1308 model.setWatchPointByIndex(index, cond, special, 1319 model.setWatchPointByIndex(index, cond, special,
1460 eraseCoverage = dlg.getCoverageData() 1471 eraseCoverage = dlg.getCoverageData()
1461 1472
1462 if runProject: 1473 if runProject:
1463 fn = self.project.getMainScript(1) 1474 fn = self.project.getMainScript(1)
1464 if fn is None: 1475 if fn is None:
1465 E5MessageBox.critical(self.ui, 1476 E5MessageBox.critical(
1477 self.ui,
1466 self.trUtf8("Coverage of Project"), 1478 self.trUtf8("Coverage of Project"),
1467 self.trUtf8("There is no main script defined for the" 1479 self.trUtf8("There is no main script defined for the"
1468 " current project. Aborting")) 1480 " current project. Aborting"))
1469 return 1481 return
1470 1482
1574 eraseTimings = dlg.getProfilingData() 1586 eraseTimings = dlg.getProfilingData()
1575 1587
1576 if runProject: 1588 if runProject:
1577 fn = self.project.getMainScript(1) 1589 fn = self.project.getMainScript(1)
1578 if fn is None: 1590 if fn is None:
1579 E5MessageBox.critical(self.ui, 1591 E5MessageBox.critical(
1592 self.ui,
1580 self.trUtf8("Profile of Project"), 1593 self.trUtf8("Profile of Project"),
1581 self.trUtf8("There is no main script defined for the" 1594 self.trUtf8("There is no main script defined for the"
1582 " current project. Aborting")) 1595 " current project. Aborting"))
1583 return 1596 return
1584 1597
1690 forkAutomatically, forkIntoChild = dlg.getRunData() 1703 forkAutomatically, forkIntoChild = dlg.getRunData()
1691 1704
1692 if runProject: 1705 if runProject:
1693 fn = self.project.getMainScript(1) 1706 fn = self.project.getMainScript(1)
1694 if fn is None: 1707 if fn is None:
1695 E5MessageBox.critical(self.ui, 1708 E5MessageBox.critical(
1709 self.ui,
1696 self.trUtf8("Run Project"), 1710 self.trUtf8("Run Project"),
1697 self.trUtf8("There is no main script defined for the" 1711 self.trUtf8("There is no main script defined for the"
1698 " current project. Aborting")) 1712 " current project. Aborting"))
1699 return 1713 return
1700 1714
1807 dlg.getDebugData() 1821 dlg.getDebugData()
1808 1822
1809 if debugProject: 1823 if debugProject:
1810 fn = self.project.getMainScript(True) 1824 fn = self.project.getMainScript(True)
1811 if fn is None: 1825 if fn is None:
1812 E5MessageBox.critical(self.ui, 1826 E5MessageBox.critical(
1827 self.ui,
1813 self.trUtf8("Debug Project"), 1828 self.trUtf8("Debug Project"),
1814 self.trUtf8("There is no main script defined for the" 1829 self.trUtf8("There is no main script defined for the"
1815 " current project. No debugging possible.")) 1830 " current project. No debugging possible."))
1816 return 1831 return
1817 1832

eric ide

mercurial