Allow Tabs object to be sliced
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
2a75589747
commit
bb9bc80d9b
1 changed files with 4 additions and 4 deletions
|
@ -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"""
|
||||
|
|
Loading…
Reference in a new issue