From 76d6e4009b442731003ad128687fd9eb6141ce14 Mon Sep 17 00:00:00 2001
From: osamacis <mohammad.o@cisinlabs.com>
Date: Mon, 21 Nov 2022 16:29:39 +0530
Subject: [PATCH] Add back press in mpybit

---
 src/bitmessagekivy/mpybit.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py
index 2c92bfb6..4f0b363b 100644
--- a/src/bitmessagekivy/mpybit.py
+++ b/src/bitmessagekivy/mpybit.py
@@ -422,6 +422,25 @@ class NavigateApp(MDApp):
         if self.root.ids.id_newidentity.ids.add_random_bx.children:
             self.root.ids.id_newidentity.ids.add_random_bx.clear_widgets()
 
+    def reset(self, *args):
+        """Set transition direction"""
+        self.root.ids.scr_mngr.transition.direction = 'left'
+        self.root.ids.scr_mngr.transition.unbind(on_complete=self.reset)
+
+    def back_press(self):
+        """Method for, reverting composer to previous page"""
+        if self.root.ids.scr_mngr.current == 'showqrcode':
+            self.set_common_header()
+            self.root.ids.scr_mngr.current = 'myaddress'
+        self.root.ids.scr_mngr.transition.bind(on_complete=self.reset)
+        self.kivy_state.in_composer = False
+
+    def set_toolbar_for_QrCode(self):
+        """This method is use for setting Qr code toolbar."""
+        self.root.ids.toolbar.left_action_items = [
+            ['arrow-left', lambda x: self.back_press()]]
+        self.root.ids.toolbar.right_action_items = []
+
     def set_common_header(self):
         """Common header for all the Screens"""
         self.root.ids.toolbar.right_action_items = [