payment.py
1 # pylint: disable=import-error, no-name-in-module, too-few-public-methods, too-many-ancestors 2 3 """ 4 Payment/subscription frontend 5 """ 6 7 from kivy.uix.boxlayout import BoxLayout 8 from kivy.uix.screenmanager import Screen 9 from kivy.app import App 10 11 from kivymd.uix.behaviors.elevation import RectangularElevationBehavior 12 from kivymd.uix.label import MDLabel 13 from kivymd.uix.list import IRightBodyTouch, OneLineAvatarIconListItem 14 15 from pybitmessage.bitmessagekivy.baseclass.common import toast, kivy_state_variables 16 17 18 class Payment(Screen): 19 """Payment Screen class for Kivy UI""" 20 21 def __init__(self, *args, **kwargs): 22 """Instantiate Kivy state variable""" 23 super().__init__(*args, **kwargs) # pylint: disable=missing-super-argument 24 self.kivy_state = kivy_state_variables() 25 26 # TODO: get_free_credits() is not used anywhere, will be used later for Payment/subscription. 27 def get_free_credits(self, instance): # pylint: disable=unused-argument 28 """Get the available credits""" 29 self.kivy_state.available_credit = 0 30 existing_credits = 0 31 if existing_credits > 0: 32 toast( 33 'We already have added free credit' 34 ' for the subscription to your account!') 35 else: 36 toast('Credit added to your account!') 37 # TODO: There is no sc18 screen id is available, 38 # need to create sc18 for Credits screen inside main.kv 39 App.get_running_app().root.ids.sc18.ids.cred.text = f'{self.kivy_state.available_credit}' # noqa: E999 40 41 42 class Category(BoxLayout, RectangularElevationBehavior): 43 """Category class for kivy Ui""" 44 elevation_normal = .01 45 46 47 class ProductLayout(BoxLayout, RectangularElevationBehavior): 48 """ProductLayout class for kivy Ui""" 49 elevation_normal = .01 50 51 52 class PaymentMethodLayout(BoxLayout): 53 """PaymentMethodLayout class for kivy Ui""" 54 55 56 class ListItemWithLabel(OneLineAvatarIconListItem): 57 """ListItemWithLabel class for kivy Ui""" 58 59 60 class RightLabel(IRightBodyTouch, MDLabel): 61 """RightLabel class for kivy Ui"""