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 kivy.clock import Clock
@ -82,8 +83,9 @@ class AddressBook(Screen, HelperAddressBook):
listItem.secondary_text = item[1]
listItem.theme_text_color = "Custom"
listItem.text_color = ThemeClsColor
image = state.imageDir + "/text_images/{}.png".format(
avatarImageFirstLetter(item[0].strip()))
image = os.path.join(
state.imageDir, "text_images", "{}.png".format(avatarImageFirstLetter(item[0].strip()))
)
message_row.ids.avater_img.source = image
listItem.bind(on_release=partial(
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.
"""
@ -10,11 +10,13 @@ from kivymd.uix.label import MDLabel
import state
no_address_found = "No contact found yet......"
empty_search_label = "No contact found!"
class HelperAddressBook(object):
"""Widget used in Addressbook are here"""
def __init__(self):
pass
# pylint: disable=no-init, old-style-class
class DefaultLabelMixin:
"""Common label on blank screen"""
@staticmethod
def default_label_when_empty():
@ -22,11 +24,15 @@ class HelperAddressBook(object):
content = MDLabel(
font_style='Caption',
theme_text_color='Primary',
# FIXME: searching_text supposed to be inside kivy_sate.py and need to create a PR for kivy_state.py
text="No contact found!" if state.searching_text
else "No contact found yet...... ", halign='center', size_hint_y=None, valign='top')
# FIXME: searching_text supposed to be inside kivy_sate.py, typo and need to create a PR for kivy_state.py
text=empty_search_label if state.searching_text else no_address_found,
halign='center', size_hint_y=None, valign='top')
return content
class HelperAddressBook(DefaultLabelMixin):
"""Widget used in Addressbook are here"""
@staticmethod
def address_detail_popup(obj, send_message, update_address, close_popup, width):
"""This function shows the address's details and opens the popup."""