fixed initial address disable issue in kivy

This commit is contained in:
navjot 2021-01-28 22:03:46 +05:30
parent b53f0a44c0
commit 2fc9a33fa4
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C

View File

@ -538,7 +538,7 @@ class MyAddress(Screen):
avatarImageFirstLetter(item['text'].strip())))) avatarImageFirstLetter(item['text'].strip()))))
meny.bind(on_press=partial( meny.bind(on_press=partial(
self.myadd_detail, item['secondary_text'], item['text'])) 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( badge_obj = BadgeText(
size_hint=(None, None), size_hint=(None, None),
size=[90 if platform == 'android' else 50, 60], size=[90 if platform == 'android' else 50, 60],
@ -2092,25 +2092,27 @@ class NavigateApp(MDApp):
def getDefaultAccData(self, instance): def getDefaultAccData(self, instance):
"""Getting Default Account Data""" """Getting Default Account Data"""
if BMConfigParser().addresses(): if BMConfigParser().addresses():
img = identiconGeneration.generate(BMConfigParser().addresses()[0]) first_addr = BMConfigParser().addresses()[0]
# self.createFolder(state.imageDir + '/default_identicon/') if BMConfigParser().get(str(first_addr), 'enabled') == 'true':
# if platform == 'android': img = identiconGeneration.generate(first_addr)
# # android_path = os.path.expanduser # self.createFolder(state.imageDir + '/default_identicon/')
# # ("~/user/0/org.test.bitapp/files/app/") # if platform == 'android':
# if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( # # android_path = os.path.expanduser
# BMConfigParser().addresses()[0])): # # ("~/user/0/org.test.bitapp/files/app/")
# android_path = os.path.join( # if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(
# os.environ['ANDROID_PRIVATE'] + '/app/') # BMConfigParser().addresses()[0])):
# img.texture.save('{1}/images/kivy/default_identicon/{0}.png'.format( # android_path = os.path.join(
# BMConfigParser().addresses()[0], android_path)) # os.environ['ANDROID_PRIVATE'] + '/app/')
# else: # img.texture.save('{1}/images/kivy/default_identicon/{0}.png'.format(
# if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format( # BMConfigParser().addresses()[0], android_path))
# BMConfigParser().addresses()[0])): # else:
# img.texture.save(state.imageDir + '/default_identicon/{}.png'.format( # if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(
# BMConfigParser().addresses()[0])) # BMConfigParser().addresses()[0])):
instance.parent.parent.parent.parent.parent.ids.top_box.children[0].texture = ( # img.texture.save(state.imageDir + '/default_identicon/{}.png'.format(
img.texture) # BMConfigParser().addresses()[0]))
return BMConfigParser().addresses()[0] instance.parent.parent.parent.parent.parent.ids.top_box.children[0].texture = (
img.texture)
return first_addr
return 'Select Address' return 'Select Address'
@staticmethod @staticmethod
@ -2134,8 +2136,10 @@ class NavigateApp(MDApp):
def get_default_logo(): def get_default_logo():
"""Getting default logo image""" """Getting default logo image"""
if BMConfigParser().addresses(): if BMConfigParser().addresses():
return state.imageDir + '/default_identicon/{}.png'.format( first_addr = BMConfigParser().addresses()[0]
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' return state.imageDir + '/drawer_logo1.png'
@staticmethod @staticmethod
@ -2389,6 +2393,8 @@ class NavigateApp(MDApp):
else: else:
addr = BMConfigParser().addresses()[0] addr = BMConfigParser().addresses()[0]
first_name = BMConfigParser().get(addr, 'label') first_name = BMConfigParser().get(addr, 'label')
if BMConfigParser().get(addr, 'enabled') != 'true':
return ''
f_name = first_name.split() f_name = first_name.split()
label = f_name[0][:14].capitalize() + '...' if len( label = f_name[0][:14].capitalize() + '...' if len(
f_name[0]) > 15 else f_name[0].capitalize() f_name[0]) > 15 else f_name[0].capitalize()