update payment screen state varialble

This commit is contained in:
shekhar-cis 2022-06-15 16:57:46 +05:30
parent 777a9830c3
commit 7bc8b8391d
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7

View File

@ -5,6 +5,8 @@ from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import Screen from kivy.uix.screenmanager import Screen
from kivy.app import App from kivy.app import App
from bitmessagekivy.baseclass.common import kivy_state_variables
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from kivymd.uix.label import MDLabel from kivymd.uix.label import MDLabel
from kivymd.uix.list import ( from kivymd.uix.list import (
@ -24,15 +26,14 @@ class Payment(Screen):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(Payment, self).__init__(*args, **kwargs) super(Payment, self).__init__(*args, **kwargs)
self.kivy_running_app = App.get_running_app() self.kivy_state = kivy_state_variables()
self.kivy_state = self.kivy_running_app.kivy_state_obj
def get_free_credits(self, instance): def get_free_credits(self, instance):
"""Get the available credits""" """Get the available credits"""
# pylint: disable=no-self-use # pylint: disable=no-self-use
self.kivy_state.availabe_credit = instance.parent.children[1].text 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.texpt
existing_credits = self.kivy_running_app.root.ids.sc18.ids.cred.text existing_credits = App.get_running_app().root.ids.sc18.ids.cred.text
if float(existing_credits.split()[1]) > 0: if float(existing_credits.split()[1]) > 0:
toast( toast(
'We already have added free Credit' 'We already have added free Credit'