diff -r 9986ec0e559a -r 10516539f238 Project/ProjectBrowserModel.py --- a/Project/ProjectBrowserModel.py Tue Oct 15 22:03:54 2013 +0200 +++ b/Project/ProjectBrowserModel.py Fri Oct 18 23:00:41 2013 +0200 @@ -108,7 +108,8 @@ class ProjectBrowserSimpleDirectoryItem(BrowserItem, ProjectBrowserItemMixin): """ - Class implementing the data structure for project browser simple directory items. + Class implementing the data structure for project browser simple directory + items. """ def __init__(self, parent, projectType, text, path=""): """ @@ -167,7 +168,8 @@ return BrowserItem.lessThan(self, other, column, order) -class ProjectBrowserDirectoryItem(BrowserDirectoryItem, ProjectBrowserItemMixin): +class ProjectBrowserDirectoryItem(BrowserDirectoryItem, + ProjectBrowserItemMixin): """ Class implementing the data structure for project browser directory items. """ @@ -265,7 +267,8 @@ "Z": Preferences.getProjectBrowserColour(self.colorNames["Z"]), } - self.highLightColor = Preferences.getProjectBrowserColour("Highlighted") + self.highLightColor = \ + Preferences.getProjectBrowserColour("Highlighted") # needed by preferencesChanged() self.vcsStatusReport = {} @@ -289,7 +292,8 @@ return None elif role == Qt.BackgroundColorRole: try: - col = self.itemBackgroundColors[index.internalPointer().vcsState] + col = self.itemBackgroundColors[ + index.internalPointer().vcsState] if col.isValid(): return col else: @@ -329,14 +333,17 @@ qdir = QDir(parentItem.dirName()) if Preferences.getUI("BrowsersListHiddenFiles"): - filter = QDir.Filters(QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot) + filter = QDir.Filters(QDir.AllEntries | + QDir.Hidden | + QDir.NoDotAndDotDot) else: filter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot) entryInfoList = qdir.entryInfoList(filter) if len(entryInfoList) > 0: if repopulate: - self.beginInsertRows(self.createIndex(parentItem.row(), 0, parentItem), + self.beginInsertRows(self.createIndex( + parentItem.row(), 0, parentItem), 0, len(entryInfoList) - 1) states = {} if self.project.vcs is not None: @@ -358,9 +365,11 @@ parentItem.getProjectTypes()[0]) if self.project.vcs is not None: fname = f.absoluteFilePath() - if states[os.path.normcase(fname)] == self.project.vcs.canBeCommitted: + if states[os.path.normcase(fname)] == \ + self.project.vcs.canBeCommitted: node.addVcsStatus(self.project.vcs.vcsName()) - self.project.clearStatusMonitorCachedState(f.absoluteFilePath()) + self.project.clearStatusMonitorCachedState( + f.absoluteFilePath()) else: node.addVcsStatus(self.trUtf8("local")) self._addItem(node, parentItem) @@ -386,7 +395,8 @@ def projectOpened(self): """ - Public method used to populate the model after a project has been opened. + Public method used to populate the model after a project has been + opened. """ self.__vcsStatus = {} states = {} @@ -395,14 +405,17 @@ if self.project.vcs is not None: for key in keys: for fn in self.project.pdata[key]: - states[os.path.normcase(os.path.join(self.project.ppath, fn))] = 0 + states[os.path.normcase( + os.path.join(self.project.ppath, fn))] = 0 self.project.vcs.clearStatusCache() - states = self.project.vcs.vcsAllRegisteredStates(states, self.project.ppath) + states = self.project.vcs.vcsAllRegisteredStates( + states, self.project.ppath) self.inRefresh = True for key in keys: - # Show the entry in bold in the others browser to make it more distinguishable + # Show the entry in bold in the others browser to make it more + # distinguishable if key == "OTHERS": bold = True else: @@ -415,8 +428,8 @@ for fn in self.project.pdata[key]: fname = os.path.join(self.project.ppath, fn) - parentItem, dt = \ - self.findParentItemByName(self.projectBrowserTypes[key], fn) + parentItem, dt = self.findParentItemByName( + self.projectBrowserTypes[key], fn) if os.path.isdir(fname): itm = ProjectBrowserDirectoryItem(parentItem, fname, self.projectBrowserTypes[key], False, bold) @@ -426,7 +439,8 @@ sourceLanguage=sourceLanguage) self._addItem(itm, parentItem) if self.project.vcs is not None: - if states[os.path.normcase(fname)] == self.project.vcs.canBeCommitted: + if states[os.path.normcase(fname)] == \ + self.project.vcs.canBeCommitted: itm.addVcsStatus(self.project.vcs.vcsName()) else: itm.addVcsStatus(self.trUtf8("local")) @@ -461,7 +475,8 @@ itm = self.findChildItem(p, 0, olditem) path = os.path.join(path, p) if itm is None: - itm = ProjectBrowserSimpleDirectoryItem(olditem, type_, p, path) + itm = ProjectBrowserSimpleDirectoryItem( + olditem, type_, p, path) self.__addVCSStatus(itm, path) if self.inRefresh: self._addItem(itm, olditem) @@ -469,7 +484,8 @@ if olditem == self.rootItem: oldindex = QModelIndex() else: - oldindex = self.createIndex(olditem.row(), 0, olditem) + oldindex = self.createIndex( + olditem.row(), 0, olditem) self.addItem(itm, oldindex) else: if type_ and type_ not in itm.getProjectTypes(): @@ -507,15 +523,16 @@ @param name name of the new item (string) @param additionalTypeStrings names of additional types (list of string) """ - # Show the entry in bold in the others browser to make it more distinguishable + # Show the entry in bold in the others browser to make it more + # distinguishable if typeString == "OTHERS": bold = True else: bold = False fname = os.path.join(self.project.ppath, name) - parentItem, dt = \ - self.findParentItemByName(self.projectBrowserTypes[typeString], name) + parentItem, dt = self.findParentItemByName( + self.projectBrowserTypes[typeString], name) if parentItem == self.rootItem: parentIndex = QModelIndex() else: @@ -638,7 +655,9 @@ return if Preferences.getUI("BrowsersListHiddenFiles"): - filter = QDir.Filters(QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot) + filter = QDir.Filters(QDir.AllEntries | + QDir.Hidden | + QDir.NoDotAndDotDot) else: filter = QDir.Filters(QDir.AllEntries | QDir.NoDotAndDotDot) @@ -811,8 +830,8 @@ """ 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 + @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: <ul>