2413 |
2416 |
2414 @param line line number of the breakpoint (integer) |
2417 @param line line number of the breakpoint (integer) |
2415 @param temporary flag indicating a temporary breakpoint (boolean) |
2418 @param temporary flag indicating a temporary breakpoint (boolean) |
2416 """ |
2419 """ |
2417 if self.fileName and self.isPyFile(): |
2420 if self.fileName and self.isPyFile(): |
|
2421 linestarts = PythonDisViewer.linestarts(self.text()) |
|
2422 if line not in linestarts: |
|
2423 if Preferences.getDebugger("IntelligentBreakpoints"): |
|
2424 # change line to the next one starting an instruction block |
|
2425 index = bisect.bisect(linestarts, line) |
|
2426 with contextlib.suppress(IndexError): |
|
2427 line = linestarts[index] |
|
2428 self.__toggleBreakpoint(line, temporary=temporary) |
|
2429 else: |
|
2430 EricMessageBox.warning( |
|
2431 self, |
|
2432 self.tr("Add Breakpoint"), |
|
2433 self.tr("No Python byte code will be created for the" |
|
2434 " selected line. No break point will be set!") |
|
2435 ) |
|
2436 return |
|
2437 |
2418 self.breakpointModel.addBreakPoint( |
2438 self.breakpointModel.addBreakPoint( |
2419 self.fileName, line, ('', temporary, True, 0)) |
2439 self.fileName, line, ('', temporary, True, 0)) |
2420 self.breakpointToggled.emit(self) |
2440 self.breakpointToggled.emit(self) |
2421 |
2441 |
2422 def __toggleBreakpointEnabled(self, line): |
2442 def __toggleBreakpointEnabled(self, line): |