diff --git a/src/bitmessagekivy/baseclass/payment.py b/src/bitmessagekivy/baseclass/payment.py index 3c007ee1..5b27d39e 100644 --- a/src/bitmessagekivy/baseclass/payment.py +++ b/src/bitmessagekivy/baseclass/payment.py @@ -16,26 +16,32 @@ from kivymd.uix.list import ( from bitmessagekivy.baseclass.common import toast # import queues -import state +# import state class Payment(Screen): """Payment Screen class for kivy Ui""" - kivy_running_app = App.get_running_app() - kivy_state = kivy_running_app.kivy_state_obj + + def __init__(self, *args, **kwargs): + super(Payment, self).__init__(*args, **kwargs) + self.kivy_running_app = App.get_running_app() + self.kivy_state = self.kivy_running_app.kivy_state_obj def get_free_credits(self, instance): """Get the available credits""" # pylint: disable=no-self-use self.kivy_state.availabe_credit = instance.parent.children[1].text - existing_credits = state.kivyapp.root.ids.sc18.ids.cred.text + # existing_credits = state.kivyapp.root.ids.sc18.ids.cred.text + existing_credits = self.kivy_running_app.root.ids.sc18.ids.cred.text if float(existing_credits.split()[1]) > 0: toast( - 'We already have added free coins' + 'We already have added free Credit' ' for the subscription to your account!') else: - toast('Coins added to your account!') - state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format( + toast('Credit added to your account!') + # state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format( + # self.kivy_state.availabe_credit) + self.kivy_running_app.root.ids.sc18.ids.cred.text = '{0}'.format( self.kivy_state.availabe_credit) @staticmethod diff --git a/src/bitmessagekivy/baseclass/qrcode.py b/src/bitmessagekivy/baseclass/qrcode.py index 7729e541..1fac894a 100644 --- a/src/bitmessagekivy/baseclass/qrcode.py +++ b/src/bitmessagekivy/baseclass/qrcode.py @@ -2,18 +2,25 @@ from kivy.uix.screenmanager import Screen from kivy.properties import StringProperty from kivy_garden.qrcode import QRCodeWidget from bitmessagekivy.baseclass.common import toast -import state +from kivy.app import App + 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, instasnce, address): """Method used for showing QR Code""" self.ids.qr.clear_widgets() - state.kivyapp.set_toolbar_for_QrCode() + self.kivy_running_app.set_toolbar_for_QrCode() self.address = address - self.ids.qr.add_widget(QRCodeWidget(data=address)) + self.ids.qr.add_widget(QRCodeWidget(data=self.address)) self.ids.qr.children[0].show_border = False instasnce.parent.parent.parent.dismiss() toast('Show QR code')