From c52996775e73df602ddd5a020b346a721ee382ab Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Thu, 1 Sep 2022 15:17:13 +0530 Subject: [PATCH] Add a function to return identity list --- src/bitmessagekivy/baseclass/common.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/bitmessagekivy/baseclass/common.py b/src/bitmessagekivy/baseclass/common.py index daeb701c..f588176a 100644 --- a/src/bitmessagekivy/baseclass/common.py +++ b/src/bitmessagekivy/baseclass/common.py @@ -3,6 +3,7 @@ All Common widgets of kivy are managed here. """ +import os from datetime import datetime from kivy.core.window import Window @@ -10,7 +11,8 @@ from kivy.metrics import dp from kivy.uix.image import Image from kivy.properties import ( NumericProperty, - StringProperty + StringProperty, + ListProperty ) from kivy.app import App @@ -24,7 +26,7 @@ from kivymd.uix.card import MDCardSwipe from kivymd.uix.chip import MDChip from pybitmessage.bitmessagekivy.get_platform import platform - +from pybitmessage.bmconfigparser import config ThemeClsColor = [0.12, 0.58, 0.95, 1] @@ -40,6 +42,20 @@ data_screens = { } +def load_image_path(): + """Return the path of kivy images""" + image_path = os.path.abspath(os.path.join('images', 'kivy')) + return image_path + + +def get_identity_list(): + """Get list of identities and access 'identity_list' variable in .kv file""" + identity_list = ListProperty( + addr for addr in config.addresses() if config.getboolean(str(addr), 'enabled') + ) + return identity_list + + def kivy_state_variables(): """Return kivy_state variable""" kivy_running_app = App.get_running_app()