""" Test script to verify conf folder auto-generation Run this to test that conf/ folder is created with default templates """ import os import shutil # Temporarily rename existing conf folder to test auto-generation if os.path.exists('conf'): print("Backing up existing conf folder to conf_backup...") if os.path.exists('conf_backup'): shutil.rmtree('conf_backup') shutil.move('conf', 'conf_backup') print("✓ Existing conf folder backed up") print("\nTesting conf folder auto-generation...") print("Starting label_printer_gui initialization...") # Import the app (this will trigger initialization) from label_printer_gui import LabelPrinterApp # Create app instance (will auto-create conf folder) app = LabelPrinterApp() # Check if conf folder was created if os.path.exists('conf'): print("\n✓ SUCCESS: conf folder created") # Check for required files required_files = [ 'conf/app.conf', 'conf/label_template.svg', 'conf/label_template_ok.svg', 'conf/label_template_nok.svg' ] missing_files = [] for file in required_files: if os.path.exists(file): print(f" ✓ {file}") else: print(f" ✗ {file} MISSING") missing_files.append(file) if not missing_files: print("\n✓ All required files created successfully!") else: print(f"\n✗ Missing files: {missing_files}") else: print("\n✗ FAILED: conf folder not created") # Restore original conf folder print("\nRestoring original conf folder...") if os.path.exists('conf_backup'): if os.path.exists('conf'): shutil.rmtree('conf') shutil.move('conf_backup', 'conf') print("✓ Original conf folder restored") print("\n" + "="*50) print("Test complete!") print("="*50)