From f48b96aa0d659c5738c8ed83f70cc6aaed2381f8 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Fri, 22 Apr 2022 17:52:27 +0530 Subject: [PATCH] Moved empty_screen() to common.py --- src/bitmessagekivy/baseclass/addressbook.py | 6 ++-- .../baseclass/addressbook_widgets.py | 29 ++++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/bitmessagekivy/baseclass/addressbook.py b/src/bitmessagekivy/baseclass/addressbook.py index 7fcff0f6..ce89169c 100644 --- a/src/bitmessagekivy/baseclass/addressbook.py +++ b/src/bitmessagekivy/baseclass/addressbook.py @@ -17,7 +17,7 @@ import os from debug import logger from bitmessagekivy.baseclass.common import ( - avatarImageFirstLetter, toast, + avatarImageFirstLetter, toast, empty_screen_label, ThemeClsColor, SwipeToDeleteItem ) from bitmessagekivy.baseclass.popup import AddbookDetailPopup @@ -31,6 +31,8 @@ class AddressBook(Screen, HelperAddressBook): has_refreshed = True address_label = StringProperty() address = StringProperty() + label_str = "No contact found yet......" + no_search_res_found = "No search result found" def __init__(self, *args, **kwargs): """Getting AddressBook Details""" @@ -69,7 +71,7 @@ class AddressBook(Screen, HelperAddressBook): # halign='center', # size_hint_y=None, # valign='top') - 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 3b5560d1..49b47b5a 100644 --- a/src/bitmessagekivy/baseclass/addressbook_widgets.py +++ b/src/bitmessagekivy/baseclass/addressbook_widgets.py @@ -8,23 +8,26 @@ from kivymd.uix.label import MDLabel from bitmessagekivy.baseclass.popup import AddbookDetailPopup -no_address_found = "No contact found yet...??..." -empty_search_label = "No contact found!??" +label_str = "No contact found yet......" +no_search_res_found = "No contact found!" class DefaultLabelMixin(object): - - @staticmethod - def default_label_when_empty(): - content = MDLabel( - font_style='Caption', - theme_text_color='Primary', - # TODO: searcing_text(typo) need to create a kivy_state.py and add kivy related variables - text=empty_search_label if state.searcing_text else no_address_found, - halign='center', size_hint_y=None, valign='top') - return content - + pass +""" + # @staticmethod + # def default_label_when_empty(): + # content = MDLabel( + # font_style='Caption', + # theme_text_color='Primary', + # # TODO: searcing_text(typo) need to create a kivy_state.py and add kivy related variables + # text=no_search_res_found if state.searcing_text else label_str, + # halign='center', + # size_hint_y=None, + # valign='top') + # return content +""" class HelperAddressBook(DefaultLabelMixin): """Widget used in Addressbook are here"""