| 1 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
| 2 |
# |
| 3 |
# Copyright (C) 2012, 2013, 2014 Canonical Ltd. |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU Lesser General Public License as published by |
| 7 |
# the Free Software Foundation; version 3. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU Lesser General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU Lesser General Public License |
| 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
from lomiriuitoolkit._custom_proxy_objects import _common |
| 18 |
|
| 19 |
|
| 20 |
class Tabs(_common.LomiriUIToolkitCustomProxyObjectBase): |
| 21 |
"""Tabs Autopilot custom proxy object.""" |
| 22 |
|
| 23 |
def get_current_tab(self): |
| 24 |
"""Return the currently selected tab.""" |
| 25 |
return self._get_tab(self.selectedTabIndex) |
| 26 |
|
| 27 |
def _get_tab(self, index): |
| 28 |
tabs = self._get_tabs() |
| 29 |
for tab in tabs: |
| 30 |
if tab.index == index: |
| 31 |
return tab |
| 32 |
else: |
| 33 |
raise _common.ToolkitException( |
| 34 |
'There is no tab with index {0}.'.format(index)) |
| 35 |
|
| 36 |
def _get_tabs(self): |
| 37 |
return self.select_many('Tab') |
| 38 |
|
| 39 |
def get_number_of_tabs(self): |
| 40 |
"""Return the number of tabs.""" |
| 41 |
return len(self._get_tabs()) |