diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-16 22:05:05 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-16 22:05:05 +0200 |
commit | 4050057c34c67130cf5f1d202ca85cb81985f968 (patch) | |
tree | 93dfd6b3eaa4e8cb153266326724afb07d141dcf /src/sliceitoff/images/images.py | |
parent | 2fd254af8613dba6bbd7bd9f52514229a5287d21 (diff) |
make it installable
Diffstat (limited to 'src/sliceitoff/images/images.py')
-rw-r--r-- | src/sliceitoff/images/images.py | 13 |
1 files changed, 7 insertions, 6 deletions
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 |