From 5b615d5ab54ea1f53406b0d281f774c5033a056c Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Mon, 30 May 2022 13:59:13 +0530 Subject: [PATCH] Add kivy QR-code Screen --- src/bitmessagekivy/baseclass/qrcode.py | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/bitmessagekivy/baseclass/qrcode.py diff --git a/src/bitmessagekivy/baseclass/qrcode.py b/src/bitmessagekivy/baseclass/qrcode.py new file mode 100644 index 00000000..b3ad56b2 --- /dev/null +++ b/src/bitmessagekivy/baseclass/qrcode.py @@ -0,0 +1,31 @@ +# pylint: disable=import-error, no-name-in-module, too-few-public-methods + +""" +Generate QRcode of saved addresses in addressbook. +""" + +from kivy.app import App +from kivy.uix.screenmanager import Screen +from kivy.properties import StringProperty +from kivy_garden.qrcode import QRCodeWidget +from debug import logger + + +class ShowQRCode(Screen): + """ShowQRCode Screen class for kivy Ui""" + address = StringProperty() + + def __init__(self, *args, **kwargs): + """Instantiate kivy state variable""" + super(ShowQRCode, self).__init__(*args, **kwargs) + self.kivy_running_app = App.get_running_app() + + def qrdisplay(self, instance, address): + """Method used for showing QR Code""" + self.ids.qr.clear_widgets() + self.kivy_running_app.set_toolbar_for_QrCode() + self.address = address # used for label + self.ids.qr.add_widget(QRCodeWidget(data=self.address)) + self.ids.qr.children[0].show_border = False + instance.parent.parent.parent.dismiss() + logger.debug('Show QR code')