Skip to content

Commit b4959b8

Browse files
committed
examples:Showcase fix higherchy navigation.
1 parent c0e8d0f commit b4959b8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

examples/demo/showcase/main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ def go_screen(self, idx):
7373
self.root.ids.sm.switch_to(self.load_screen(idx), direction='left')
7474
self.update_sourcecode()
7575

76+
def go_higherarchy_previous(self):
77+
ahr = self.higherarchy
78+
if len(ahr) == 1:
79+
return
80+
if ahr:
81+
ahr.pop()
82+
if ahr:\
83+
idx = ahr.pop();\
84+
self.go_screen(idx)
85+
7686
def load_screen(self, index):
7787
if index in self.screens:
7888
return self.screens[index]

examples/demo/showcase/showcase.kv

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ BoxLayout:
5252
ActionPrevious:
5353
with_previous: (False if sm.current_screen.name == 'button' else True) if sm.current_screen else False
5454
title: 'Showcase' + ('' if not app.current_title else ' - {}'.format(app.current_title))
55-
on_release:
56-
if app.higherarchy: app.higherarchy.pop()
57-
if app.higherarchy:\
58-
idx = app.higherarchy.pop();\
59-
app.go_screen(idx)
55+
on_release: app.go_higherarchy_previous()
6056

6157
ActionSpinner:
6258
id: spnr

0 commit comments

Comments
 (0)