TabbedPanel: ensure first TabbedPanelItem selection

This commit is contained in:
Qua-non 2012-10-21 18:14:20 +05:30
parent e624412f35
commit c35dca3656
2 changed files with 6 additions and 3 deletions

View File

@ -15,9 +15,11 @@ Builder.load_string("""
<Test>:
size_hint: .5, .5
pos_hint: {'center_x': .5, 'center_y': .5}
do_default_tab: False
#do_default_tab: False
default_tab: tab2
TabbedPanelItem:
id: first_tab
text: 'first tab'
Label:
id: set1_content

View File

@ -415,7 +415,8 @@ class TabbedPanel(GridLayout):
if cls != TabbedPanelHeader:
self._current_tab = self._original_tab = self._default_tab = cls()
default_tab = self.default_tab
default_tab.text = self.default_tab_text
if self._original_tab == self.default_tab:
default_tab.text = self.default_tab_text
default_tab.height = self.tab_height
default_tab.group = '__tab%r__' % _tabs.uid
default_tab.state = 'down'
@ -443,7 +444,7 @@ class TabbedPanel(GridLayout):
def _switch_to_first_tab(self, *l):
ltl = len(self.tab_list) - 1
if ltl > 1:
if ltl > -1:
self._current_tab = dt = self._original_tab \
= self.tab_list[ltl]
self.switch_to(dt)