Debugger/DebugUI.py

changeset 1310
7fdcfa822e3e
parent 1131
7781e396c903
child 1509
c0b5e693b0eb
equal deleted inserted replaced
1309:6caa231421cf 1310:7fdcfa822e3e
1014 if (self.exceptions and \ 1014 if (self.exceptions and \
1015 exceptionType not in self.excIgnoreList and \ 1015 exceptionType not in self.excIgnoreList and \
1016 (not len(self.excList) or \ 1016 (not len(self.excList) or \
1017 (len(self.excList) and exceptionType in self.excList)))\ 1017 (len(self.excList) and exceptionType in self.excList)))\
1018 or exceptionType.startswith('unhandled'): 1018 or exceptionType.startswith('unhandled'):
1019 res = None
1019 if stackTrace: 1020 if stackTrace:
1020 self.viewmanager.setFileLine(stackTrace[0][0], stackTrace[0][1], True) 1021 try:
1021 if Preferences.getDebugger("BreakAlways"): 1022 file, line = stackTrace[0]
1022 res = E5MessageBox.Yes 1023 source, encoding = Utilities.readEncodedFile(file)
1023 else: 1024 source = source.splitlines(True)
1024 if stackTrace: 1025 if "__IGNORE_EXCEPTION__" in Utilities.extractLineFlags(
1025 if exceptionType.startswith('unhandled'): 1026 source[line - 1]):
1026 buttons = E5MessageBox.StandardButtons( 1027 res = E5MessageBox.No
1027 E5MessageBox.No | \ 1028 except (UnicodeError, IOError):
1028 E5MessageBox.Yes) 1029 pass
1030 if res != E5MessageBox.No:
1031 self.viewmanager.setFileLine(stackTrace[0][0], stackTrace[0][1], True)
1032 if res != E5MessageBox.No:
1033 if Preferences.getDebugger("BreakAlways"):
1034 res = E5MessageBox.Yes
1035 else:
1036 if stackTrace:
1037 if exceptionType.startswith('unhandled'):
1038 buttons = E5MessageBox.StandardButtons(
1039 E5MessageBox.No | \
1040 E5MessageBox.Yes)
1041 else:
1042 buttons = E5MessageBox.StandardButtons(
1043 E5MessageBox.No | \
1044 E5MessageBox.Yes | \
1045 E5MessageBox.Ignore)
1046 res = E5MessageBox.critical(self.ui, Program,
1047 self.trUtf8('<p>The debugged program raised the exception'
1048 ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,'
1049 ' Line: <b>{3}</b></p><p>Break here?</p>')
1050 .format(exceptionType,
1051 Utilities.html_encode(exceptionMessage),
1052 stackTrace[0][0],
1053 stackTrace[0][1]),
1054 buttons,
1055 E5MessageBox.No)
1029 else: 1056 else:
1030 buttons = E5MessageBox.StandardButtons( 1057 res = E5MessageBox.critical(self.ui, Program,
1031 E5MessageBox.No | \ 1058 self.trUtf8('<p>The debugged program raised the exception'
1032 E5MessageBox.Yes | \ 1059 ' <b>{0}</b><br>"<b>{1}</b>"</p>')
1033 E5MessageBox.Ignore) 1060 .format(exceptionType,
1034 res = E5MessageBox.critical(self.ui, Program, 1061 Utilities.html_encode(exceptionMessage)))
1035 self.trUtf8('<p>The debugged program raised the exception'
1036 ' <b>{0}</b><br>"<b>{1}</b>"<br>File: <b>{2}</b>,'
1037 ' Line: <b>{3}</b></p><p>Break here?</p>')
1038 .format(exceptionType,
1039 Utilities.html_encode(exceptionMessage),
1040 stackTrace[0][0],
1041 stackTrace[0][1]),
1042 buttons,
1043 E5MessageBox.No)
1044 else:
1045 res = E5MessageBox.critical(self.ui, Program,
1046 self.trUtf8('<p>The debugged program raised the exception'
1047 ' <b>{0}</b><br>"<b>{1}</b>"</p>')
1048 .format(exceptionType,
1049 Utilities.html_encode(exceptionMessage)))
1050 if res == E5MessageBox.Yes: 1062 if res == E5MessageBox.Yes:
1051 self.exceptionInterrupt.emit() 1063 self.exceptionInterrupt.emit()
1052 stack = [] 1064 stack = []
1053 for fn, ln in stackTrace: 1065 for fn, ln in stackTrace:
1054 stack.append((fn, ln, '')) 1066 stack.append((fn, ln, ''))

eric ide

mercurial