Add mdlist_content length function
This commit is contained in:
parent
61558c387b
commit
b3508bc888
|
@ -16,12 +16,10 @@ from kivy.properties import (
|
||||||
NumericProperty,
|
NumericProperty,
|
||||||
StringProperty
|
StringProperty
|
||||||
)
|
)
|
||||||
|
|
||||||
from kivymd.uix.label import MDLabel
|
from kivymd.uix.label import MDLabel
|
||||||
|
|
||||||
import state
|
import state
|
||||||
|
|
||||||
|
|
||||||
ThemeClsColor = [0.12, 0.58, 0.95, 1]
|
ThemeClsColor = [0.12, 0.58, 0.95, 1]
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +72,7 @@ def chipTag(text):
|
||||||
|
|
||||||
|
|
||||||
def toast(text):
|
def toast(text):
|
||||||
"""Method will display the toast message"""
|
"""Function will display the toast message"""
|
||||||
kivytoast.toast(text)
|
kivytoast.toast(text)
|
||||||
|
|
||||||
def showLimitedCnt(total_msg):
|
def showLimitedCnt(total_msg):
|
||||||
|
@ -85,8 +83,8 @@ 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[0].upper() >= 'A' and letter_string[0].upper() <= 'Z':
|
if letter_string.title()[0] >= 'A' and letter_string.title()[0] <= 'Z':
|
||||||
img_latter = letter_string[0].upper()
|
img_latter = letter_string.title()[0]
|
||||||
elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9:
|
elif int(letter_string[0]) >= 0 and int(letter_string[0]) <= 9:
|
||||||
img_latter = letter_string[0]
|
img_latter = letter_string[0]
|
||||||
else:
|
else:
|
||||||
|
@ -149,8 +147,7 @@ class CutsomSwipeToDeleteItem(MDCardSwipe):
|
||||||
|
|
||||||
|
|
||||||
def empty_screen_label(label_str=None, no_search_res_found=None):
|
def empty_screen_label(label_str=None, no_search_res_found=None):
|
||||||
"""This function returns default message while no address is there."""
|
"""Returns default text on screen when no address is there."""
|
||||||
# empty_screen_msg = "yet no message for this account!!!!!!!!!!!!!"
|
|
||||||
content = MDLabel(
|
content = MDLabel(
|
||||||
font_style='Caption',
|
font_style='Caption',
|
||||||
theme_text_color='Primary',
|
theme_text_color='Primary',
|
||||||
|
@ -159,3 +156,15 @@ def empty_screen_label(label_str=None, no_search_res_found=None):
|
||||||
size_hint_y=None,
|
size_hint_y=None,
|
||||||
valign='top')
|
valign='top')
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
||||||
|
def mdlist_message_content(queryreturn, data, max_len=None, min_len=None):
|
||||||
|
for mail in queryreturn:
|
||||||
|
third_text = mail[3].replace('\n', ' ')
|
||||||
|
data.append({
|
||||||
|
'text': mail[1].strip(),
|
||||||
|
'secondary_text': mail[2][:10] + '...........' if len(
|
||||||
|
mail[2]) > 10 else mail[2] + '\n' + " " + (
|
||||||
|
third_text[:25] + '...!') if len(
|
||||||
|
third_text) > 25 else third_text,
|
||||||
|
'ackdata': mail[5], 'senttime': mail[6]})
|
||||||
|
|
Reference in New Issue
Block a user