From 69961335bf25bf26e5a0870602fe3ed6a8f3efa0 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Fri, 22 Apr 2022 12:26:55 +0530 Subject: [PATCH] Created a common method for empty screen label --- src/bitmessagekivy/baseclass/addressbook.py | 6 +++-- .../baseclass/addressbook_widgets.py | 22 +------------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/bitmessagekivy/baseclass/addressbook.py b/src/bitmessagekivy/baseclass/addressbook.py index 8e6cd860..931c7ac2 100644 --- a/src/bitmessagekivy/baseclass/addressbook.py +++ b/src/bitmessagekivy/baseclass/addressbook.py @@ -26,7 +26,7 @@ import state from bitmessagekivy.get_platform import platform from bitmessagekivy import kivy_helper_search from bitmessagekivy.baseclass.common import ( - avatarImageFirstLetter, toast, + avatarImageFirstLetter, toast, empty_screen_label, ThemeClsColor, SwipeToDeleteItem ) from bitmessagekivy.baseclass.popup import AddbookDetailPopup @@ -42,6 +42,8 @@ class AddressBook(Screen, HelperAddressBook): has_refreshed = True address_label = StringProperty() address = StringProperty() + label_str = "No contact Address found yet......" + no_search_res_found = "No search result found" def __init__(self, *args, **kwargs): """Getting AddressBook Details""" @@ -71,7 +73,7 @@ class AddressBook(Screen, HelperAddressBook): self.set_mdList(0, 20) self.ids.scroll_y.bind(scroll_y=self.check_scroll_y) else: - self.ids.ml.add_widget(self.default_label_when_empty()) + self.ids.ml.add_widget(empty_screen_label(self.label_str, self.no_search_res_found)) def set_mdList(self, start_index, end_index): """Creating the mdList""" diff --git a/src/bitmessagekivy/baseclass/addressbook_widgets.py b/src/bitmessagekivy/baseclass/addressbook_widgets.py index e8cd982d..a1f5c5f4 100644 --- a/src/bitmessagekivy/baseclass/addressbook_widgets.py +++ b/src/bitmessagekivy/baseclass/addressbook_widgets.py @@ -6,31 +6,11 @@ Addressbook widgets are here. from kivymd.uix.button import MDRaisedButton from kivymd.uix.dialog import MDDialog -from kivymd.uix.label import MDLabel import state -no_address_found = "No contact found yet......" -empty_search_label = "No contact found!" - -# pylint: disable=no-init, old-style-class -class DefaultLabelMixin: - """Common label on blank screen""" - - @staticmethod - def default_label_when_empty(): - """This function returns default message while no address is there.""" - content = MDLabel( - font_style='Caption', - theme_text_color='Primary', - # FIXME: searching_text supposed to be inside kivy_sate.py, typo and need to create a PR for kivy_state.py - text=empty_search_label if state.searching_text else no_address_found, - halign='center', size_hint_y=None, valign='top') - return content - - -class HelperAddressBook(DefaultLabelMixin): +class HelperAddressBook(object): """Widget used in Addressbook are here""" @staticmethod