Implement new feature for back button for screen tracking back with keyboard event attach

This commit is contained in:
surbhi 2018-09-05 15:42:41 +05:30
parent a961a4a2fb
commit a8be2e764a
No known key found for this signature in database
GPG Key ID: 88928762974D3618
2 changed files with 22 additions and 1 deletions

View File

@ -54,7 +54,16 @@ BoxLayout:
size_hint_x: 0.1
pos_hint: {'x': 0.8, 'y':0.4}
on_press: app.say_exit()
ActionBar:
size_hint_y: 0.4
size_hint_x: 0.1
pos_hint: {'x': 0.99, 'y':0.35}
background_color: (0,0,0,0)
ActionView:
use_separator: True
ActionPrevious:
with_previous: True
on_release: app.set_previous_screen()
ScreenManager:
id: scr_mngr

View File

@ -19,6 +19,7 @@ from bmconfigparser import BMConfigParser
from helper_ackPayload import genAckPayload
from addresses import decodeAddress, addBMIfNotPresent
from helper_sql import sqlExecute
from kivy.core.window import Window
statusIconColor = 'red'
@ -38,8 +39,19 @@ class NavigateApp(App, TextInput):
main_widget = Builder.load_file(
os.path.join(os.path.dirname(__file__), 'main.kv'))
self.nav_drawer = Navigator()
Window.bind(on_keyboard=self._key_handler)
return main_widget
def _key_handler(self, instance, key, *args):
if key is 27:
self.set_previous_screen()
return True
def set_previous_screen(self):
if self.root.ids.scr_mngr.current != 'inbox':
self.root.ids.scr_mngr.transition.direction = 'left'
self.root.ids.scr_mngr.current = self.root.ids.scr_mngr.previous()
def getCurrentAccountData(self, text):
"""Get Current Address Account Data."""
state.association = text