Skip to content

feat: add QR code generation and printing support#28

Open
gandzekas wants to merge 1 commit into
brick-24:mainfrom
gandzekas:feat/cron-20260714-1
Open

feat: add QR code generation and printing support#28
gandzekas wants to merge 1 commit into
brick-24:mainfrom
gandzekas:feat/cron-20260714-1

Conversation

@gandzekas

Copy link
Copy Markdown

Summary

Implements QR code generation and printing for thermal printers, addressing the "QR codes" item from the Future Ideas list in README.md.

Changes

  • function/qrcode_inp.py: New module with QR code generation and printing:

    • generate_qr_code(data, box_size, border) - generates PIL Image QR code
    • print_qr_code(printer, data, box_size, border, title) - prints to thermal printer
    • print_qr_code_from_args(printer, data, box_size) - CLI convenience function
    • Supports configurable box_size (default 2) and border (default 1) optimized for thermal printers
    • Falls back to ASCII art for TerminalPrinter test mode
  • daily_arg.py: Added --qrcode argument:

    • Accepts string data to encode (URLs, text, etc.)
    • Example: python daily_arg.py --qrcode "https://github.com/gandzekas"
    • Works in both printer and --test modes
  • README.md: Documented the new feature with usage example, removed "QR codes" from Future Ideas list

Testing

  • Syntax validation: python -m py_compile passes for all modified files
  • Manual test in --test mode: QR code renders correctly as ASCII art in terminal
  • Compatible with ESC/POS thermal printers via printer.image() method

Related

  • Addresses Future Ideas item: "QR codes"

- Add function/qrcode_inp.py with QR code generation using qrcode library
- Add --qrcode CLI flag to daily_arg.py for printing QR codes
- Update README.md with QR code usage documentation
- Remove 'QR codes' from Future Ideas (now implemented)
- qrcode dependency already present in requirements.txt

QR codes can be printed via: python daily_arg.py --qrcode "https://example.com"
Supports both thermal printers and --test mode (ASCII output).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant