Add __len__ to WebHistory.

This commit is contained in:
Florian Bruhin 2015-03-13 19:45:43 +01:00
parent 994546f04d
commit 901db0911e

View File

@ -89,7 +89,7 @@ class WebHistory(QWebHistoryInterface):
'history', self.save, self.item_added)
def __repr__(self):
return utils.get_repr(self, new_length=len(self._new_history))
return utils.get_repr(self, length=len(self))
def __getitem__(self, key):
return self._new_history[key]
@ -97,6 +97,9 @@ class WebHistory(QWebHistoryInterface):
def __iter__(self):
return iter(self._history_dict.values())
def __len__(self):
return len(self._history_dict)
def get_recent(self):
"""Get the most recent history entries."""
old = self._lineparser.get_recent()