--- a/src/eric7/QScintilla/Shell.py Wed Dec 20 19:28:22 2023 +0100 +++ b/src/eric7/QScintilla/Shell.py Thu Dec 21 12:03:40 2023 +0100 @@ -85,7 +85,8 @@ """ Public method to display the search widget. - @param txt text to be shown in the combo (string) + @param txt text to be shown in the combo + @type str """ self.__searchWidget.showFind(txt) @@ -93,7 +94,8 @@ """ Public method to get a reference to the shell widget. - @return reference to the shell widget (Shell) + @return reference to the shell widget + @rtype Shell """ return self.__shell @@ -411,7 +413,8 @@ """ Private slot to set the lexer. - @param language lexer language to set (string) + @param language lexer language to set + @type str """ self.language = language if Preferences.getShell("SyntaxHighlightingEnabled"): @@ -541,7 +544,8 @@ """ Private method to set/reset a monospaced font. - @param on flag to indicate usage of a monospace font (boolean) + @param on flag to indicate usage of a monospace font + @type bool """ if on: if not self.lexer_: @@ -605,7 +609,8 @@ """ Public method to set the debugger UI. - @param ui reference to the debugger UI object (DebugUI) + @param ui reference to the debugger UI object + @type DebugUI """ ui.exceptionInterrupt.connect(self.__writePrompt) self.registerDebuggerIdMethod(ui.getSelectedDebuggerId) @@ -725,7 +730,8 @@ """ Public method to load the history for the given client type. - @param clientType type of the debug client (string) + @param clientType type of the debug client + @type str """ hl = Preferences.getSettings().value("Shell/Histories/" + clientType) if hl is not None: @@ -746,7 +752,8 @@ """ Public method to save the history for the given client type. - @param clientType type of the debug client (string) + @param clientType type of the debug client + @type str """ if clientType in self.__historyLists: Preferences.getSettings().setValue( @@ -757,9 +764,11 @@ """ Public method to get the history for the given client type. - @param clientType type of the debug client (string). - If it is None, the current history is returned. - @return reference to the history list (list of strings) + @param clientType type of the debug client. If it is None, the current + history is returned. + @type str + @return reference to the history list + @rtype list of str """ if clientType is None: return self.__history @@ -848,7 +857,8 @@ """ Public slot to get the clients type. - @return client type (string) + @return client type + @rtype str """ return self.clientType @@ -917,9 +927,12 @@ """ Private method to handle an exception of the client. - @param exceptionType type of exception raised (string) - @param exceptionMessage message given by the exception (string) - @param stackTrace list of stack entries (list of string) + @param exceptionType type of exception raised + @type str + @param exceptionMessage message given by the exception + @type str + @param stackTrace list of stack entries + @type list of str """ self.__clientError() @@ -948,12 +961,14 @@ """ Private method to handle a syntax error in the debugged program. - @param message message of the syntax error (string) + @param message message of the syntax error + @type str @param filename translated filename of the syntax error position - (string) - @param lineNo line number of the syntax error position (integer) + @type str + @param lineNo line number of the syntax error position + @type int @param characterNo character number of the syntax error position - (integer) + @type int """ self.__clientError() @@ -1004,7 +1019,8 @@ """ Private method to return the line and column of the last character. - @return tuple of two values (int, int) giving the line and column + @return tuple of two values giving the line and column + @rtype tuple of (int, int) """ line = self.lines() - 1 return (line, len(self.text(line))) @@ -1013,7 +1029,8 @@ """ Private method to display some text using a write queue. - @param s text to be displayed (string) + @param s text to be displayed + @type str """ self.queueText.emit(s) @@ -1066,7 +1083,8 @@ """ Private method to display some text with StdOut label. - @param s text to be displayed (string) + @param s text to be displayed + @type str """ self.__write(self.tr("StdOut: {0}").format(s)) @@ -1074,7 +1092,8 @@ """ Private method to display some text with StdErr label. - @param s text to be displayed (string) + @param s text to be displayed + @type str """ self.__write(self.tr("StdErr: {0}").format(s)) @@ -1236,7 +1255,8 @@ """ Private method to insert some text at the current cursor position. - @param s text to be inserted (string) + @param s text to be inserted + @type str """ line, col = self.getCursorPosition() self.insertAt(Utilities.filterAnsiSequences(s), line, col) @@ -1246,7 +1266,8 @@ """ Private method to insert some text at the end of the command line. - @param s text to be inserted (string) + @param s text to be inserted + @type str """ line, col = self.__getEndPos() self.setCursorPosition(line, col) @@ -1258,7 +1279,8 @@ Private method to insert some text at the end of the buffer without echoing it. - @param s text to be inserted (string) + @param s text to be inserted + @type str """ self.buff += s self.prline, self.prcol = self.getCursorPosition() @@ -1267,7 +1289,8 @@ """ Protected method to handle the mouse press event. - @param event the mouse press event (QMouseEvent) + @param event the mouse press event + @type QMouseEvent """ self.setFocus(Qt.FocusReason.MouseFocusReason) if event.button() == Qt.MouseButton.MiddleButton: @@ -1280,7 +1303,8 @@ """ Protected method to handle wheel events. - @param evt reference to the wheel event (QWheelEvent) + @param evt reference to the wheel event + @type QWheelEvent """ if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: delta = evt.angleDelta().y() @@ -1297,8 +1321,10 @@ """ Public method handling events. - @param evt reference to the event (QEvent) - @return flag indicating, if the event was handled (boolean) + @param evt reference to the event + @type QEvent + @return flag indicating, if the event was handled + @rtype bool """ if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) @@ -1311,6 +1337,7 @@ Protected method handling gesture events. @param evt reference to the gesture event (QGestureEvent + @type int """ pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: @@ -1333,6 +1360,7 @@ Public method to perform an editor command. @param cmd the scintilla command to be performed + @type int """ try: self.supportedEditorCommands[cmd]() @@ -1345,7 +1373,8 @@ """ Private method to check, if the cursor is on the last line. - @return flag indicating that the cursor is on the last line (boolean) + @return flag indicating that the cursor is on the last line + @rtype bool """ cline, ccol = self.getCursorPosition() return cline == self.lines() - 1 @@ -1355,6 +1384,7 @@ Protected method to handle the user input a key at a time. @param ev key event (QKeyEvent) + @type int """ txt = ev.text() @@ -1382,6 +1412,7 @@ Private method to send the command to QScintilla. @param cmd QScintilla command + @type int """ self.SendScintilla(cmd) @@ -1390,6 +1421,7 @@ Private method to handle the Tab key. @param cmd QScintilla command + @type int """ if self.isListActive(): self.SendScintilla(cmd) @@ -1411,6 +1443,7 @@ the left. @param method shell method to execute + @type int """ if self.__isCursorOnLastLine(): line, col = self.getCursorPosition() @@ -1490,6 +1523,7 @@ Private method to handle the Return key. @param cmd QScintilla command + @type int """ if self.__isCursorOnLastLine(): if self.isListActive(): @@ -1528,8 +1562,10 @@ Private method to handle a QScintilla command working to the left. @param method shell method to execute + @type int @param allLinesAllowed flag indicating that the command may be executed - on any line (boolean) + on any line + @type bool """ if self.__isCursorOnLastLine() or allLinesAllowed: line, col = self.getCursorPosition() @@ -1561,7 +1597,9 @@ Private method to handle a QScintilla command working to the right. @param method shell method to execute + @type function """ + # TODO: check this! if self.__isCursorOnLastLine(): method() else: @@ -1596,6 +1634,7 @@ Private method to handle the Home key. @param cmd QScintilla command + @type int """ if self.isListActive(): self.SendScintilla(cmd) @@ -1614,6 +1653,7 @@ Private method to handle the End key. @param cmd QScintilla command + @type int """ if self.isListActive(): self.SendScintilla(cmd) @@ -1625,6 +1665,7 @@ Private method to handle the cursor commands. @param cmd QScintilla command + @type int """ if self.isListActive() or self.isCallTipActive(): if cmd in (QsciScintilla.SCI_LINEUP, QsciScintilla.SCI_LINEDOWN): @@ -1654,6 +1695,7 @@ Private method to handle the cursor up command. @param cmd QScintilla command + @type int """ self.SendScintilla(QsciScintilla.SCI_LINEUP) @@ -1662,6 +1704,7 @@ Private method to handle the cursor down command. @param cmd QScintilla command + @type int """ self.SendScintilla(QsciScintilla.SCI_LINEDOWN) @@ -1670,6 +1713,7 @@ Private method to handle the history up command. @param cmd QScintilla command + @type int """ if self.isHistoryEnabled(): line, col = self.__getEndPos() @@ -1715,6 +1759,7 @@ Private method to handle the history down command. @param cmd QScintilla command + @type int """ if self.isHistoryEnabled(): line, col = self.__getEndPos() @@ -1797,6 +1842,7 @@ Private method to handle a command for autocompletion only. @param cmd QScintilla command + @type int """ if self.isListActive() or self.isCallTipActive(): self.SendScintilla(cmd) @@ -1976,7 +2022,8 @@ """ Private method to insert a command selected from the history. - @param cmd history entry to be inserted (string) + @param cmd history entry to be inserted + @type str """ self.setCursorPosition(self.prline, self.prcol) self.setSelection( @@ -2036,7 +2083,9 @@ the next window by the Tab key being pressed is suppressed. @param nextChild next window + @type QWidget @return flag indicating the movement + @rtype bool """ if nextChild and self.inContinue: return False @@ -2083,7 +2132,8 @@ Private slot to start a debug client according to the action triggered. - @param action context menu action that was triggered (QAction) + @param action context menu action that was triggered + @type QAction """ venvName = action.text() if venvName == self.tr("Project"): @@ -2142,8 +2192,10 @@ """ Private method to display the possible completions. - @param completions list of possible completions (list of strings) - @param text text that is about to be completed (string) + @param completions list of possible completions + @type list of str + @param text text that is about to be completed + @type str """ if len(completions) == 0: return @@ -2163,8 +2215,10 @@ """ Private slot to handle the selection from the completion list. - @param listId the ID of the user list (should be 1) (integer) - @param txt the selected text (string) + @param listId the ID of the user list (should be 1) + @type int + @param txt the selected text + @type str """ if listId == 1: if self.completionText != "": @@ -2180,7 +2234,8 @@ """ Protected method to handle the drag enter event. - @param event the drag enter event (QDragEnterEvent) + @param event the drag enter event + @type QDragEnterEvent """ self.inDragDrop = event.mimeData().hasUrls() or event.mimeData().hasText() if self.inDragDrop: @@ -2192,7 +2247,8 @@ """ Protected method to handle the drag move event. - @param event the drag move event (QDragMoveEvent) + @param event the drag move event + @type QDragMoveEvent """ if self.inDragDrop: event.accept() @@ -2203,7 +2259,8 @@ """ Protected method to handle the drag leave event. - @param event the drag leave event (QDragLeaveEvent) + @param event the drag leave event + @type QDragLeaveEvent """ if self.inDragDrop: self.inDragDrop = False @@ -2215,7 +2272,8 @@ """ Protected method to handle the drop event. - @param event the drop event (QDropEvent) + @param event the drop event + @type QDropEvent """ if event.mimeData().hasUrls() and not self.__windowed: for url in event.mimeData().urls(): @@ -2247,7 +2305,8 @@ """ Protected method called when the shell receives focus. - @param event the event object (QFocusEvent) + @param event the event object + @type QFocusEvent """ if not self.__actionsAdded: self.addActions(self.vm.editorActGrp.actions()) @@ -2289,7 +2348,8 @@ """ Protected method called when the shell loses focus. - @param event the event object (QFocusEvent) + @param event the event object + @type QFocusEvent """ with contextlib.suppress(AttributeError): self.vm.editorActGrp.setEnabled(False) @@ -2306,7 +2366,8 @@ The cursor is advanced to the end of the inserted text. - @param txt text to be inserted (string) + @param txt text to be inserted + @type str """ txt = Utilities.filterAnsiSequences(txt) length = len(txt)