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()))))
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()