-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.py
23 lines (19 loc) · 1.01 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from aqt import mw
def get_config() -> dict:
config: dict = mw.addonManager.getConfig(__name__) or dict()
## Addon fix
config['addon_more_overview_stats'] = True if config.get('addon_more_overview_stats', "false").lower() == "true" else False
config['addon_advanced_review_bottom_bar'] = True if config.get('addon_advanced_review_bottom_bar', "false").lower() == "true" else False
config['addon_no_distractions_full_screen'] = True if config.get('addon_no_distractions_full_screen', "false").lower() == "true" else False
## Customization
config['font'] = config.get('font', "Segoe UI")
config['fallbackFonts'] = config.get('fallbackFonts', "sans-serif")
config['font_size'] = int(config.get('font_size', "12"))
config['theme'] = config.get('theme', 'Anki')
return config
def write_config(config):
for key in config.keys():
if not isinstance(config[key], str):
config[key] = str(config[key])
mw.addonManager.writeConfig(__name__, config)
config = get_config()