use correct transition in screen_manager.switch_to if user passes option like it's described in the docs

This commit is contained in:
hansent 2013-12-13 10:49:18 -06:00
parent 9a941dca2c
commit fdd0ff3b5d
1 changed files with 8 additions and 0 deletions

View File

@ -925,6 +925,7 @@ class ScreenManager(FloatLayout):
raise ScreenManagerException(
'ScreenManager accepts only Screen widget.')
# stop any transition that might be happening already
self.transition.stop()
@ -933,6 +934,12 @@ class ScreenManager(FloatLayout):
if self.has_screen(screen.name):
screen.name = self._generate_screen_name()
# change the transition if given explicitly
old_transition = self.transition
specified_transition = options.pop("transition", None)
if specified_transition:
self.transition = specified_transition
# change the transition options
for key, value in iteritems(options):
setattr(self.transition, key, value)
@ -947,6 +954,7 @@ class ScreenManager(FloatLayout):
def remove_old_screen(transition):
if old_current in self.children:
self.remove_widget(old_current)
self.transition = old_transition
transition.unbind(on_complete=remove_old_screen)
self.transition.bind(on_complete=remove_old_screen)