Merge branch 'Kivy-UI-Enhancement' into kivy-exprimental-myaddress

This commit is contained in:
shekhar-cis 2022-05-10 20:51:58 +05:30
commit 137e61f527
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7

View File

@ -4,6 +4,7 @@ BMConfigParser class definition and default configuration settings
# pylint: disable=no-self-use, arguments-differ # pylint: disable=no-self-use, arguments-differ
import configparser import configparser
import os import os
import shared
import shutil import shutil
from datetime import datetime from datetime import datetime
@ -194,18 +195,27 @@ class BMConfigParser(configparser.ConfigParser):
if value < 0 or value > 8: if value < 0 or value > 8:
return False return False
return True return True
@staticmethod @staticmethod
def search_addresses(address, searched_text): def search_addresses(address, searched_text):
return [x for x in [BMConfigParser().get(address, 'label').lower(), address.lower()] """Return the searched label of MyAddress"""
if searched_text in x] return [x for x in [BMConfigParser().get(address, 'label').lower(),
address.lower()] if searched_text in x]
def disable_address(self, address): def disable_address(self, address):
""""To disable the Address""" """"To disable the Address"""
self.set(str(address), 'enabled', 'false') try:
self.save() self.set(str(address), 'enabled', 'false')
self.save()
shared.reloadMyAddressHashes()
except (KeyError, TypeError) as e:
raise configparser.NoSectionError(e)
def enable_address(self, address): def enable_address(self, address):
""""To enable the Address""" """"To enable the Address"""
self.set(address, 'enabled', 'true') try:
self.save() self.set(address, 'enabled', 'true')
self.save()
shared.reloadMyAddressHashes()
except (KeyError, TypeError) as e:
raise configparser.NoSectionError(e)