Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improve example

  • Loading branch information...
commit 58ef4b5d2bf60dc4c62fa2aa0c867a049a8d9232 1 parent 31416c9
@akshayaurora akshayaurora authored
View
49 examples/widgets/tabbed_panel_test.py
@@ -24,15 +24,24 @@
tab_width: 70
default_tab_text: 'tab1'
default_content: cut
- BubbleButton:
- id: cut
- text: 'Cut'
- BubbleButton:
- id: copy
- text: 'Copy'
- BubbleButton:
- id: paste
- text: 'Paste'
+ FloatLayout:
+ BubbleButton:
+ id: cut
+ pos:self.parent.pos
+ size: self.parent.size
+ text: 'Cut'
+ Image:
+ id: copy
+ color: 1, 1, 1, 0
+ pos:self.parent.pos
+ size: self.parent.size
+ source: 'data/images/defaulttheme-0.png'
+ Image:
+ id: paste
+ color: 1, 1, 1, 0
+ pos:self.parent.pos
+ size: self.parent.size
+ source: 'data/images/image-loading.gif'
Tab_Heading:
text: 'tab2'
on_release: root.change_tab_contents(copy)
@@ -56,16 +65,22 @@ def on_default_tab(self, *l):
self.change_tab_contents(self.default_content)
def change_tab_contents(self, *l):
- anim = Animation( color=(1, 1, 1, 0), d =.27, t = 'in_back')
+ anim = Animation( color=(1, 1, 1, 0), d =.15, t = 'in_back')
- def start_anim(*l):
- anim.start(self.content.children[0])
+ def start_anim(_anim, *lt):
+ _anim.start(l[0])
+
+ def _on_complete(*lt):
+ self.clear_widgets()
+ self.add_widget(l[0])
+ anim = Animation( color = (1, 1, 1, 1), d =.23, t = 'in_quad')
+ start_anim(anim)
+
+ anim.bind(on_complete = _on_complete)
+ if l[0].parent:
+ l[0].parent.remove_widget(l[0])
+ start_anim(anim)
- start_anim()
- self.clear_widgets()
- self.add_widget(l[0])
- anim = Animation( color = (1, 1, 1, 1), d =.27, t = 'in_quad')
- start_anim()
class TabShowcase(FloatLayout):
View
2  kivy/data/style.kv
@@ -105,7 +105,7 @@
Color:
rgba: self.tabbed_pannel.background_color if self.tabbed_pannel else (1, 1, 1, 1)
BorderImage:
- border: (0, 0, 0, 0)
+ border: (9, 9, 9, 9)
texture: self.tabbed_pannel.background_texture if self.tabbed_pannel else None
size: self.size
pos: self.pos
View
8 kivy/uix/tabbedpannel.py
@@ -245,8 +245,6 @@ def __init__(self, **kwargs):
def on_default_tab(self, *l):
'''This event is fired when the default tab is selected.
-
- .. versionadded:: 1.0.1?
'''
def on_default_tab_text(self, *l):
@@ -394,11 +392,11 @@ def on_tab_pos(self, *l):
from functools import partial
if self_tab_pos[lentab_pos-4:] == '_top':
sctr.bind(top = Clock.schedule_once(
- partial(self.update_top, sctr, self.top), -1))
+ partial(self._update_top, sctr, self.top), -1))
tab_list = (sctr, )
elif self_tab_pos[lentab_pos-4:] == '_mid':
sctr.bind(top = Clock.schedule_once(
- partial(self.update_top, sctr,
+ partial(self._update_top, sctr,
self.top - (self.height - scrl_v.width)/2), -1))
tab_list = (Widget(), sctr, Widget())
elif self_tab_pos[lentab_pos-7:] == '_bottom':
@@ -419,5 +417,5 @@ def on_tab_pos(self, *l):
for widg in widget_list:
add(widg)
- def update_top(self, sctr, top, dt):
+ def _update_top(self, sctr, top, dt):
sctr.top = top
Please sign in to comment.
Something went wrong with that request. Please try again.