Fixed image path

This commit is contained in:
shekhar-cis 2022-03-28 16:59:22 +05:30
parent aae3f0e6ac
commit 315973ceec
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
2 changed files with 18 additions and 10 deletions

View File

@ -9,6 +9,7 @@ All saved addresses are managed in Addressbook
""" """
import os
from functools import partial from functools import partial
from kivy.clock import Clock from kivy.clock import Clock
@ -82,8 +83,9 @@ class AddressBook(Screen, HelperAddressBook):
listItem.secondary_text = item[1] listItem.secondary_text = item[1]
listItem.theme_text_color = "Custom" listItem.theme_text_color = "Custom"
listItem.text_color = ThemeClsColor listItem.text_color = ThemeClsColor
image = state.imageDir + "/text_images/{}.png".format( image = os.path.join(
avatarImageFirstLetter(item[0].strip())) state.imageDir, "text_images", "{}.png".format(avatarImageFirstLetter(item[0].strip()))
)
message_row.ids.avater_img.source = image message_row.ids.avater_img.source = image
listItem.bind(on_release=partial( listItem.bind(on_release=partial(
self.addBook_detail, item[1], item[0], message_row)) self.addBook_detail, item[1], item[0], message_row))

View File

@ -1,4 +1,4 @@
# pylint: disable=no-member, too-many-arguments # pylint: disable=no-member, too-many-arguments, too-few-public-methods
""" """
Addressbook widgets are here. Addressbook widgets are here.
""" """
@ -10,11 +10,13 @@ from kivymd.uix.label import MDLabel
import state import state
no_address_found = "No contact found yet......"
empty_search_label = "No contact found!"
class HelperAddressBook(object):
"""Widget used in Addressbook are here""" # pylint: disable=no-init, old-style-class
def __init__(self): class DefaultLabelMixin:
pass """Common label on blank screen"""
@staticmethod @staticmethod
def default_label_when_empty(): def default_label_when_empty():
@ -22,11 +24,15 @@ class HelperAddressBook(object):
content = MDLabel( content = MDLabel(
font_style='Caption', font_style='Caption',
theme_text_color='Primary', theme_text_color='Primary',
# FIXME: searching_text supposed to be inside kivy_sate.py and need to create a PR for kivy_state.py # FIXME: searching_text supposed to be inside kivy_sate.py, typo and need to create a PR for kivy_state.py
text="No contact found!" if state.searching_text text=empty_search_label if state.searching_text else no_address_found,
else "No contact found yet...... ", halign='center', size_hint_y=None, valign='top') halign='center', size_hint_y=None, valign='top')
return content return content
class HelperAddressBook(DefaultLabelMixin):
"""Widget used in Addressbook are here"""
@staticmethod @staticmethod
def address_detail_popup(obj, send_message, update_address, close_popup, width): def address_detail_popup(obj, send_message, update_address, close_popup, width):
"""This function shows the address's details and opens the popup.""" """This function shows the address's details and opens the popup."""