examples:Showcase fix higherchy navigation.

This commit is contained in:
qua-non 2013-12-16 03:30:52 +05:30
parent c0e8d0ff15
commit b4959b8fdd
2 changed files with 11 additions and 5 deletions

View File

@ -73,6 +73,16 @@ class ShowcaseApp(App):
self.root.ids.sm.switch_to(self.load_screen(idx), direction='left')
self.update_sourcecode()
def go_higherarchy_previous(self):
ahr = self.higherarchy
if len(ahr) == 1:
return
if ahr:
ahr.pop()
if ahr:\
idx = ahr.pop();\
self.go_screen(idx)
def load_screen(self, index):
if index in self.screens:
return self.screens[index]

View File

@ -52,11 +52,7 @@ BoxLayout:
ActionPrevious:
with_previous: (False if sm.current_screen.name == 'button' else True) if sm.current_screen else False
title: 'Showcase' + ('' if not app.current_title else ' - {}'.format(app.current_title))
on_release:
if app.higherarchy: app.higherarchy.pop()
if app.higherarchy:\
idx = app.higherarchy.pop();\
app.go_screen(idx)
on_release: app.go_higherarchy_previous()
ActionSpinner:
id: spnr