65 Zeilen
2.2 KiB
Python
65 Zeilen
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Debug script to check what's happening with logo switching
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
# Add project root to path
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
from themes.theme_config import ThemeConfig
|
|
|
|
def check_logo_files():
|
|
"""Check the actual logo files and their paths."""
|
|
print("=" * 60)
|
|
print("LOGO FILE ANALYSIS")
|
|
print("=" * 60)
|
|
|
|
base_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
# Check what's in the config
|
|
light_theme = ThemeConfig.get_theme('light')
|
|
dark_theme = ThemeConfig.get_theme('dark')
|
|
|
|
print(f"\nTheme Config:")
|
|
print(f" Light theme logo_path: {light_theme.get('logo_path', 'NOT SET')}")
|
|
print(f" Dark theme logo_path: {dark_theme.get('logo_path', 'NOT SET')}")
|
|
|
|
# Check actual files
|
|
icons_dir = os.path.join(base_dir, "resources", "icons")
|
|
print(f"\nIcon files in {icons_dir}:")
|
|
|
|
for file in os.listdir(icons_dir):
|
|
if "intelsight" in file.lower():
|
|
file_path = os.path.join(icons_dir, file)
|
|
file_size = os.path.getsize(file_path)
|
|
print(f" - {file} ({file_size} bytes)")
|
|
|
|
# Test the path resolution
|
|
print("\n" + "=" * 60)
|
|
print("PATH RESOLUTION TEST")
|
|
print("=" * 60)
|
|
|
|
# Simulate what happens in get_icon_path
|
|
for theme_name in ['light', 'dark']:
|
|
theme = ThemeConfig.get_theme(theme_name)
|
|
logo_name = theme.get('logo_path', 'intelsight-logo.svg').replace('.svg', '')
|
|
full_path = os.path.join(base_dir, "resources", "icons", f"{logo_name}.svg")
|
|
|
|
print(f"\n{theme_name.upper()} theme:")
|
|
print(f" logo_name from config: {logo_name}")
|
|
print(f" full_path: {full_path}")
|
|
print(f" file exists: {os.path.exists(full_path)}")
|
|
|
|
if os.path.exists(full_path):
|
|
# Check if it's actually an SVG
|
|
with open(full_path, 'r') as f:
|
|
first_line = f.readline().strip()
|
|
is_svg = '<svg' in first_line.lower() or '<?xml' in first_line.lower()
|
|
print(f" is valid SVG: {is_svg}")
|
|
print(f" first line: {first_line[:50]}...")
|
|
|
|
if __name__ == "__main__":
|
|
check_logo_files() |