From b4959b8fdd17cfabb96a3c5e53b51b8ce9d17686 Mon Sep 17 00:00:00 2001 From: qua-non Date: Mon, 16 Dec 2013 03:30:52 +0530 Subject: [PATCH] examples:Showcase fix higherchy navigation. --- examples/demo/showcase/main.py | 10 ++++++++++ examples/demo/showcase/showcase.kv | 6 +----- 2 files changed, 11 insertions(+), 5 deletions(-) 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