Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Request: QR-Code Size #20

Open
mozdi opened this issue Jul 11, 2023 · 4 comments
Open

Enhancement Request: QR-Code Size #20

mozdi opened this issue Jul 11, 2023 · 4 comments

Comments

@mozdi
Copy link

mozdi commented Jul 11, 2023

Currently the QR-Code is too small for my screen and I would be happy if I could change the size with a variable.

I have not testet it, but I think that could be done very easy by setting version to a higher number (int between 1 and 40).

The version parameter is an integer from 1 to 40 that controls the size of
the QR Code (the smallest, version 1, is a 21x21 matrix). (https://pypi.org/project/qrcode/)

Thanks and regards,
Mozdi

@mozdi
Copy link
Author

mozdi commented Aug 10, 2023

I had a deeper look into the file "pibooth_qrcode.py".
The following changes are required to add the ability to change the QR-Code size in the config file:

  1. Add the following in the part "def pibooth_configure(cfg):"
    cfg.add_option(SECTION, 'size', "4", "Size of QR code", "Size", "4")

  2. Change qr = qrcode.QRCode(version=1[...] in "def state_processing_exit(cfg, app):"
    from
    qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=8, border=4)
    to
    qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=cfg.gettyped("QRCODE", 'size'), border=4)

  3. Add "[QRCODE][size] in pibooth.cfg-file:
    # Size of QR Code (e.g. size=4)
    size = 4

I would be happy, if you could implement it into your plugin.

Thanks and regards

mozdi added a commit to mozdi/pibooth-qrcode that referenced this issue Aug 10, 2023
@BramWerbrouck
Copy link

BramWerbrouck commented Apr 27, 2024

@mozdi: I already installed this QRcode plugin and want to change the size of the qrcode. Where can I find the right file on my RPI to adjust the code like you suggest?

EDIT: never mind: I just found it here: /home/pi/.local/lib/python3.9/site-packages/pibooth_qrcode.py

@mozdi
Copy link
Author

mozdi commented May 6, 2024

@BramWerbrouck: I suggested to change it in the repository, but unfortunately my pull request didn´t get enough attention.
Does the change work for you as expected?

@BramWerbrouck
Copy link

@mozdi yes everythng works as expected

I did another small modification and added:

SIZES = ['2','3','4','5','6']

and changed in def pibooth_configure(cfg):
cfg.add_option(SECTION, 'size', "4", "Size of QR code", "Size", "4")
to
cfg.add_option(SECTION, 'size', "4", "Size of QR code {}".format(', '.join(SIZES)), "Size",SIZES)

I am also looking to change the text size depending on the QRcode-size, will be continued...

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

No branches or pull requests

2 participants