1- # pylint: disable=too-many-arguments, no-name-in-module, import-error
2- # pylint: disable=too-few-public-methods, no-member, too-many-ancestors
1+ # pylint: disable=too-many-arguments, no-name-in-module, import-error, no-init
2+ # pylint: disable=too-few-public-methods, no-member, too-many-ancestors, useless-object-inheritance
33
44"""
5- MyAddress widgets are here .
5+ Widgets for the MyAddress module .
66"""
77
88from kivymd .uix .button import MDFlatButton
1515
1616
1717class BadgeText (IRightBodyTouch , MDLabel ):
18- """BadgeText class for kivy UI """
18+ """Class representing a badge text in the UI. """
1919
2020
2121class HelperMyAddress (object ):
22- """Widget used in MyAddress are here"""
23- dialog_height = .25
22+ """Helper class to manage MyAddress widgets and dialogs."""
23+
24+ dialog_height = 0.25 # Consistent decimal notation
2425
2526 @staticmethod
2627 def is_active_badge ():
27- """This function show the 'active' label of active Address ."""
28+ """Return a label showing 'Active' status for the address ."""
2829 active_status = 'Active'
29- is_android_width = 90
30- width = 50
31- height = 60
32- badge_obj = BadgeText (
30+ badge_width = 90 if platform == 'android' else 50
31+ badge_height = 60
32+
33+ return BadgeText (
3334 size_hint = (None , None ),
34- size = [is_android_width if platform == 'android' else width , height ],
35- text = active_status , halign = 'center' ,
36- font_style = 'Body1' , theme_text_color = 'Custom' ,
37- text_color = ThemeClsColor , font_size = '13sp'
35+ size = [badge_width , badge_height ],
36+ text = active_status ,
37+ halign = 'center' ,
38+ font_style = 'Body1' ,
39+ theme_text_color = 'Custom' ,
40+ text_color = ThemeClsColor ,
41+ font_size = '13sp'
3842 )
39- return badge_obj
4043
4144 @staticmethod
4245 def myaddress_detail_popup (obj , width ):
43- """This method show the details of address as popup opens ."""
44- show_myaddress_dialogue = MDDialog (
46+ """Show address details in a popup dialog ."""
47+ return MDDialog (
4548 type = "custom" ,
4649 size_hint = (width , HelperMyAddress .dialog_height ),
4750 content_cls = obj ,
4851 )
49- return show_myaddress_dialogue
5052
5153 @staticmethod
5254 def inactive_address_popup (width , callback_for_menu_items ):
53- """This method shows the warning popup if the address is inactive"""
54- dialog_text = 'Address is not currently active. Please click on Toggle button to active it.'
55- dialog_box = MDDialog (
55+ """Show a warning dialog when the address is inactive."""
56+ dialog_text = (
57+ 'Address is not currently active. Please click the Toggle button to activate it.'
58+ )
59+
60+ return MDDialog (
5661 text = dialog_text ,
5762 size_hint = (width , HelperMyAddress .dialog_height ),
5863 buttons = [
@@ -61,4 +66,3 @@ def inactive_address_popup(width, callback_for_menu_items):
6166 ),
6267 ],
6368 )
64- return dialog_box
0 commit comments