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
3
3
4
4
"""
5
- MyAddress widgets are here .
5
+ Widgets for the MyAddress module .
6
6
"""
7
7
8
8
from kivymd .uix .button import MDFlatButton
15
15
16
16
17
17
class BadgeText (IRightBodyTouch , MDLabel ):
18
- """BadgeText class for kivy UI """
18
+ """Class representing a badge text in the UI. """
19
19
20
20
21
21
class 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
24
25
25
26
@staticmethod
26
27
def is_active_badge ():
27
- """This function show the 'active' label of active Address ."""
28
+ """Return a label showing 'Active' status for the address ."""
28
29
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 (
33
34
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'
38
42
)
39
- return badge_obj
40
43
41
44
@staticmethod
42
45
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 (
45
48
type = "custom" ,
46
49
size_hint = (width , HelperMyAddress .dialog_height ),
47
50
content_cls = obj ,
48
51
)
49
- return show_myaddress_dialogue
50
52
51
53
@staticmethod
52
54
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 (
56
61
text = dialog_text ,
57
62
size_hint = (width , HelperMyAddress .dialog_height ),
58
63
buttons = [
@@ -61,4 +66,3 @@ def inactive_address_popup(width, callback_for_menu_items):
61
66
),
62
67
],
63
68
)
64
- return dialog_box
0 commit comments