File size: 2,174 Bytes
b610d23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python3
"""

NASA Solar Image Downloader - GUI Launcher

Simple launcher script for the complete GUI application.

"""

import sys
import subprocess
from pathlib import Path

def main():
    """Launch the NASA GUI application."""
    print("πŸš€ Launching NASA Solar Image Downloader GUI...")
    
    # Check if required packages are installed
    required_packages = ['tkinter', 'PIL', 'cv2', 'requests', 'beautifulsoup4']
    missing_packages = []
    
    for package in required_packages:
        try:
            if package == 'tkinter':
                import tkinter
            elif package == 'PIL':
                from PIL import Image
            elif package == 'cv2':
                import cv2
            elif package == 'requests':
                import requests
            elif package == 'beautifulsoup4':
                import bs4
        except ImportError:
            missing_packages.append(package)
    
    if missing_packages:
        print(f"❌ Missing required packages: {', '.join(missing_packages)}")
        print("πŸ’‘ Installing missing packages...")
        
        install_map = {
            'PIL': 'pillow',
            'cv2': 'opencv-python',
            'beautifulsoup4': 'beautifulsoup4'
        }
        
        for package in missing_packages:
            if package in install_map:
                package_name = install_map[package]
            else:
                package_name = package
            
            try:
                subprocess.run([sys.executable, '-m', 'pip', 'install', package_name], 
                             check=True)
                print(f"βœ… Installed {package_name}")
            except subprocess.CalledProcessError:
                print(f"❌ Failed to install {package_name}")
                return
    
    # Launch the GUI
    try:
        import nasa_gui
        print("βœ… Starting GUI application...")
        nasa_gui.main()
    except Exception as e:
        print(f"❌ Error launching GUI: {e}")
        import traceback
        traceback.print_exc()


if __name__ == "__main__":
    main()