diff options
author | Frederick Muriuki Muriithi | 2024-09-11 02:58:41 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-09-11 02:58:41 -0500 |
commit | d001c1e7cae8f69435545b8715038b1d0fc1ee62 (patch) | |
tree | 5bfda6ade7119f2564b94f2b7d42f601757e4d5c /gn2 | |
parent | 01d56903ba01a91841d199fe393f9b307a7596a2 (diff) | |
download | genenetwork2-d001c1e7cae8f69435545b8715038b1d0fc1ee62.tar.gz |
BUGFIX: Use absolute paths for font files
Use absolute paths for font files so that they are loaded
successfully, regardless of whether the application is run with the
working directory being the root of the GN2 repo/package or not.
Diffstat (limited to 'gn2')
-rw-r--r-- | gn2/utility/Plot.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gn2/utility/Plot.py b/gn2/utility/Plot.py index f984963f..a97ece5e 100644 --- a/gn2/utility/Plot.py +++ b/gn2/utility/Plot.py @@ -22,8 +22,9 @@ # # Created by GeneNetwork Core Team 2010/08/10 # -# Last updated by GeneNetwork Core Team 2010/10/20 +# Last updated by GeneNetwork Core Team 2024/09/11 import os +from pathlib import Path from PIL import ImageColor from PIL import ImageDraw @@ -44,9 +45,11 @@ BLACK = ImageColor.getrgb("black") # ---- END: Define common colours ---- # # ---- FONT FILES ---- # -VERDANA_FILE = "./gn2/wqflask/static/fonts/verdana.ttf" -COUR_FILE = "./gn2/wqflask/static/fonts/courbd.ttf" -TAHOMA_FILE = "./gn2/wqflask/static/fonts/tahoma.ttf" +REPO_ROOT = Path(__file__).parent.parent +FONTS_DIR = REPO_ROOT.joinpath("wqflask/static/fonts") +VERDANA_FILE = f"{FONTS_DIR.joinpath('verdana.ttf')}" +COUR_FILE = f"{FONTS_DIR.joinpath('courbd.ttf')}" +TAHOMA_FILE = f"{FONTS_DIR.joinpath('tahoma.ttf')}" # ---- END: FONT FILES ---- # |