From 2fc9a33fa42c22fe8d6234808604d6f7da4c53b9 Mon Sep 17 00:00:00 2001 From: navjot Date: Thu, 28 Jan 2021 22:03:46 +0530 Subject: [PATCH] fixed initial address disable issue in kivy --- src/bitmessagekivy/mpybit.py | 50 ++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index d341d816..b2bf4b0b 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -538,7 +538,7 @@ class MyAddress(Screen): avatarImageFirstLetter(item['text'].strip())))) meny.bind(on_press=partial( self.myadd_detail, item['secondary_text'], item['text'])) - if state.association == item['secondary_text']: + if state.association == item['secondary_text'] and is_enable == 'true': badge_obj = BadgeText( size_hint=(None, None), size=[90 if platform == 'android' else 50, 60], @@ -2092,25 +2092,27 @@ class NavigateApp(MDApp): def getDefaultAccData(self, instance): """Getting Default Account Data""" if BMConfigParser().addresses(): - img = identiconGeneration.generate(BMConfigParser().addresses()[0]) - # self.createFolder(state.imageDir + '/default_identicon/') - # if platform == 'android': - # # android_path = os.path.expanduser - # # ("~/user/0/org.test.bitapp/files/app/") - # if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( - # BMConfigParser().addresses()[0])): - # android_path = os.path.join( - # os.environ['ANDROID_PRIVATE'] + '/app/') - # img.texture.save('{1}/images/kivy/default_identicon/{0}.png'.format( - # BMConfigParser().addresses()[0], android_path)) - # else: - # if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( - # BMConfigParser().addresses()[0])): - # img.texture.save(state.imageDir + '/default_identicon/{}.png'.format( - # BMConfigParser().addresses()[0])) - instance.parent.parent.parent.parent.parent.ids.top_box.children[0].texture = ( - img.texture) - return BMConfigParser().addresses()[0] + first_addr = BMConfigParser().addresses()[0] + if BMConfigParser().get(str(first_addr), 'enabled') == 'true': + img = identiconGeneration.generate(first_addr) + # self.createFolder(state.imageDir + '/default_identicon/') + # if platform == 'android': + # # android_path = os.path.expanduser + # # ("~/user/0/org.test.bitapp/files/app/") + # if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( + # BMConfigParser().addresses()[0])): + # android_path = os.path.join( + # os.environ['ANDROID_PRIVATE'] + '/app/') + # img.texture.save('{1}/images/kivy/default_identicon/{0}.png'.format( + # BMConfigParser().addresses()[0], android_path)) + # else: + # if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( + # BMConfigParser().addresses()[0])): + # img.texture.save(state.imageDir + '/default_identicon/{}.png'.format( + # BMConfigParser().addresses()[0])) + instance.parent.parent.parent.parent.parent.ids.top_box.children[0].texture = ( + img.texture) + return first_addr return 'Select Address' @staticmethod @@ -2134,8 +2136,10 @@ class NavigateApp(MDApp): def get_default_logo(): """Getting default logo image""" if BMConfigParser().addresses(): - return state.imageDir + '/default_identicon/{}.png'.format( - BMConfigParser().addresses()[0]) + first_addr = BMConfigParser().addresses()[0] + if BMConfigParser().get(str(first_addr), 'enabled') == 'true': + return state.imageDir + '/default_identicon/{}.png'.format( + first_addr) return state.imageDir + '/drawer_logo1.png' @staticmethod @@ -2389,6 +2393,8 @@ class NavigateApp(MDApp): else: addr = BMConfigParser().addresses()[0] first_name = BMConfigParser().get(addr, 'label') + if BMConfigParser().get(addr, 'enabled') != 'true': + return '' f_name = first_name.split() label = f_name[0][:14].capitalize() + '...' if len( f_name[0]) > 15 else f_name[0].capitalize()