Skip to content

kivy-code-quality-6 #2292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v0.6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions src/bitmessagekivy/baseclass/myaddress_widgets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# pylint: disable=too-many-arguments, no-name-in-module, import-error
# pylint: disable=too-few-public-methods, no-member, too-many-ancestors
# pylint: disable=too-many-arguments, no-name-in-module, import-error, no-init
# pylint: disable=too-few-public-methods, no-member, too-many-ancestors, useless-object-inheritance

"""
MyAddress widgets are here.
Widgets for the MyAddress module.
"""

from kivymd.uix.button import MDFlatButton
Expand All @@ -15,44 +15,49 @@


class BadgeText(IRightBodyTouch, MDLabel):
"""BadgeText class for kivy UI"""
"""Class representing a badge text in the UI."""


class HelperMyAddress(object):
"""Widget used in MyAddress are here"""
dialog_height = .25
"""Helper class to manage MyAddress widgets and dialogs."""

dialog_height = 0.25 # Consistent decimal notation

@staticmethod
def is_active_badge():
"""This function show the 'active' label of active Address."""
"""Return a label showing 'Active' status for the address."""
active_status = 'Active'
is_android_width = 90
width = 50
height = 60
badge_obj = BadgeText(
badge_width = 90 if platform == 'android' else 50
badge_height = 60

return BadgeText(
size_hint=(None, None),
size=[is_android_width if platform == 'android' else width, height],
text=active_status, halign='center',
font_style='Body1', theme_text_color='Custom',
text_color=ThemeClsColor, font_size='13sp'
size=[badge_width, badge_height],
text=active_status,
halign='center',
font_style='Body1',
theme_text_color='Custom',
text_color=ThemeClsColor,
font_size='13sp'
)
return badge_obj

@staticmethod
def myaddress_detail_popup(obj, width):
"""This method show the details of address as popup opens."""
show_myaddress_dialogue = MDDialog(
"""Show address details in a popup dialog."""
return MDDialog(
type="custom",
size_hint=(width, HelperMyAddress.dialog_height),
content_cls=obj,
)
return show_myaddress_dialogue

@staticmethod
def inactive_address_popup(width, callback_for_menu_items):
"""This method shows the warning popup if the address is inactive"""
dialog_text = 'Address is not currently active. Please click on Toggle button to active it.'
dialog_box = MDDialog(
"""Show a warning dialog when the address is inactive."""
dialog_text = (
'Address is not currently active. Please click the Toggle button to activate it.'
)

return MDDialog(
text=dialog_text,
size_hint=(width, HelperMyAddress.dialog_height),
buttons=[
Expand All @@ -61,4 +66,3 @@ def inactive_address_popup(width, callback_for_menu_items):
),
],
)
return dialog_box