From c6a004367ade67de8b5030244aeaa55dc39a0bc3 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Wed, 13 Jul 2022 19:58:27 +0530 Subject: [PATCH] Add method content lenght function --- src/bitmessagekivy/baseclass/common.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bitmessagekivy/baseclass/common.py b/src/bitmessagekivy/baseclass/common.py index 80dc1672..db95e565 100644 --- a/src/bitmessagekivy/baseclass/common.py +++ b/src/bitmessagekivy/baseclass/common.py @@ -1,5 +1,4 @@ -# pylint: disable=no-name-in-module, attribute-defined-outside-init, import-error, unused-argument - +# pylint: disable=no-name-in-module, attribute-defined-outside-init, import-error """ All Common widgets of kivy are managed here. """ @@ -183,3 +182,13 @@ def mdlist_message_content(queryreturn, data): for mail in queryreturn: mdlist_data = set_mail_details(mail) data.append(mdlist_data) + + +def msg_content_length(body, subject, max_length=50): + """This function concatinate body and subject if len(subject) > 50""" + continue_str = '........' + if len(subject) >= max_length: + subject = subject[:max_length] + continue_str + else: + subject = ((subject + ',' + body)[0:50] + continue_str).replace('\t', '').replace(' ', '') + return subject