--- a/eric6/WebBrowser/History/HistoryFilterModel.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/History/HistoryFilterModel.py Wed Sep 25 18:48:22 2019 +0200 @@ -34,9 +34,11 @@ @param other reference to the object to check against (HistoryData) @return flag indicating equality (boolean) """ - return self.tailOffset == other.tailOffset and \ + return ( + self.tailOffset == other.tailOffset and (self.frequency == -1 or other.frequency == -1 or self.frequency == other.frequency) + ) def __lt__(self, other): """ @@ -240,8 +242,12 @@ parent = QModelIndex() self.__load() - if row < 0 or row >= self.rowCount(parent) or \ - column < 0 or column >= self.columnCount(parent): + if ( + row < 0 or + row >= self.rowCount(parent) or + column < 0 or + column >= self.columnCount(parent) + ): return QModelIndex() return self.createIndex(row, column, @@ -279,8 +285,8 @@ # 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) + self.__filteredRows[row].frequency += self.__frequencyScore( + idx) self.__loaded = True @@ -338,20 +344,26 @@ if parent is None: parent = QModelIndex() - if row < 0 or \ - count <= 0 or \ - row + count > self.rowCount(parent) or \ - parent.isValid(): + if ( + row < 0 or + count <= 0 or + row + count > self.rowCount(parent) or + parent.isValid() + ): return False lastRow = row + count - 1 self.sourceModel().rowsRemoved.disconnect(self.__sourceRowsRemoved) self.beginRemoveRows(parent, row, lastRow) oldCount = self.rowCount() - start = self.sourceModel().rowCount() - \ + start = ( + self.sourceModel().rowCount() - self.__filteredRows[row].tailOffset - end = self.sourceModel().rowCount() - \ + ) + end = ( + self.sourceModel().rowCount() - self.__filteredRows[lastRow].tailOffset + ) self.sourceModel().removeRows(start, end - start + 1) self.endRemoveRows() self.sourceModel().rowsRemoved.connect(self.__sourceRowsRemoved) @@ -368,8 +380,8 @@ @param sourceIndex index of the source model (QModelIndex) @return frequency score (integer) """ - loadTime = \ - self.sourceModel().data(sourceIndex, HistoryModel.DateTimeRole) + loadTime = self.sourceModel().data( + sourceIndex, HistoryModel.DateTimeRole) days = loadTime.daysTo(self.__scaleTime) if days <= 1: