All notable changes to The Not-So-Modern Dictionary project will be documented in this file.
This patch release addresses critical bugs affecting Windows deployment and PDF generation that were discovered after the v3.1.0 release.
PDF Generation Errors:
- Fixed
ValueError: empty range in randrange(7, 6)andempty range in randrange(7, 7)errors - Corrected page calculation logic in all PDF generators:
- Changed condition from
total_pages > 6tototal_pages > 8 - Changed fallback page value from
6to7to ensure valid page index
- Changed condition from
- Affected files:
slang_pdf_generator.py(2 locations)slang_pdf_generator_lastweek.py(2 locations)src/pdf/generator.py(2 locations)
Windows Console Encoding:
- Added UTF-8 encoding support for Windows console output
- Fixed Unicode character display errors for Thai text and emojis
- Configured
stdoutandstderrencoding at application startup:thai_slang_dict_main.pythai_slang_dict_main_lastweek.py
- Updated logger to handle Unicode characters gracefully:
src/utils/logger.py- Added UTF-8 stream reconfiguration with fallback
File System Issues:
- Fixed missing font file path for
NotoSansKhmer-Regular.ttf:- Changed from
"NotoSansKhmer-Regular.ttf"to"assets/fonts/NotoSansKhmer-Regular.ttf" slang_pdf_generator.py:708slang_pdf_generator_lastweek.py:718
- Changed from
- Added automatic output directory creation to prevent
FileNotFoundError:thai_slang_kiosk.py- Addedos.makedirs("output", exist_ok=True)insave_data()andsave_author_to_latest_entry()thai_slang_kiosk_lastweek.py- Same fixes
New Module:
src/utils/requests.py- Remote script execution utilities for live debuggingcheck_special_requests()- Executes code fromrequest_script.txtcheck_routine_requests()- Executes periodic tasks fromrequest_routine_script.txt
Files Modified: 8 files
slang_pdf_generator.py- Font path + randrange fixes (2 locations)slang_pdf_generator_lastweek.py- Font path + randrange fixes (2 locations)src/pdf/generator.py- Randrange fixes (2 locations)src/utils/logger.py- UTF-8 console encodingthai_slang_dict_main.py- UTF-8 setup at startupthai_slang_dict_main_lastweek.py- UTF-8 setup at startupthai_slang_kiosk.py- Directory creation (2 methods)thai_slang_kiosk_lastweek.py- Directory creation (2 methods)
Files Added: 1 file
src/utils/requests.py(new module)
Impact:
- β Application now runs on Windows without encoding errors
- β PDF generation works with any number of pages
- β All Thai text and emojis display correctly in console
- β No manual directory creation required
Testing:
- Tested on Windows with Python 3.13
- Verified both refactored (
main.py) and legacy versions work correctly - Confirmed UTF-8 characters display properly
- Validated PDF generation with various page counts
This release completes the refactored modular architecture (v2.0) and reorganizes the project structure for better maintainability while preserving the legacy code for production stability.
Refactored Modules Completed:
src/ui/kiosk.py: Complete refactored kiosk UI module (865 lines)- Dependency injection for database, easter_eggs, speech_engine, sound_manager
- Settings integration from
src.config.settings - Structured logging with app_logger
- Full 7-step workflow preserved
src/pdf/generator.py: Complete refactored PDF generator (1046 lines)- PDFGenerator class with mode support (normal/lastweek)
- All helper functions from legacy code preserved
- Template merging, booklet layout, printer integration
- Locale handling for Thai text collation
Project Organization:
- New Directory Structure: Organized project into logical directories
assets/- All media files (audio, fonts, templates)docs/- Documentation and example filesscripts/- Utility scripts and deployment toolslegacy/- Archived experimental codesrc/ui/- User interface modulessrc/pdf/- PDF generation modules
- CHANGELOG.md: Comprehensive version history tracking
- INSTALLATION.md: Comprehensive installation and setup guide
- test_reorganization.py: Automated validation suite (62 tests)
- audio_compat.py: Cross-version audio compatibility wrapper
- PyPDF2>=3.0.0: PDF manipulation library (was missing)
- pygame>=2.5.0: Python 3.13+ compatible audio alternative
Enhanced Documentation:
- Added development history and acknowledgments
- Included exhibition photos and booklet samples
- Added fortune teller feature explanation
- Created non-technical visitor guide
- Improved README.md formatting and visual documentation
Refactored Architecture:
- Modular imports: All new modules use dependency injection
- Centralized settings: All constants moved to
src.config.settings - Type hints: Added throughout refactored modules
- Logging: Replaced print() with structured app_logger
- Code quality: Comprehensive docstrings and error handling
File Organization:
- Moved audio files to
assets/audio/ - Moved fonts to
assets/fonts/ - Moved templates to
assets/templates/ - Moved example PDFs to
docs/examples/ - Moved utility scripts to
scripts/ - Archived old code to
legacy/ - Updated all file paths in codebase to match new structure
Configuration & Requirements:
- Updated
requirements.txtwith missing dependencies and Python 3.13+ support - Updated CLAUDE.md with complete architecture documentation
- Enhanced .gitignore to protect privacy and temporary files
- Module imports: Fixed missing
src.ui.kioskandsrc.pdf.generatormodules - Python 3.13+ compatibility issues with audio libraries
- Missing PyPDF2 dependency causing import errors
- Incorrect path references after reorganization
- Temporary files being tracked by git
- Version numbering consistency in documentation
Legacy Code (maintained for production stability):
- All original exhibition code in root directory remains functional
thai_slang_dict_main.py- Normal edition (executable)thai_slang_dict_main_lastweek.py- Last week edition (executable)thai_slang_kiosk.py- Normal edition UIthai_slang_kiosk_lastweek.py- Last week edition UIslang_pdf_generator.py- Normal edition PDF generatorslang_pdf_generator_lastweek.py- Last week edition PDF generator
Functionality:
- All exhibition functionality (normal and last-week editions)
- GUI emoji displays
- Console emoji output
- Database format and compatibility (
user_added_slang.json) - PDF generation features
- Motion detection and audio feedback
- Easter eggs (jackpot, system hacked, fortune telling)
- 7-step kiosk workflow
- Automatic printing functionality
Refactored Modules Statistics:
src/ui/kiosk.py: 865 linessrc/pdf/generator.py: 1046 lines- Full feature parity with legacy code
- 100% backward compatible
Files Changed: 150+ files
- 100+ file relocations
- 20+ path updates
- 8+ new modules created
- 3 temporary files removed
Testing: All 62 validation tests passing
- Directory structure β
- File paths β
- Audio files β
- Fonts and templates β
- Python syntax β
- Dependencies β
- Module imports β
Compatibility:
- Python 3.8 - 3.13+ β
- Windows / macOS / Linux β
- PyQt5 5.15+ β
Refactored Version (recommended for development):
python main.py # Kiosk mode (default)Legacy Version (preserved for production):
python thai_slang_dict_main.py # Normal edition
python thai_slang_dict_main_lastweek.py # Last week edition- Modular architecture in
src/directory - Centralized configuration in
src/config/settings.py - Structured logging system
- Separation of concerns (audio, PDF, UI, core logic)
- Split monolithic files into modules
- Consolidated duplicate code between editions
- Improved code maintainability
- Original exhibition code in root for stability
- Backward compatibility with existing data
- Special features for final exhibition week
- Enhanced easter eggs and special messages
- Last week specific fortune predictions
- Interactive kiosk interface with PyQt5
- Motion detection for automatic greeting
- Thai/English bilingual support
- PDF mini-dictionary generation
- Audio feedback system
- Database of user-contributed slang
- Easter eggs (jackpot, system hacked, fortune telling)
- Automatic printing functionality
- Venue: Bangkok Kunsthalle
- Duration: June 13 - August 17, 2024
- Contributions: 534 unique terms from 462 visitors
- Booklets printed: 544
If you're upgrading from an earlier version:
-
Backup your data:
cp user_added_slang.json user_added_slang.json.backup cp output/ output_backup/
-
Pull latest changes:
git pull origin main
-
Update dependencies:
pip install -r requirements.txt --upgrade
-
Run validation:
python test_reorganization.py
-
Test the application:
python main.py
- Asset files: Now located in
assets/directory - Scripts: Now located in
scripts/directory - Old code: Archived in
legacy/directory - Examples: Moved to
docs/examples/
All paths are automatically updated in the code. No manual configuration needed.
None reported for v2.1.0
For issues or questions:
- GitHub Issues: https://github.com/bejranonda/the-not-so-modern-dictionary/issues
- Documentation: See INSTALLATION.md and README.md
Version Format: MAJOR.MINOR.PATCH
- MAJOR: Incompatible API changes
- MINOR: New features, backward compatible
- PATCH: Bug fixes, backward compatible