diff --git a/examples/demo/showcase/main.py b/examples/demo/showcase/main.py index 342bf5cc2..43142556c 100755 --- a/examples/demo/showcase/main.py +++ b/examples/demo/showcase/main.py @@ -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] diff --git a/examples/demo/showcase/showcase.kv b/examples/demo/showcase/showcase.kv index 95136575d..96003aeee 100644 --- a/examples/demo/showcase/showcase.kv +++ b/examples/demo/showcase/showcase.kv @@ -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