Files
adaptronic_label-printer/test_conf_generation.py
NAME 839828340d Add template selection and multiple copy printing features
- Implemented template selection: type 0=OK (green), type 1=NOK (red)
- Added multiple copy printing (1-100 copies)
- Extended file format to 5 fields: ARTICLE;NR_ART;SERIAL;TYPE;COUNT
- Created OK/NOK SVG templates with visual distinction
- Fixed PDF landscape orientation issues
- Updated SumatraPDF to use noscale for exact dimensions
- Auto-generate conf folder with default templates on first run
- Made pystray optional for system tray functionality
- Updated build scripts for Python 3.13 compatibility (Kivy 2.3+, PyInstaller 6.18)
- Added comprehensive build documentation
- Improved printer configuration guidance
2026-02-13 23:34:59 +02:00

64 lines
1.8 KiB
Python

"""
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)