diff -r c712d09cc839 -r f6881d10e995 src/eric7/ViewManager/ViewManager.py --- a/src/eric7/ViewManager/ViewManager.py Fri Dec 22 13:57:47 2023 +0100 +++ b/src/eric7/ViewManager/ViewManager.py Fri Dec 22 17:24:07 2023 +0100 @@ -150,7 +150,9 @@ Public method to set some references needed later on. @param ui reference to the main user interface + @type UserInterface @param dbs reference to the debug server object + @type DebugServer """ from eric7.QScintilla.SearchReplaceWidget import SearchReplaceSlidingWidget @@ -166,7 +168,8 @@ """ Public method to get a reference to the search widget. - @return reference to the search widget (SearchReplaceSlidingWidget) + @return reference to the search widget + @rtype SearchReplaceSlidingWidget """ return self.__searchReplaceWidget @@ -193,7 +196,8 @@ """ Public method to get the most recently opened file. - @return path of the most recently opened file (string) + @return path of the most recently opened file + @rtype str """ if len(self.recent): return self.recent[0] @@ -208,18 +212,22 @@ viewmanager. @param sbLine reference to the line number part of the statusbar - (QLabel) + @type QLabel @param sbPos reference to the character position part of the statusbar - (QLabel) + @type QLabel @param sbWritable reference to the writability indicator part of - the statusbar (QLabel) + the statusbar + @type QLabel @param sbEncoding reference to the encoding indicator part of the - statusbar (QLabel) + statusbar + @type QLabel @param sbLanguage reference to the language indicator part of the - statusbar (QLabel) + statusbar + @type QLabel @param sbEol reference to the eol indicator part of the statusbar - (QLabel) - @param sbZoom reference to the zoom widget (EricZoomWidget) + @type QLabel + @param sbZoom reference to the zoom widget + @type EricZoomWidget """ self.sbLine = sbLine self.sbPos = sbPos @@ -243,7 +251,8 @@ """ Private slot to show the Languages menu of the current editor. - @param pos position the menu should be shown at (QPoint) + @param pos position the menu should be shown at + @type QPoint """ aw = self.activeWindow() if aw is not None: @@ -255,7 +264,8 @@ """ Private slot to show the EOL menu of the current editor. - @param pos position the menu should be shown at (QPoint) + @param pos position the menu should be shown at + @type QPoint """ aw = self.activeWindow() if aw is not None: @@ -267,7 +277,8 @@ """ Private slot to show the Encodings menu of the current editor. - @param pos position the menu should be shown at (QPoint) + @param pos position the menu should be shown at + @type QPoint """ aw = self.activeWindow() if aw is not None: @@ -284,6 +295,7 @@ Public method to signal if cascading of managed windows is available. @return flag indicating cascading of windows is available + @rtype bool @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -295,6 +307,7 @@ Public method to signal if tiling of managed windows is available. @return flag indicating tiling of windows is available + @rtype bool @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -322,6 +335,7 @@ Public method to return the active (i.e. current) window. @return reference to the active editor + @rtype Editor @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -341,6 +355,7 @@ Protected method to remove a view (i.e. window). @param win editor window to be removed + @type EditorAssembly @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -370,7 +385,9 @@ Protected method to show a view (i.e. window). @param win editor assembly to be shown + @type EditorAssembly @param fn filename of this editor + @type str @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -380,6 +397,7 @@ Public method to set up the viewmanager part of the Window menu. @param windowMenu reference to the window menu + @type QMenu @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -398,7 +416,9 @@ Public method to change the displayed name of the editor. @param editor editor window to be changed - @param newName new name to be shown (string) + @type Editor + @param newName new name to be shown + @type str @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -407,8 +427,10 @@ """ Protected slot to handle the modificationStatusChanged signal. - @param m flag indicating the modification status (boolean) + @param m flag indicating the modification status + @type bool @param editor editor window changed + @type Editor @exception NotImplementedError Not implemented """ raise NotImplementedError("Not implemented") @@ -430,7 +452,8 @@ """ Public method to signal if splitting of the view is available. - @return flag indicating splitting of the view is available. + @return flag indicating splitting of the view is available + @rtype bool """ return False @@ -476,8 +499,8 @@ """ Public method to get the orientation of the split view. - @return orientation of the split (Qt.Orientation.Horizontal or - Qt.Orientation.Vertical) + @return orientation of the split + @rtype Qt.Orientation """ return Qt.Orientation.Vertical @@ -486,7 +509,7 @@ Public method used to set the orientation of the split view. @param orientation orientation of the split - (Qt.Orientation.Horizontal or Qt.Orientation.Vertical) + @type Qt.Orientation """ pass @@ -506,9 +529,12 @@ """ Public method called to filter an event. - @param qobject object, that generated the event (QObject) - @param event the event, that was generated by object (QEvent) + @param qobject object, that generated the event + @type QObject + @param event the event, that was generated by object + @type QEvent @return flag indicating if event was filtered out + @rtype bool """ return False @@ -853,6 +879,7 @@ Public method to create the File menu. @return the generated menu + @rtype QMenu """ menu = QMenu(QCoreApplication.translate("ViewManager", "&File"), self.ui) self.recentMenu = QMenu( @@ -898,8 +925,9 @@ Public method to create the File toolbar. @param toolbarManager reference to a toolbar manager object - (EricToolBarManager) + @type EricToolBarManager @return the generated toolbar + @rtype QToolBar """ tb = QToolBar(QCoreApplication.translate("ViewManager", "File"), self.ui) tb.setObjectName("FileToolbar") @@ -924,7 +952,8 @@ """ Private method used to setup the Exporters sub menu. - @return reference to the generated menu (QMenu) + @return reference to the generated menu + @rtype QMenu """ menu = QMenu(QCoreApplication.translate("ViewManager", "Export as")) @@ -3347,6 +3376,7 @@ Public method to create the Edit menu. @return the generated menu + @rtype QMenu """ autocompletionMenu = QMenu( QCoreApplication.translate("ViewManager", "Complete"), self.ui @@ -3409,8 +3439,9 @@ Public method to create the Edit toolbar. @param toolbarManager reference to a toolbar manager object - (EricToolBarManager) + @type EricToolBarManager @return the generated toolbar + @rtype QToolBar """ tb = QToolBar(QCoreApplication.translate("ViewManager", "Edit"), self.ui) tb.setObjectName("EditToolbar") @@ -4547,6 +4578,7 @@ Public method to create the View menu. @return the generated menu + @rtype QMenu """ menu = QMenu(QCoreApplication.translate("ViewManager", "&View"), self.ui) menu.setTearOffEnabled(True) @@ -4577,8 +4609,9 @@ Public method to create the View toolbar. @param toolbarManager reference to a toolbar manager object - (EricToolBarManager) + @type EricToolBarManager @return the generated toolbar + @rtype QToolBar """ tb = QToolBar(QCoreApplication.translate("ViewManager", "View"), self.ui) tb.setObjectName("ViewToolbar") @@ -4744,6 +4777,7 @@ Public method to create the Macro menu. @return the generated menu + @rtype QMenu """ menu = QMenu(QCoreApplication.translate("ViewManager", "&Macros"), self.ui) menu.setTearOffEnabled(True) @@ -5120,6 +5154,7 @@ Public method to create the Bookmark menu. @return the generated menu + @rtype QMenu """ menu = QMenu(QCoreApplication.translate("ViewManager", "&Bookmarks"), self.ui) self.bookmarksMenu = QMenu( @@ -5161,8 +5196,9 @@ Public method to create the Bookmark toolbar. @param toolbarManager reference to a toolbar manager object - (EricToolBarManager) + @type EricToolBarManager @return the generated toolbar + @rtype QToolBar """ tb = QToolBar(QCoreApplication.translate("ViewManager", "Bookmarks"), self.ui) tb.setObjectName("BookmarksToolbar") @@ -5273,7 +5309,8 @@ """ Public method to add some actions to the Extras menu. - @param menu reference to the menu to add actions to (QMenu) + @param menu reference to the menu to add actions to + @type QMenu """ self.__editSpellingMenu = QMenu( QCoreApplication.translate("ViewManager", "Edit Dictionary") @@ -5307,8 +5344,9 @@ Public method to create the Spelling toolbar. @param toolbarManager reference to a toolbar manager object - (EricToolBarManager) + @type EricToolBarManager @return the generated toolbar + @rtype QToolBar """ tb = QToolBar(QCoreApplication.translate("ViewManager", "Spelling"), self.ui) tb.setObjectName("SpellingToolbar") @@ -5350,7 +5388,8 @@ """ Public slot to open some files. - @param prog name of file to be opened (string) + @param prog name of file to be opened + @type str """ prog = os.path.abspath(prog) # Open up the new files. @@ -5483,7 +5522,8 @@ """ Public method to close the current window. - @return flag indicating success (boolean) + @return flag indicating success + @rtype bool """ aw = self.activeWindow() if aw is None: @@ -5534,6 +5574,7 @@ Public method to close an arbitrary source editor. @param editor editor to be closed + @type Editor """ if editor is None: return @@ -5636,6 +5677,7 @@ Private method to establish all editor connections. @param editor reference to the editor object to be connected + @type Editor """ editor.modificationStatusChanged.connect(self._modificationStatusChanged) editor.cursorChanged.connect( @@ -5699,10 +5741,14 @@ Public method to clone an editor displaying the given document. @param caller reference to the editor calling this method - @param filetype type of the source file (string) + @type Editor + @param filetype type of the source file + @type str @param fn filename of this view - @return reference to the new editor object (Editor.Editor) and the new - editor assembly object (EditorAssembly.EditorAssembly) + @type str + @return reference to the new editor object and the new editor + assembly object + @rtype tuple of (Editor, EditorAssembly) """ from eric7.QScintilla.EditorAssembly import EditorAssembly @@ -5731,6 +5777,7 @@ Public slot to add a filename to the list of recently opened files. @param fn name of the file to be added + @type str """ for recent in self.recent[:]: if FileSystemUtilities.samepath(fn, recent): @@ -5746,8 +5793,10 @@ Public method to open the given file and highlight the given line in it. - @param fn filename of editor to update (string) - @param line line number to highlight (int) + @param fn filename of editor to update + @type str + @param line line number to highlight + @type int """ if not fn.startswith("<"): self.openSourceFile(fn, line) @@ -5758,10 +5807,14 @@ Public method to update the user interface when the current program or line changes. - @param fn filename of editor to update (string) - @param line line number to highlight (int) - @param error flag indicating an error highlight (boolean) + @param fn filename of editor to update + @type str + @param line line number to highlight + @type int + @param error flag indicating an error highlight + @type bool @param syntaxError flag indicating a syntax error + @type bool """ try: newWin, self.currentEditor = self.getEditor(fn) @@ -5797,13 +5850,20 @@ """ Private method to set the file info in the status bar. - @param fn filename to display (string) - @param line line number to display (int) - @param pos character position to display (int) - @param encoding encoding name to display (string) - @param language language to display (string) - @param eol eol indicator to display (string) - @param zoom zoom value (integer) + @param fn filename to display + @type str + @param line line number to display + @type int + @param pos character position to display + @type int + @param encoding encoding name to display + @type str + @param language language to display + @type str + @param eol eol indicator to display + @type str + @param zoom zoom value + @type int """ if not fn: fn = "" @@ -5870,8 +5930,10 @@ """ Private method to get an EOL pixmap for an EOL string. - @param eolIndicator eol indicator string (string) - @return pixmap for the eol indicator (QPixmap) + @param eolIndicator eol indicator string + @type str + @return pixmap for the eol indicator + @rtype QPixmap """ if eolIndicator == "LF": pixmap = EricPixmapCache.getPixmap("eolLinux") @@ -5895,7 +5957,8 @@ the current editor. @param current flag indicating only the current editor should be - unhighlighted (boolean) + unhighlighted + @type bool """ if current: if self.currentEditor is not None: @@ -5908,7 +5971,8 @@ """ Public method returning a list of the filenames of all editors. - @return list of all opened filenames (list of strings) + @return list of all opened filenames + @rtype list of str """ filenames = [] for editor in self.editors: @@ -5976,8 +6040,8 @@ """ Public method to get references to all open editors. - @return list of references to all open editors (list of - QScintilla.editor) + @return list of references to all open editors + @rtype list of Editor """ return self.editors @@ -5985,7 +6049,8 @@ """ Public method to get the number of open editors. - @return number of open editors (integer) + @return number of open editors + @rtype int """ return len(self.editors) @@ -6012,6 +6077,7 @@ @param fn filename to look for @type str @return list of references to the editors displaying this file + @rtype list of Editor """ return [ ed @@ -6024,7 +6090,9 @@ Public method to return the count of editors displaying the given file. @param fn filename to look for - @return count of editors displaying this file (integer) + @type str + @return count of editors displaying this file + @rtype int """ return len(self.getOpenEditorList(fn)) @@ -6046,7 +6114,8 @@ """ Public method to retrieve the filename of the active window. - @return filename of active window (string) + @return filename of active window + @rtype str """ aw = self.activeWindow() if aw: @@ -6058,8 +6127,10 @@ """ Public method to save a named editor file. - @param fn filename of editor to be saved (string) - @return flag indicating success (boolean) + @param fn filename of editor to be saved + @type str + @return flag indicating success + @rtype bool """ for editor in self.editors: if FileSystemUtilities.samepath(fn, editor.getFileName()): @@ -6078,7 +6149,9 @@ Public slot to save the contents of an editor. @param ed editor to be saved - @return flag indicating success (boolean) + @type Editor + @return flag indicating success + @rtype bool """ if ed: if not ed.isModified(): @@ -6103,6 +6176,7 @@ Public slot to save the contents of an editor to a new file. @param ed editor to be saved + @type Editor """ if ed: ok = ed.saveFileAs() @@ -6122,6 +6196,7 @@ the file. @param ed editor to be saved + @type Editor """ if ed: ed.saveFileCopy() @@ -6139,6 +6214,7 @@ Public slot to save a list of editors. @param editors list of editors to be saved + @type list of Editor """ for editor in editors: ok = editor.saveFile() @@ -6158,7 +6234,8 @@ """ Private method to handle the selection of an export format. - @param act reference to the action that was triggered (QAction) + @param act reference to the action that was triggered + @type QAction """ aw = self.activeWindow() if aw: @@ -6292,7 +6369,8 @@ """ Private method to open a file from the list of recently opened files. - @param act reference to the action that triggered (QAction) + @param act reference to the action that triggered + @type QAction """ file = act.data() if file: @@ -6378,8 +6456,10 @@ """ Public slot to handle the projectFileRenamed signal. - @param oldfn old filename of the file (string) - @param newfn new filename of the file (string) + @param oldfn old filename of the file + @type str + @param newfn new filename of the file + @type str """ editor = self.getOpenEditor(oldfn) if editor: @@ -6398,7 +6478,7 @@ checks. @param enabled flag indicating focus in checks should be performed - (boolean) + @type bool """ self.editorsCheckFocusIn = enabled @@ -6407,7 +6487,8 @@ Public method returning the flag indicating editors should perform focus in checks. - @return flag indicating focus in checks should be performed (boolean) + @return flag indicating focus in checks should be performed + @rtype bool """ return self.editorsCheckFocusIn @@ -6648,8 +6729,10 @@ next find operation. @param getCurrentWord flag indicating to return the current word, if - no selected text was found (boolean) - @return selection or current word (string) + no selected text was found + @type bool + @return selection or current word + @rtype str """ aw = self.activeWindow() if aw is None: @@ -6662,7 +6745,9 @@ Public method to get the search or replace history list. @param key list to return (must be 'search' or 'replace') - @return the requested history list (list of strings) + @type str + @return the requested history list + @rtype list of str """ return self.srHistory[key] @@ -6832,7 +6917,8 @@ """ Private slot to zoom to a given value. - @param value zoom value to be set (integer) + @param value zoom value to be set + @type int """ aw = ( ericApp().getObject("Shell") @@ -6920,8 +7006,9 @@ """ Private method to handle the split orientation action. - @param checked flag indicating the checked state of the action - (boolean). True means splitting horizontally. + @param checked flag indicating the checked state of the action. + True means splitting horizontally. + @type bool """ if checked: self.setSplitOrientation(Qt.Orientation.Horizontal) @@ -6943,7 +7030,8 @@ """ Private slot to handle a change of the preview selection state. - @param checked state of the action (boolean) + @param checked state of the action + @type bool """ Preferences.setUI("ShowFilePreview", checked) self.previewStateChanged.emit(checked) @@ -6952,7 +7040,8 @@ """ Private slot to handle a change of the AST Viewer selection state. - @param checked state of the action (boolean) + @param checked state of the action + @type bool """ self.astViewerStateChanged.emit(checked) @@ -6960,7 +7049,8 @@ """ Private slot to handle a change of the DIS Viewer selection state. - @param checked state of the action (boolean) + @param checked state of the action + @type bool """ self.disViewerStateChanged.emit(checked) @@ -7076,7 +7166,8 @@ """ Private method to handle the bookmark selected signal. - @param act reference to the action that triggered (QAction) + @param act reference to the action that triggered + @type QAction """ bmList = act.data() filename = bmList[0] @@ -7090,6 +7181,7 @@ It checks some bookmark actions and reemits the signal. @param editor editor that sent the signal + @type Editor """ if editor.hasBookmarks(): self.bookmarkNextAct.setEnabled(True) @@ -7121,6 +7213,7 @@ It checks some syntax error actions and reemits the signal. @param editor editor that sent the signal + @type Editor """ if editor.hasSyntaxErrors(): self.syntaxErrorGotoAct.setEnabled(True) @@ -7174,6 +7267,7 @@ Private slot to handle the coverageMarkersShown signal. @param shown flag indicating whether the markers were shown or cleared + @type bool """ if shown: self.notcoveredNextAct.setEnabled(True) @@ -7187,6 +7281,7 @@ Private slot to handle the taskMarkersUpdated signal. @param editor editor that sent the signal + @type Editor """ if editor.hasTaskMarkers(): self.taskNextAct.setEnabled(True) @@ -7212,6 +7307,7 @@ Private slot to handle the changeMarkersUpdated signal. @param editor editor that sent the signal + @type Editor """ if editor.hasChangeMarkers(): self.changeNextAct.setEnabled(True) @@ -7305,7 +7401,8 @@ """ Private slot to edit the given spelling dictionary. - @param dictionaryFile file name of the dictionary to edit (string) + @param dictionaryFile file name of the dictionary to edit + @type str """ if os.path.exists(dictionaryFile): try: @@ -7490,8 +7587,9 @@ and set the statusbar info. @param editor editor window + @type Editor @param setSb flag indicating an update of the status bar is wanted - (boolean) + @type bool """ if editor is not None: self.saveAct.setEnabled( @@ -7705,6 +7803,7 @@ It simply reemits the signal. @param editor editor that sent the signal + @type Editor """ self.breakpointToggled.emit(editor) @@ -7715,7 +7814,9 @@ @param actionSetType string denoting the action set to get. It must be one of "edit", "file", "search", "view", "window", "macro", "bookmark" or "spelling". - @return list of all actions (list of EricAction) + @type str + @return list of all actions + @rtype list of EricAction """ try: return self.__actions[actionSetType][:] @@ -7727,6 +7828,7 @@ Private method to send an editor command to the active window. @param cmd the scintilla command to be sent + @type int """ focusWidget = QApplication.focusWidget() if focusWidget == ericApp().getObject("Shell"): @@ -7893,7 +7995,8 @@ 2: Directory of currently active Project<br /> 3: CWD - @return name of directory to start (string) + @return name of directory to start + @rtype str """ # if we have an active source, return its path if self.activeWindow() is not None and self.activeWindow().getFileName(): @@ -7914,7 +8017,8 @@ The appropriate filename filter is determined by file extension of the currently active editor. - @return name of the filename filter (string) or None + @return name of the filename filter + @rtype str """ if self.activeWindow() is not None and self.activeWindow().getFileName(): ext = os.path.splitext(self.activeWindow().getFileName())[1] @@ -7940,7 +8044,8 @@ """ Public method to get a reference to the APIs manager. - @return the APIs manager object (eric7.QScintilla.APIsManager) + @return the APIs manager object + @rtype QScintilla.APIsManager """ return self.apisManager @@ -7952,7 +8057,8 @@ """ Public method to set a reference to the cooperation client. - @param client reference to the cooperation client (CooperationClient) + @param client reference to the cooperation client + @type CooperationClient """ self.__cooperationClient = client @@ -7960,7 +8066,8 @@ """ Public method to check the connection status of the IDE. - @return flag indicating the connection status (boolean) + @return flag indicating the connection status + @rtype bool """ return self.__cooperationClient.hasConnections() @@ -7968,8 +8075,10 @@ """ Public method to send an editor command to remote editors. - @param fileName file name of the editor (string) - @param message command message to be sent (string) + @param fileName file name of the editor + @type str + @param message command message to be sent + @type str """ project = ericApp().getObject("Project") if project.isProjectFile(fileName): @@ -7981,9 +8090,12 @@ """ Public slot to handle received editor commands. - @param projectHash hash of the project (string) - @param fileName project relative file name of the editor (string) - @param command command string (string) + @param projectHash hash of the project + @type str + @param fileName project relative file name of the editor + @type str + @param command command string + @type str """ project = ericApp().getObject("Project") if projectHash == project.getHash(): @@ -7996,7 +8108,8 @@ """ Public slot to handle a change of the connected state. - @param connected flag indicating the connected state (boolean) + @param connected flag indicating the connected state + @type bool """ for editor in self.getOpenEditors(): editor.shareConnected(connected) @@ -8005,7 +8118,8 @@ """ Public slot to set the shared status of the current editor. - @param share flag indicating the share status (boolean) + @param share flag indicating the share status + @type bool """ aw = self.activeWindow() if aw is not None: @@ -8052,7 +8166,8 @@ """ Public slot to insert a symbol text into the active window. - @param txt text to be inserted (string) + @param txt text to be inserted + @type str """ if self.__lastFocusWidget == ericApp().getObject("Shell"): ericApp().getObject("Shell").insert(txt) @@ -8071,7 +8186,8 @@ """ Public slot to insert a number text into the active window. - @param txt text to be inserted (string) + @param txt text to be inserted + @type str """ if self.__lastFocusWidget == ericApp().getObject("Shell"): aw = ericApp().getObject("Shell") @@ -8091,7 +8207,8 @@ """ Public method to get a number from the active window. - @return selected text of the active window (string) + @return selected text of the active window + @rtype str """ txt = "" if self.__lastFocusWidget == ericApp().getObject("Shell"):