20 lines
536 B
Python
20 lines
536 B
Python
# markdownconverter/utils/config.py
|
|
import json
|
|
import os
|
|
|
|
CONFIG_FILE = os.path.expanduser("~/.markdown_converter_config.json")
|
|
|
|
def save_last_font(font_name):
|
|
config = {"last_font": font_name}
|
|
with open(CONFIG_FILE, "w") as f:
|
|
json.dump(config, f)
|
|
|
|
def load_last_font():
|
|
if os.path.exists(CONFIG_FILE):
|
|
try:
|
|
with open(CONFIG_FILE, "r") as f:
|
|
return json.load(f).get("last_font", "DejaVu Sans")
|
|
except Exception:
|
|
return "DejaVu Sans"
|
|
return "DejaVu Sans"
|