Clean repository and update .gitignore
- Remove build artifacts from git tracking (build/, dist/, __pycache__/, *.spec) - Updated .gitignore to properly exclude generated files - Added old_code/ documentation folder - Updated sample_data.txt to show new 5-field format - Exclude user-specific conf/app.conf from tracking
This commit is contained in:
251
old_code/SIMPLE_SETUP_GUIDE.md
Normal file
251
old_code/SIMPLE_SETUP_GUIDE.md
Normal file
@@ -0,0 +1,251 @@
|
||||
# Simple Label Printer Setup Guide
|
||||
|
||||
## 🎯 The Correct Workflow
|
||||
|
||||
### How It Works:
|
||||
1. **GUI monitors** text file for changes (`C:\Users\Public\Documents\check.txt`)
|
||||
2. **When file changes**, reads data: `COMANDA;NR_ART;SERIAL`
|
||||
3. **Replaces variables** in SVG template (`conf/label_template.svg`):
|
||||
- `{Article}` → COMANDA value
|
||||
- `{NrArt}` → NR_ART value
|
||||
- `{Serial}` → SERIAL value
|
||||
4. **Converts SVG → PDF** at exact 35mm x 25mm size
|
||||
5. **Prints PDF** to configured printer
|
||||
6. **Saves backup** in `pdf_backup/` folder
|
||||
|
||||
### Template Customization:
|
||||
- Edit `conf/label_template.svg` to change label layout
|
||||
- Move text positions, add graphics, change fonts
|
||||
- Keep placeholders: `{Article}`, `{NrArt}`, `{Serial}`
|
||||
- No code changes needed!
|
||||
|
||||
---
|
||||
|
||||
## 🚀 ONE-TIME Setup (5 Minutes)
|
||||
|
||||
### Step 1: Configure Printer (REQUIRED)
|
||||
```powershell
|
||||
.\setup_printer.ps1
|
||||
```
|
||||
|
||||
**What this does:**
|
||||
- Opens printer preferences dialog
|
||||
- Guides you to set:
|
||||
- Paper Size: **35mm x 25mm** (custom)
|
||||
- Orientation: **Landscape**
|
||||
- Quality: **BEST/600 DPI**
|
||||
- Tests printing
|
||||
|
||||
**This is CRITICAL** - without correct paper size, you'll get:
|
||||
- ❌ 1 meter roll printing
|
||||
- ❌ Wrong label size
|
||||
- ❌ Portrait instead of landscape
|
||||
|
||||
---
|
||||
|
||||
## ✅ Daily Use
|
||||
|
||||
### Start the Application:
|
||||
```powershell
|
||||
python label_printer_gui.py
|
||||
```
|
||||
|
||||
### What You'll See:
|
||||
1. GUI opens with monitoring controls
|
||||
2. Select printer: "Labels"
|
||||
3. Click "Start Monitoring" (or auto-starts)
|
||||
4. GUI watches the file for changes
|
||||
|
||||
### Trigger Printing:
|
||||
- Application writes to `C:\Users\Public\Documents\check.txt`
|
||||
- Format: `COM-2024-002;ART-67890;SN-20260212`
|
||||
- GUI detects change → Prints label automatically
|
||||
- File is cleared after printing
|
||||
|
||||
---
|
||||
|
||||
## 📝 Data Format
|
||||
|
||||
### Input File: `check.txt`
|
||||
```
|
||||
COM-2024-002;ART-67890;SN-20260212
|
||||
```
|
||||
|
||||
### Separator: Semicolon (`;`)
|
||||
|
||||
### Breakdown:
|
||||
- **Field 1**: Nr. Comanda (Order Number)
|
||||
- **Field 2**: Nr. Art. (Article Number)
|
||||
- **Field 3**: Serial No. (Serial Number)
|
||||
|
||||
### Example Data:
|
||||
```
|
||||
ORDER-123;PART-456;SN-2026-001
|
||||
COM-2024-100;ART-55555;SERIAL-123456
|
||||
COMANDA-X;ARTICLE-Y;SN-Z
|
||||
```
|
||||
|
||||
All fields are printed on the label as entered.
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Troubleshooting
|
||||
|
||||
### Problem: 1 Meter Roll Printing
|
||||
**Cause**: Printer paper size not configured
|
||||
**Fix**:
|
||||
```powershell
|
||||
.\setup_printer.ps1
|
||||
```
|
||||
Set paper size to **35mm x 25mm custom**
|
||||
|
||||
### Problem: Dotted/Pixelated Text
|
||||
**Cause**: Print quality too low
|
||||
**Fix**:
|
||||
1. Open printer preferences
|
||||
2. Set quality to **BEST** or **600 DPI**
|
||||
3. Disable dithering
|
||||
4.Run `.\setup_printer.ps1` again
|
||||
|
||||
### Problem: Label Wrong Orientation
|
||||
**Cause**: Orientation not set to landscape
|
||||
**Fix**:
|
||||
1. Open printer preferences
|
||||
2. Set orientation to **LANDSCAPE**
|
||||
3. Save and test
|
||||
|
||||
### Problem: Template Not Working
|
||||
**Cause**: SVG template issues
|
||||
**Check**:
|
||||
```powershell
|
||||
# Verify template exists
|
||||
dir conf\label_template.svg
|
||||
|
||||
# Check console for errors when printing
|
||||
# Should see: "Using SVG template: conf\label_template.svg"
|
||||
```
|
||||
|
||||
### Problem: Variables Not Replaced
|
||||
**Cause**: Template placeholders wrong
|
||||
**Fix**:
|
||||
- Open `conf\label_template.svg`
|
||||
- Verify placeholders are exactly:
|
||||
- `{Article}`
|
||||
- `{NrArt}`
|
||||
- `{Serial}`
|
||||
- Case-sensitive!
|
||||
|
||||
---
|
||||
|
||||
## 📊 Quality Settings Summary
|
||||
|
||||
| Setting | Value | Why |
|
||||
|---------|-------|-----|
|
||||
| PDF DPI | 1200 | Sharp text & images |
|
||||
| Paper Size | 35mm x 25mm | Correct label size |
|
||||
| Orientation | Landscape | Horizontal layout |
|
||||
| Print Quality | 600+ DPI | No dotted text |
|
||||
| Font Size | 8pt | Readable at 35mm width |
|
||||
| Compression | Disabled | No quality loss |
|
||||
|
||||
---
|
||||
|
||||
## 📁 Important Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `label_printer_gui.py` | Main GUI application |
|
||||
| `conf/label_template.svg` | Label layout template |
|
||||
| `conf/accepted.png` | Checkmark image |
|
||||
| `pdf_backup/` | PDF backups of all labels |
|
||||
| `logs/` | Print history logs |
|
||||
| `C:\Users\Public\Documents\check.txt` | Monitored input file |
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Customizing Label Layout
|
||||
|
||||
### Edit the Template:
|
||||
1. Open `conf\label_template.svg` in:
|
||||
- Inkscape (free SVG editor)
|
||||
- Adobe Illustrator
|
||||
- Any SVG editor
|
||||
|
||||
2. Modify:
|
||||
- Text positions
|
||||
- Font sizes/colors
|
||||
- Add graphics/logos
|
||||
- Change layout
|
||||
|
||||
3. Keep placeholders:
|
||||
```xml
|
||||
<text>{Article}</text>
|
||||
<text>{NrArt}</text>
|
||||
<text>{Serial}</text>
|
||||
```
|
||||
|
||||
4. Save as **35mm x 25mm** document
|
||||
|
||||
5. Test:
|
||||
```powershell
|
||||
python test_quality.py
|
||||
```
|
||||
|
||||
**No code changes needed!** Template is reloaded each time.
|
||||
|
||||
---
|
||||
|
||||
## ✅ Verification Checklist
|
||||
|
||||
After setup, verify:
|
||||
|
||||
- [ ] Printer configured (35mm x 25mm, landscape, high quality)
|
||||
- [ ] Test label prints correctly (one label, right size)
|
||||
- [ ] Text is sharp (not dotted)
|
||||
- [ ] GUI starts without errors
|
||||
- [ ] Monitoring detects file changes
|
||||
- [ ] Variables are replaced in output
|
||||
- [ ] PDF backup is created
|
||||
- [ ] Log entry is saved
|
||||
|
||||
If all checked ✅ → **System working correctly!**
|
||||
|
||||
---
|
||||
|
||||
## 🆘 Quick Reference Commands
|
||||
|
||||
```powershell
|
||||
# Initial setup
|
||||
.\setup_printer.ps1
|
||||
|
||||
# Start application
|
||||
python label_printer_gui.py
|
||||
|
||||
# Test print
|
||||
python test_quality.py
|
||||
|
||||
# Check printer config
|
||||
.\configure_printer_quality.ps1
|
||||
|
||||
# View latest PDF
|
||||
cd pdf_backup
|
||||
ls | sort LastWriteTime | select -last 1
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📞 Support
|
||||
|
||||
If problems persist:
|
||||
|
||||
1. **Check printer driver**: Update from manufacturer website
|
||||
2. **Verify label stock**: Correct thermal labels loaded
|
||||
3. **Test printer**: Print self-test page
|
||||
4. **Review logs**: Check `logs/print_log_*.csv`
|
||||
5. **Check PDFs**: Open latest PDF in `pdf_backup/` to verify content
|
||||
|
||||
---
|
||||
|
||||
**Version**: 3.0 - Simplified & Fixed
|
||||
**Last Updated**: February 13, 2026
|
||||
**Status**: ✅ Ready for Production
|
||||
Reference in New Issue
Block a user