Moved empty_screen() to common.py

This commit is contained in:
shekhar-cis 2022-04-22 17:52:27 +05:30
parent e8805ce19c
commit f48b96aa0d
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
2 changed files with 20 additions and 15 deletions

View File

@ -17,7 +17,7 @@ import os
from debug import logger from debug import logger
from bitmessagekivy.baseclass.common import ( from bitmessagekivy.baseclass.common import (
avatarImageFirstLetter, toast, avatarImageFirstLetter, toast, empty_screen_label,
ThemeClsColor, SwipeToDeleteItem ThemeClsColor, SwipeToDeleteItem
) )
from bitmessagekivy.baseclass.popup import AddbookDetailPopup from bitmessagekivy.baseclass.popup import AddbookDetailPopup
@ -31,6 +31,8 @@ class AddressBook(Screen, HelperAddressBook):
has_refreshed = True has_refreshed = True
address_label = StringProperty() address_label = StringProperty()
address = StringProperty() address = StringProperty()
label_str = "No contact found yet......"
no_search_res_found = "No search result found"
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Getting AddressBook Details""" """Getting AddressBook Details"""
@ -69,7 +71,7 @@ class AddressBook(Screen, HelperAddressBook):
# halign='center', # halign='center',
# size_hint_y=None, # size_hint_y=None,
# valign='top') # 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): def set_mdList(self, start_index, end_index):
"""Creating the mdList""" """Creating the mdList"""

View File

@ -8,23 +8,26 @@ from kivymd.uix.label import MDLabel
from bitmessagekivy.baseclass.popup import AddbookDetailPopup 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): class DefaultLabelMixin(object):
pass
@staticmethod """
def default_label_when_empty(): # @staticmethod
content = MDLabel( # def default_label_when_empty():
font_style='Caption', # content = MDLabel(
theme_text_color='Primary', # font_style='Caption',
# TODO: searcing_text(typo) need to create a kivy_state.py and add kivy related variables # theme_text_color='Primary',
text=empty_search_label if state.searcing_text else no_address_found, # # TODO: searcing_text(typo) need to create a kivy_state.py and add kivy related variables
halign='center', size_hint_y=None, valign='top') # text=no_search_res_found if state.searcing_text else label_str,
return content # halign='center',
# size_hint_y=None,
# valign='top')
# return content
"""
class HelperAddressBook(DefaultLabelMixin): class HelperAddressBook(DefaultLabelMixin):
"""Widget used in Addressbook are here""" """Widget used in Addressbook are here"""