Skip to content

Commit 5d22315

Browse files
committed
Rename dymoprint.ini to labelle.ini
1 parent 1f6fb21 commit 5d22315

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pre-commit install
9595

9696
## Font management
9797

98-
Fonts are managed via [dymoprint.ini](dymoprint.ini). This should be placed in your
98+
Fonts are managed via [labelle.ini](labelle.ini). This should be placed in your
9999
config folder (normally `~/.config`). An example file is provided here.
100100

101101
You may choose any TTF Font you like
File renamed without changes.

src/dymoprint/font_config.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import re
3+
import warnings
34
from configparser import ConfigParser
45

56
from appdirs import user_config_dir
@@ -18,11 +19,18 @@ def font_filename(flag):
1819
}
1920

2021
conf = ConfigParser(style_to_file)
21-
CONFIG_FILE = os.path.join(user_config_dir(), "dymoprint.ini")
22-
if conf.read(CONFIG_FILE):
22+
old_config_file = os.path.join(user_config_dir(), "dymoprint.ini")
23+
config_file = os.path.join(user_config_dir(), "labelle.ini")
24+
if os.path.exists(old_config_file) and not os.path.exists(config_file):
25+
warnings.warn(
26+
f"Old config file found at {old_config_file}. "
27+
f"Please rename it to {config_file}"
28+
)
29+
config_file = old_config_file
30+
if conf.read(config_file):
2331
# reading FONTS section
2432
if "FONTS" not in conf.sections():
25-
die('! config file "%s" not valid. Please change or remove.' % CONFIG_FILE)
33+
die('! config file "%s" not valid. Please change or remove.' % config_file)
2634
for style in style_to_file.keys():
2735
style_to_file[style] = conf.get("FONTS", style)
2836

0 commit comments

Comments
 (0)