mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-04 02:30:01 -06:00
- Improve web interface layout for better user-friendliness and mobile responsiveness * Update CSS variables for consistent spacing and component sizing * Enhance card layouts with improved padding, borders, and shadows * Optimize button and form element dimensions for better touch targets * Add hover effects and animations for improved user interaction * Implement responsive grid system with mobile-first approach - Refactor mobile JavaScript to prevent duplicate initialization * Consolidate mobile enhancements into dedicated utility classes * Add initialization guards to prevent double loading * Implement MobileUtils and MobileNavigation classes * Remove duplicate event listeners and mobile enhancements - Fix circular import issue in logo handling * Replace problematic 'from app import app' with Flask's current_app * Add error handling for cases where current_app is unavailable * Improve logo path resolution with fallback mechanisms * Fix settings model to use proper Flask context - Clean up template code and remove duplication * Remove duplicate mobile enhancements from base template * Clean up dashboard template JavaScript * Centralize all mobile functionality in mobile.js * Add proper error handling and debugging - Update CSS variables and spacing system * Introduce --section-spacing and --card-spacing variables * Add mobile-specific spacing variables * Improve border-radius and shadow consistency * Enhance typography and visual hierarchy This commit resolves the double loading issue and logo import errors while significantly improving the overall user experience and mobile responsiveness of the web interface.
93 lines
2.6 KiB
Python
93 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script to verify PDF generation works
|
|
Run this to test both WeasyPrint and ReportLab fallback
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
def test_weasyprint():
|
|
"""Test if WeasyPrint is available and working"""
|
|
try:
|
|
from weasyprint import HTML, CSS
|
|
print("✓ WeasyPrint is available")
|
|
return True
|
|
except ImportError as e:
|
|
print(f"✗ WeasyPrint import failed: {e}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"✗ WeasyPrint error: {e}")
|
|
return False
|
|
|
|
def test_reportlab():
|
|
"""Test if ReportLab is available and working"""
|
|
try:
|
|
from reportlab.lib.pagesizes import A4
|
|
from reportlab.platypus import SimpleDocTemplate, Paragraph
|
|
from reportlab.lib.styles import getSampleStyleSheet
|
|
print("✓ ReportLab is available")
|
|
return True
|
|
except ImportError as e:
|
|
print(f"✗ ReportLab import failed: {e}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"✗ ReportLab error: {e}")
|
|
return False
|
|
|
|
def test_system_libraries():
|
|
"""Test if required system libraries are available"""
|
|
import ctypes.util
|
|
|
|
required_libs = [
|
|
'gobject-2.0-0',
|
|
'pango-1.0-0',
|
|
'cairo',
|
|
'gdk_pixbuf-2.0'
|
|
]
|
|
|
|
print("\nChecking system libraries:")
|
|
for lib in required_libs:
|
|
lib_path = ctypes.util.find_library(lib)
|
|
if lib_path:
|
|
print(f"✓ {lib}: {lib_path}")
|
|
else:
|
|
print(f"✗ {lib}: Not found")
|
|
|
|
return True
|
|
|
|
def main():
|
|
print("=== PDF Generation Test ===")
|
|
|
|
# Test system libraries
|
|
test_system_libraries()
|
|
|
|
print("\n=== Python Libraries ===")
|
|
|
|
# Test WeasyPrint
|
|
weasyprint_ok = test_weasyprint()
|
|
|
|
# Test ReportLab
|
|
reportlab_ok = test_reportlab()
|
|
|
|
print("\n=== Summary ===")
|
|
if weasyprint_ok:
|
|
print("✓ WeasyPrint is working - High-quality PDFs available")
|
|
elif reportlab_ok:
|
|
print("⚠ WeasyPrint failed but ReportLab is available - Basic PDFs available")
|
|
else:
|
|
print("✗ Both PDF generators failed - No PDF generation available")
|
|
|
|
print("\n=== Recommendations ===")
|
|
if not weasyprint_ok:
|
|
print("1. Install system dependencies: libgdk-pixbuf2.0-0, libpango-1.0-0, libcairo2")
|
|
print("2. Rebuild Docker container with updated Dockerfile")
|
|
print("3. Or use ReportLab fallback (already configured)")
|
|
|
|
if not reportlab_ok:
|
|
print("1. Install ReportLab: pip install reportlab==4.0.7")
|
|
print("2. Add to requirements.txt")
|
|
|
|
if __name__ == '__main__':
|
|
main()
|