src/eric7/QScintilla/Editor.py

branch
server
changeset 10704
27d21e5163b8
parent 10680
306373ccf8fd
parent 10692
9becf9ca115c
child 10708
a6094987c1be
equal deleted inserted replaced
10680:306373ccf8fd 10704:27d21e5163b8
2433 """ 2433 """
2434 if self.lastHighlight is not None: 2434 if self.lastHighlight is not None:
2435 lineno = self.markerLine(self.lastHighlight) 2435 lineno = self.markerLine(self.lastHighlight)
2436 self.ensureVisible(lineno + 1) 2436 self.ensureVisible(lineno + 1)
2437 2437
2438 def highlight(self, line=None, error=False, syntaxError=False): # noqa: U100 2438 def highlight(self, line=None, error=False):
2439 """ 2439 """
2440 Public method to highlight [or de-highlight] a particular line. 2440 Public method to highlight [or de-highlight] a particular line.
2441 2441
2442 @param line line number to highlight 2442 @param line line number to highlight
2443 @type int 2443 @type int
2444 @param error flag indicating whether the error highlight should be 2444 @param error flag indicating whether the error highlight should be
2445 used 2445 used
2446 @type bool
2447 @param syntaxError flag indicating a syntax error
2448 @type bool 2446 @type bool
2449 """ 2447 """
2450 if line is None: 2448 if line is None:
2451 self.lastHighlight = None 2449 self.lastHighlight = None
2452 if self.lastErrorMarker is not None: 2450 if self.lastErrorMarker is not None:
2484 ## Breakpoint handling methods below 2482 ## Breakpoint handling methods below
2485 ########################################################################### 2483 ###########################################################################
2486 2484
2487 def __modified( 2485 def __modified(
2488 self, 2486 self,
2489 pos, # noqa: U100 2487 _pos,
2490 mtype, 2488 mtype,
2491 text, # noqa: U100 2489 _text,
2492 length, # noqa: U100 2490 _length,
2493 linesAdded, 2491 linesAdded,
2494 line, 2492 line,
2495 foldNow, # noqa: U100 2493 _foldNow,
2496 foldPrev, # noqa: U100 2494 _foldPrev,
2497 token, # noqa: U100 2495 _token,
2498 annotationLinesAdded, # noqa: U100 2496 _annotationLinesAdded,
2499 ): 2497 ):
2500 """ 2498 """
2501 Private method to handle changes of the number of lines. 2499 Private method to handle changes of the number of lines.
2502 2500
2503 @param pos start position of change 2501 @param _pos start position of change (unused)
2504 @type int 2502 @type int
2505 @param mtype flags identifying the change 2503 @param mtype flags identifying the change
2506 @type int 2504 @type int
2507 @param text text that is given to the Undo system 2505 @param _text text that is given to the Undo system (unused)
2508 @type str 2506 @type str
2509 @param length length of the change 2507 @param _length length of the change (unused)
2510 @type int 2508 @type int
2511 @param linesAdded number of added/deleted lines 2509 @param linesAdded number of added/deleted lines
2512 @type int 2510 @type int
2513 @param line line number of a fold level or marker change 2511 @param line line number of a fold level or marker change
2514 @type int 2512 @type int
2515 @param foldNow new fold level 2513 @param _foldNow new fold level (unused)
2516 @type int 2514 @type int
2517 @param foldPrev previous fold level 2515 @param _foldPrev previous fold level (unused)
2518 @type int 2516 @type int
2519 @param token ??? 2517 @param _token ??? (unused)
2520 @type int 2518 @type int
2521 @param annotationLinesAdded number of added/deleted annotation lines 2519 @param _annotationLinesAdded number of added/deleted annotation lines (unused)
2522 @type int 2520 @type int
2523 """ 2521 """
2524 if mtype & (self.SC_MOD_INSERTTEXT | self.SC_MOD_DELETETEXT): 2522 if mtype & (self.SC_MOD_INSERTTEXT | self.SC_MOD_DELETETEXT):
2525 # 1. set/reset the autosave timer 2523 # 1. set/reset the autosave timer
2526 if self.__autosaveInterval > 0: 2524 if self.__autosaveInterval > 0:
3078 printer.setDocName(os.path.basename(fn)) 3076 printer.setDocName(os.path.basename(fn))
3079 else: 3077 else:
3080 printer.setDocName(self.noName) 3078 printer.setDocName(self.noName)
3081 if printDialog.printRange() == QAbstractPrintDialog.PrintRange.Selection: 3079 if printDialog.printRange() == QAbstractPrintDialog.PrintRange.Selection:
3082 # get the selection 3080 # get the selection
3083 fromLine, fromIndex, toLine, toIndex = self.getSelection() 3081 fromLine, _fromIndex, toLine, toIndex = self.getSelection()
3084 if toIndex == 0: 3082 if toIndex == 0:
3085 toLine -= 1 3083 toLine -= 1
3086 # QScintilla seems to print one line more than told 3084 # QScintilla seems to print one line more than told
3087 res = printer.printRange(self, fromLine, toLine - 1) 3085 res = printer.printRange(self, fromLine, toLine - 1)
3088 else: 3086 else:
4033 QsciScintilla.SCI_FOLDCHILDREN, 4031 QsciScintilla.SCI_FOLDCHILDREN,
4034 line - 1, 4032 line - 1,
4035 QsciScintilla.SC_FOLDACTION_EXPAND, 4033 QsciScintilla.SC_FOLDACTION_EXPAND,
4036 ) 4034 )
4037 4035
4038 def __marginClicked(self, margin, line, modifiers): # noqa: U100 4036 def __marginClicked(self, margin, line, _modifiers):
4039 """ 4037 """
4040 Private slot to handle the marginClicked signal. 4038 Private slot to handle the marginClicked signal.
4041 4039
4042 @param margin id of the clicked margin 4040 @param margin id of the clicked margin
4043 @type int 4041 @type int
4044 @param line line number of the click 4042 @param line line number of the click
4045 @type int 4043 @type int
4046 @param modifiers keyboard modifiers 4044 @param _modifiers keyboard modifiers (unused)
4047 @type Qt.KeyboardModifiers 4045 @type Qt.KeyboardModifiers
4048 """ 4046 """
4049 if margin == self.__bmMargin: 4047 if margin == self.__bmMargin:
4050 self.toggleBookmark(line + 1) 4048 self.toggleBookmark(line + 1)
4051 elif margin == self.__bpMargin: 4049 elif margin == self.__bpMargin:
6913 self.clearSyntaxError() 6911 self.clearSyntaxError()
6914 self.clearFlakesWarnings() 6912 self.clearFlakesWarnings()
6915 6913
6916 error = problems.get("error") 6914 error = problems.get("error")
6917 if error: 6915 if error:
6918 _fn, lineno, col, code, msg = error 6916 _fn, lineno, col, _code, msg = error
6919 self.toggleSyntaxError(lineno, col, True, msg) 6917 self.toggleSyntaxError(lineno, col, True, msg)
6920 6918
6921 for _fn, lineno, col, _code, msg in problems.get("py_warnings", []): 6919 for _fn, lineno, col, _code, msg in problems.get("py_warnings", []):
6922 self.toggleWarning( 6920 self.toggleWarning(
6923 lineno, col, True, msg, warningType=EditorWarningKind.Python 6921 lineno, col, True, msg, warningType=EditorWarningKind.Python
7398 ########################################################################### 7396 ###########################################################################
7399 7397
7400 def toggleWarning( 7398 def toggleWarning(
7401 self, 7399 self,
7402 line, 7400 line,
7403 col, # noqa: U100 7401 _col,
7404 setWarning, 7402 setWarning,
7405 msg="", 7403 msg="",
7406 warningType=EditorWarningKind.Code, 7404 warningType=EditorWarningKind.Code,
7407 ): 7405 ):
7408 """ 7406 """
7410 7408
7411 Note: This method is used to set pyflakes and code style warnings. 7409 Note: This method is used to set pyflakes and code style warnings.
7412 7410
7413 @param line line number of the warning 7411 @param line line number of the warning
7414 @type int 7412 @type int
7415 @param col column of the warning 7413 @param _col column of the warning (unused)
7416 @type int 7414 @type int
7417 @param setWarning flag indicating if the warning marker should be 7415 @param setWarning flag indicating if the warning marker should be
7418 set or deleted 7416 set or deleted
7419 @type bool 7417 @type bool
7420 @param msg warning message 7418 @param msg warning message

eric ide

mercurial