Helpviewer/History/HistoryFilterModel.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3002
6ffc581f00f1
child 3058
0a02c433f52d
--- a/Helpviewer/History/HistoryFilterModel.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Helpviewer/History/HistoryFilterModel.py	Fri Oct 18 23:00:41 2013 +0200
@@ -44,8 +44,8 @@
         """
         Special method determining less relation.
         
-        Note: Like the actual history entries the index mapping is sorted in reverse
-        order by offset
+        Note: Like the actual history entries the index mapping is sorted in
+        reverse order by offset
         
         @param other reference to the history data object to compare against
             (HistoryEntry)
@@ -122,7 +122,8 @@
         if self.sourceModel() is not None:
             self.sourceModel().modelReset.disconnect(self.__sourceReset)
             self.sourceModel().dataChanged.disconnect(self.__sourceDataChanged)
-            self.sourceModel().rowsInserted.disconnect(self.__sourceRowsInserted)
+            self.sourceModel().rowsInserted.disconnect(
+                self.__sourceRowsInserted)
             self.sourceModel().rowsRemoved.disconnect(self.__sourceRowsRemoved)
         
         super(HistoryFilterModel, self).setSourceModel(sourceModel)
@@ -235,7 +236,8 @@
            column < 0 or column >= self.columnCount(parent):
             return QModelIndex()
         
-        return self.createIndex(row, column, self.__filteredRows[row].tailOffset)
+        return self.createIndex(row, column,
+                                self.__filteredRows[row].tailOffset)
 
     def parent(self, index):
         """
@@ -267,8 +269,10 @@
                 self.__historyDict[url] = sourceOffset
             else:
                 # the url is known already, so just update the frequency score
-                row = self.__filteredRows.index(HistoryData(self.__historyDict[url], -1))
-                self.__filteredRows[row].frequency += self.__frequencyScore(idx)
+                row = self.__filteredRows.index(
+                    HistoryData(self.__historyDict[url], -1))
+                self.__filteredRows[row].frequency += \
+                    self.__frequencyScore(idx)
         
         self.__loaded = True
     
@@ -288,7 +292,8 @@
             url = idx.data(HistoryModel.UrlStringRole)
             currentFrequency = 0
             if url in self.__historyDict:
-                row = self.__filteredRows.index(HistoryData(self.__historyDict[url], -1))
+                row = self.__filteredRows.index(
+                    HistoryData(self.__historyDict[url], -1))
                 currentFrequency = self.__filteredRows[row].frequency
                 self.beginRemoveRows(QModelIndex(), row, row)
                 del self.__filteredRows[row]
@@ -296,7 +301,8 @@
                 self.endRemoveRows()
             
             self.beginInsertRows(QModelIndex(), 0, 0)
-            self.__filteredRows.insert(0, HistoryData(self.sourceModel().rowCount(),
+            self.__filteredRows.insert(
+                0, HistoryData(self.sourceModel().rowCount(),
                 self.__frequencyScore(idx) + currentFrequency))
             self.__historyDict[url] = self.sourceModel().rowCount()
             self.endInsertRows()
@@ -317,7 +323,7 @@
         
         @param row row of the first entry to remove (integer)
         @param count number of entries to remove (integer)
-        @param index of the parent entry (QModelIndex)
+        @param parent index of the parent entry (QModelIndex)
         @return flag indicating successful removal (boolean)
         """
         if row < 0 or \
@@ -330,8 +336,10 @@
         self.sourceModel().rowsRemoved.disconnect(self.__sourceRowsRemoved)
         self.beginRemoveRows(parent, row, lastRow)
         oldCount = self.rowCount()
-        start = self.sourceModel().rowCount() - self.__filteredRows[row].tailOffset
-        end = self.sourceModel().rowCount() - self.__filteredRows[lastRow].tailOffset
+        start = self.sourceModel().rowCount() - \
+            self.__filteredRows[row].tailOffset
+        end = self.sourceModel().rowCount() - \
+            self.__filteredRows[lastRow].tailOffset
         self.sourceModel().removeRows(start, end - start + 1)
         self.endRemoveRows()
         self.sourceModel().rowsRemoved.connect(self.__sourceRowsRemoved)

eric ide

mercurial