2415 """ |
2415 """ |
2416 if self.lastHighlight is not None: |
2416 if self.lastHighlight is not None: |
2417 lineno = self.markerLine(self.lastHighlight) |
2417 lineno = self.markerLine(self.lastHighlight) |
2418 self.ensureVisible(lineno + 1) |
2418 self.ensureVisible(lineno + 1) |
2419 |
2419 |
2420 def highlight(self, line=None, error=False, syntaxError=False): # noqa: U100 |
2420 def highlight(self, line=None, error=False): |
2421 """ |
2421 """ |
2422 Public method to highlight [or de-highlight] a particular line. |
2422 Public method to highlight [or de-highlight] a particular line. |
2423 |
2423 |
2424 @param line line number to highlight |
2424 @param line line number to highlight |
2425 @type int |
2425 @type int |
2426 @param error flag indicating whether the error highlight should be |
2426 @param error flag indicating whether the error highlight should be |
2427 used |
2427 used |
2428 @type bool |
|
2429 @param syntaxError flag indicating a syntax error (unused) |
|
2430 @type bool |
2428 @type bool |
2431 """ |
2429 """ |
2432 if line is None: |
2430 if line is None: |
2433 self.lastHighlight = None |
2431 self.lastHighlight = None |
2434 if self.lastErrorMarker is not None: |
2432 if self.lastErrorMarker is not None: |
3060 printer.setDocName(os.path.basename(fn)) |
3058 printer.setDocName(os.path.basename(fn)) |
3061 else: |
3059 else: |
3062 printer.setDocName(self.noName) |
3060 printer.setDocName(self.noName) |
3063 if printDialog.printRange() == QAbstractPrintDialog.PrintRange.Selection: |
3061 if printDialog.printRange() == QAbstractPrintDialog.PrintRange.Selection: |
3064 # get the selection |
3062 # get the selection |
3065 fromLine, fromIndex, toLine, toIndex = self.getSelection() |
3063 fromLine, _fromIndex, toLine, toIndex = self.getSelection() |
3066 if toIndex == 0: |
3064 if toIndex == 0: |
3067 toLine -= 1 |
3065 toLine -= 1 |
3068 # QScintilla seems to print one line more than told |
3066 # QScintilla seems to print one line more than told |
3069 res = printer.printRange(self, fromLine, toLine - 1) |
3067 res = printer.printRange(self, fromLine, toLine - 1) |
3070 else: |
3068 else: |
6826 self.clearSyntaxError() |
6824 self.clearSyntaxError() |
6827 self.clearFlakesWarnings() |
6825 self.clearFlakesWarnings() |
6828 |
6826 |
6829 error = problems.get("error") |
6827 error = problems.get("error") |
6830 if error: |
6828 if error: |
6831 _fn, lineno, col, code, msg = error |
6829 _fn, lineno, col, _code, msg = error |
6832 self.toggleSyntaxError(lineno, col, True, msg) |
6830 self.toggleSyntaxError(lineno, col, True, msg) |
6833 |
6831 |
6834 for _fn, lineno, col, _code, msg in problems.get("py_warnings", []): |
6832 for _fn, lineno, col, _code, msg in problems.get("py_warnings", []): |
6835 self.toggleWarning( |
6833 self.toggleWarning( |
6836 lineno, col, True, msg, warningType=EditorWarningKind.Python |
6834 lineno, col, True, msg, warningType=EditorWarningKind.Python |