diff -r 643989a1e2bd -r e440aaf179ce src/eric7/Project/ProjectBrowserModel.py --- a/src/eric7/Project/ProjectBrowserModel.py Wed Dec 20 15:42:44 2023 +0100 +++ b/src/eric7/Project/ProjectBrowserModel.py Wed Dec 20 19:28:22 2023 +0100 @@ -42,7 +42,9 @@ Constructor @param type_ type of file/directory in the project + @type str @param bold flag indicating a highlighted font + @type bool """ self._projectTypes = [type_] self.bold = bold @@ -52,7 +54,8 @@ """ Public method to get the items text color. - @return text color (QColor) + @return text color + @rtype QColor """ if self.bold: return Preferences.getProjectBrowserColour("Highlighted") @@ -63,7 +66,8 @@ """ Public method to set the items VCS state. - @param state VCS state (one of A, C, M, U or " ") (string) + @param state VCS state (one of A, C, M, U or " ") + @type str """ self.vcsState = state @@ -71,7 +75,8 @@ """ Public method to add the VCS status. - @param vcsStatus VCS status text (string) + @param vcsStatus VCS status text + @type str """ self.itemData.append(vcsStatus) @@ -79,7 +84,8 @@ """ Public method to set the VCS status. - @param vcsStatus VCS status text (string) + @param vcsStatus VCS status text + @type str """ self.itemData[1] = vcsStatus @@ -88,6 +94,7 @@ Public method to get the project type. @return project type + @rtype str """ return self._projectTypes[:] @@ -96,6 +103,7 @@ Public method to add a type to the list. @param type_ type to add to the list + @type str """ self._projectTypes.append(type_) @@ -113,9 +121,13 @@ Constructor @param parent parent item + @type BrowserItem @param projectType type of file/directory in the project - @param text text to be displayed (string) - @param path path of the directory (string) + @type str + @param text text to be displayed + @type str + @param path path of the directory + @type str """ BrowserSimpleDirectoryItem.__init__(self, parent, text, path=path) ProjectBrowserItemMixin.__init__(self, projectType) @@ -133,10 +145,15 @@ Constructor @param parent parent item - @param dinfo dinfo is the string for the directory (string) + @type BrowserItem + @param dinfo dinfo is the string for the directory + @type str @param projectType type of file/directory in the project - @param full flag indicating full pathname should be displayed (boolean) - @param bold flag indicating a highlighted font (boolean) + @type str + @param full flag indicating full pathname should be displayed + @type bool + @param bold flag indicating a highlighted font + @type bool """ BrowserDirectoryItem.__init__(self, parent, dinfo, full) ProjectBrowserItemMixin.__init__(self, projectType, bold) @@ -156,11 +173,17 @@ Constructor @param parent parent item - @param finfo the string for the file (string) + @type BrowserItem + @param finfo the string for the file + @type str @param projectType type of file/directory in the project - @param full flag indicating full pathname should be displayed (boolean) - @param bold flag indicating a highlighted font (boolean) - @param sourceLanguage source code language of the project (string) + @type str + @param full flag indicating full pathname should be displayed + @type bool + @param bold flag indicating a highlighted font + @type bool + @param sourceLanguage source code language of the project + @type str """ BrowserFileItem.__init__(self, parent, finfo, full, sourceLanguage) ProjectBrowserItemMixin.__init__(self, projectType, bold) @@ -181,7 +204,8 @@ """ Constructor - @param parent reference to parent object (Project.Project) + @param parent reference to parent object + @type Project.Project """ super().__init__(parent, nopopulate=True) @@ -236,9 +260,12 @@ """ Public method to get data of an item. - @param index index of the data to retrieve (QModelIndex) - @param role role of data (Qt.ItemDataRole) + @param index index of the data to retrieve + @type QModelIndex + @param role role of data + @type Qt.ItemDataRole @return requested data + @rtype Any """ if not index.isValid(): return None @@ -268,7 +295,9 @@ Public method to populate an item's subtree. @param parentItem reference to the item to be populated - @param repopulate flag indicating a repopulation (boolean) + @type BrowserItem + @param repopulate flag indicating a repopulation + @type bool """ if parentItem.type() == ProjectBrowserItemSimpleDirectory: return # nothing to do @@ -284,7 +313,9 @@ Public method to populate a directory item's subtree. @param parentItem reference to the directory item to be populated - @param repopulate flag indicating a repopulation (boolean) + @type BrowserItem + @param repopulate flag indicating a repopulation + @type bool """ self._addWatchedItem(parentItem) @@ -434,9 +465,13 @@ don't exist. @param type_ type of the item - @param name name of the item (string) - @param dontSplit flag indicating the name should not be split (boolean) - @return reference to the item found and the new display name (string) + @type str + @param name name of the item + @type str + @param dontSplit flag indicating the name should not be split + @type bool + @return reference to the item found and the new display name + @rtype str """ if dontSplit: pathlist = [] @@ -474,10 +509,14 @@ """ Public method to find a child item given some text. - @param text text to search for (string) - @param column column to search in (integer) + @param text text to search for + @type str + @param column column to search in + @type int @param parentItem reference to parent item + @type BrowserItem @return reference to the item found + @rtype BrowserItem """ if parentItem is None: parentItem = self.rootItem @@ -492,9 +531,12 @@ """ Public method to add a new item to the model. - @param typeString string denoting the type of the new item (string) - @param name name of the new item (string) - @param additionalTypeStrings names of additional types (list of string) + @param typeString string denoting the type of the new item + @type str + @param name name of the new item + @type str + @param additionalTypeStrings names of additional types + @type list of str """ # Show the entry in bold in the others browser to make it more # distinguishable @@ -543,8 +585,10 @@ """ Public method to rename an item. - @param name the old display name (string) - @param newFilename new filename of the item (string) + @param name the old display name + @type str + @param newFilename new filename of the item + @type str """ itm = self.findItem(name) if itm is None: @@ -559,8 +603,10 @@ """ Public method to find an item given its name. - @param name name of the item (string) + @param name name of the item + @type str @return reference to the item found + @rtype BrowserItem """ if QDir.isAbsolutePath(name): name = self.project.getRelativePath(name) @@ -580,8 +626,10 @@ """ Public method to find an item's index given its name. - @param name name of the item (string) - @return index of the item found (QModelIndex) + @param name name of the item + @type str + @return index of the item found + @rtype QModelIndex """ itm = self.findItem(name) index = self.createIndex(itm.row(), 0, itm) if itm else QModelIndex() @@ -591,9 +639,12 @@ """ Public method to find an item's index given its name. - @param name name of the item (string) - @param lineno one based line number of the item (integer) - @return index of the item found (QModelIndex) + @param name name of the item + @type str + @param lineno one based line number of the item + @type int + @return index of the item found + @rtype QModelIndex """ index = QModelIndex() itm = self.findItem(name) @@ -638,7 +689,8 @@ """ Public slot to handle the directoryChanged signal of the watcher. - @param path path of the directory (string) + @param path path of the directory + @type str """ if not self.__watcherActive: return @@ -723,7 +775,9 @@ Private method used to set the vcs status of a node. @param item item to work on - @param name filename belonging to this item (string) + @type BrowserItem + @param name filename belonging to this item + @type str """ vcs = self.project.vcs if vcs is not None: @@ -740,8 +794,11 @@ Private method used to update the vcs status of a node. @param item item to work on - @param name filename belonging to this item (string) - @param recursive flag indicating a recursive update (boolean) + @type BrowserItem + @param name filename belonging to this item + @type str + @param recursive flag indicating a recursive update + @type bool """ vcs = self.project.vcs if vcs is not None: @@ -766,8 +823,10 @@ """ Public method used to update the vcs status of a node. - @param name filename belonging to this item (string) - @param recursive flag indicating a recursive update (boolean) + @param name filename belonging to this item + @type str + @param recursive flag indicating a recursive update + @type bool """ item = self.findItem(name) if item: @@ -777,7 +836,8 @@ """ Public method to remove a named item. - @param name file or directory name of the item (string). + @param name file or directory name of the item + @type str """ fname = os.path.basename(name) parentItem = self.findParentItemByName(0, name)[0] @@ -796,7 +856,8 @@ """ Public method to repopulate an item. - @param name name of the file relative to the project root (string) + @param name name of the file relative to the project root + @type str """ itm = self.findItem(name) if itm is None: @@ -827,10 +888,9 @@ """ Public slot to record the (non normal) VCS states. - @param statesList list of VCS state entries (list of strings) giving - the states in the first column and the path relative to the project - directory starting with the third column. The allowed status flags - are: + @param statesList list of VCS state entries giving the states in the + first column and the path relative to the project directory starting + with the third column. The allowed status flags are: <ul> <li>"A" path was added but not yet comitted</li> <li>"M" path has local changes</li> @@ -840,6 +900,7 @@ <li>"Z" path contains a conflict</li> <li>" " path is back at normal</li> </ul> + @type list of str """ statesList.sort() lastHead = "" @@ -891,9 +952,11 @@ """ Private method to recursively change the parents VCS state. - @param path pathname of parent item (string) + @param path pathname of parent item + @type str @param itemCache reference to the item cache used to store references to named items + @type dict """ while path: try: