From 4050057c34c67130cf5f1d202ca85cb81985f968 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sat, 16 Mar 2024 22:05:05 +0200 Subject: make it installable --- src/sliceitoff/images/images.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/sliceitoff/images') diff --git a/src/sliceitoff/images/images.py b/src/sliceitoff/images/images.py index 999d92b..07a8bcd 100644 --- a/src/sliceitoff/images/images.py +++ b/src/sliceitoff/images/images.py @@ -9,12 +9,13 @@ class Images: surfaces = {} @staticmethod - def reload_images(): + def reload_images(base_path): __class__.surfaces = {} - with open("assets/images.lst") as image_list_file: - for line in image_list_file: + filename_imagelist = os.path.join(base_path, "assets", "images.lst") + with open( filename_imagelist ) as imagelist_file: + for line in imagelist_file: name, *path = line.strip().split() - filename = os.path.join(*path) + filename = os.path.join(base_path, *path) if DEBUG: print(f"Loading images {name = }, {filename = }") image = pygame.image.load(filename) @@ -24,8 +25,8 @@ class Images: return True @staticmethod - def load_images(): + def load_images(base_path): if __class__.surfaces: return False - return __class__.reload_images() + return __class__.reload_images(base_path) \ No newline at end of file -- cgit v1.2.3