From 315973ceec7686d9867b61f232859b937180d180 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Mon, 28 Mar 2022 16:59:22 +0530 Subject: [PATCH] Fixed image path --- src/bitmessagekivy/baseclass/addressbook.py | 6 +++-- .../baseclass/addressbook_widgets.py | 22 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/bitmessagekivy/baseclass/addressbook.py b/src/bitmessagekivy/baseclass/addressbook.py index 98b1ef56..8e6cd860 100644 --- a/src/bitmessagekivy/baseclass/addressbook.py +++ b/src/bitmessagekivy/baseclass/addressbook.py @@ -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)) diff --git a/src/bitmessagekivy/baseclass/addressbook_widgets.py b/src/bitmessagekivy/baseclass/addressbook_widgets.py index ed7e6196..e8cd982d 100644 --- a/src/bitmessagekivy/baseclass/addressbook_widgets.py +++ b/src/bitmessagekivy/baseclass/addressbook_widgets.py @@ -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."""