Create logo.py
Browse files- assets/logo.py +24 -0
assets/logo.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# /home/user/app/assets/logo.py
|
2 |
+
from pathlib import Path
|
3 |
+
|
4 |
+
def get_logo_path() -> str:
|
5 |
+
"""
|
6 |
+
Returns the absolute string path to the logo.png file.
|
7 |
+
Assumes logo.png is in the same 'assets' directory as this script.
|
8 |
+
"""
|
9 |
+
# Path(__file__) is the path to this assets/logo.py file.
|
10 |
+
# .resolve().parent gives the 'assets' directory.
|
11 |
+
assets_dir = Path(__file__).resolve().parent
|
12 |
+
logo_file = assets_dir / "logo.png" # MAKE SURE 'logo.png' IS THE CORRECT FILENAME
|
13 |
+
|
14 |
+
if not logo_file.exists():
|
15 |
+
# Handle the case where the logo is not found.
|
16 |
+
# You might want to log an error or return a default path.
|
17 |
+
# For now, let's print a warning and potentially raise an error or return None.
|
18 |
+
print(f"WARNING: Logo image not found at {str(logo_file)}")
|
19 |
+
# Depending on how pdf_report.py handles a missing logo,
|
20 |
+
# you might return None or a placeholder path.
|
21 |
+
# If generate_pdf_report expects a valid path, this could still error later.
|
22 |
+
return "" # Or raise FileNotFoundError(f"Logo not found: {logo_file}")
|
23 |
+
|
24 |
+
return str(logo_file)
|