Allow Tabs object to be sliced

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2018-09-09 13:39:46 +01:00
parent 2a75589747
commit bb9bc80d9b
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -67,10 +67,10 @@ class Tabs:
def __iter__(self):
return iter(self._tabs)
def __getitem__(self, index: Union[int, str]):
if isinstance(index, int):
return self._tabs[index]
return self.by_name(index)
def __getitem__(self, index: Union[int, str, slice]):
if isinstance(index, str):
return self.by_name(index)
return self._tabs[index]
def first(self) -> tabs.Tab:
"""Return the Roster tab"""