def create_app_default_config(self, config):
app_list = get_plugins_list()
for app in app_list:
APP_NAME = app
APP_DIR = app_list[app][0]
setting_path = os.path.join(APP_DIR, "settings.json")
if os.path.exists(setting_path):
with open(setting_path, "r") as settings_json:
raw_data = settings_json.read()
# Regulate the config into the format that kivy can accept
tmp = eval(raw_data)
default_val = {}
for index in range(len(tmp)):
if tmp[index]['type'] == 'title':
pass
elif 'default' in tmp[index]:
default_val[tmp[index]['key']
] = tmp[index]['default']
# Update the default value and setting menu
config.setdefaults(APP_NAME, default_val)
评论列表
文章目录