Update imaget set function

This commit is contained in:
shekhar-cis 2022-05-03 17:21:10 +05:30
parent b3508bc888
commit e9e8fff1c2
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7

View File

@ -83,16 +83,14 @@ def showLimitedCnt(total_msg):
def avatarImageFirstLetter(letter_string): def avatarImageFirstLetter(letter_string):
"""This function is used to the first letter for the avatar image""" """This function is used to the first letter for the avatar image"""
try: try:
if letter_string.title()[0] >= 'A' and letter_string.title()[0] <= 'Z': if isinstance(letter_string, int):
img_latter = letter_string.title()[0] return letter_string[0]
elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9: elif isinstance(letter_string, str) and letter_string[0].isalnum():
img_latter = letter_string[0] return letter_string.title()[0]
else: else:
img_latter = '!' return '!'
except ValueError: except IndexError:
img_latter = '!' return '!'
return img_latter if img_latter else '!'
def AddTimeWidget(time): # pylint: disable=redefined-outer-name, W0201 def AddTimeWidget(time): # pylint: disable=redefined-outer-name, W0201
"""This method is used to create TimeWidget""" """This method is used to create TimeWidget"""
@ -158,7 +156,7 @@ def empty_screen_label(label_str=None, no_search_res_found=None):
return content return content
def mdlist_message_content(queryreturn, data, max_len=None, min_len=None): def mdlist_message_content(queryreturn, data, max_len=25, min_len=10):
for mail in queryreturn: for mail in queryreturn:
third_text = mail[3].replace('\n', ' ') third_text = mail[3].replace('\n', ' ')
data.append({ data.append({