Fixed project structure
This commit is contained in:
@@ -3,11 +3,13 @@ import os
|
||||
import os.path as path
|
||||
import logging
|
||||
|
||||
from . import utils
|
||||
|
||||
DEFAULT_FONT = "arial"
|
||||
DEFAULT_FONT_SIZE = 0.05
|
||||
|
||||
FONT_DIR = "../fonts"
|
||||
TEMPLATES_DIR = "../templates"
|
||||
FONT_DIR = utils.relative_path(__file__, "..", "fonts")
|
||||
TEMPLATES_DIR = utils.relative_path(__file__, "..", "templates")
|
||||
|
||||
FONTS = {}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import json
|
||||
import logging
|
||||
import os.path as path
|
||||
|
||||
from .types import Pos, Text, Meme
|
||||
from . import utils
|
||||
|
||||
DATA_FILE = "../memes.json"
|
||||
DATA_FILE = utils.relative_path(__file__, "..", "memes.json")
|
||||
|
||||
DATA = {}
|
||||
ALIASES = {}
|
||||
@@ -117,7 +118,7 @@ def load_text(j, raw_text):
|
||||
"""
|
||||
if not (isinstance(raw_text, dict)):
|
||||
raise TypeError(f"root is not a dict")
|
||||
text = Text(f"text {j+1}")
|
||||
text = Text(f"text {j + 1}")
|
||||
if "font" in raw_text:
|
||||
if not (isinstance(raw_text["font"], str)):
|
||||
raise TypeError(f"'font' is not a str")
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import re
|
||||
import os.path as path
|
||||
|
||||
|
||||
def relative_path(file, *args):
|
||||
return path.realpath(path.join(path.dirname(path.realpath(file)), *args))
|
||||
|
||||
|
||||
def read_key_safe(d, k, default=None):
|
||||
|
||||
Reference in New Issue
Block a user