mirror of https://github.com/kivy/kivy.git
examples:Showcase fix higherchy navigation.
This commit is contained in:
parent
c0e8d0ff15
commit
b4959b8fdd
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue