Skip to content

Commit

Permalink
Merge pull request #5 from pibooth/key
Browse files Browse the repository at this point in the history
Rename some keys in configuration
  • Loading branch information
werdeil authored Apr 25, 2021
2 parents 21a06ab + 315e038 commit 1393e4d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions pibooth_qrcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@
@pibooth.hookimpl
def pibooth_configure(cfg):
"""Declare the new configuration options"""
cfg.add_option('QRCODE', 'qrcode_prefix', "https://github.com/pibooth/pibooth",
cfg.add_option('QRCODE', 'prefix_url', "https://github.com/pibooth/pibooth",
"Prefix URL for the QR code")
cfg.add_option('QRCODE', 'unique_url', True,
"Use only one URL for all photos (one QR code linking to the album)",
"Use only one URL", ["True", "False"])
cfg.add_option('QRCODE', 'code_foreground', (255, 255, 255),
"QR code foreground color", "QR code color", (255, 255, 255))
cfg.add_option('QRCODE', 'code_background', (0, 0, 0),
"QR code background color", "QR background color", (0, 0, 0))

cfg.add_option('QRCODE', 'foreground', (255, 255, 255),
"QR code foreground color", "Color", (255, 255, 255))
cfg.add_option('QRCODE', 'background', (0, 0, 0),
"QR code background color", "Background color", (0 ,0 ,0))

@pibooth.hookimpl
def pibooth_startup(cfg, app):
"""Store the qrcode prefix as an attribute of the app
"""
app.qrcode_prefix = cfg.get('QRCODE', 'qrcode_prefix')
app.qrcode_prefix = cfg.get('QRCODE', 'prefix_url')


@pibooth.hookimpl
Expand Down Expand Up @@ -60,9 +59,8 @@ def state_processing_exit(app, cfg):

qr.add_data(os.path.join(app.qrcode_prefix, name))
qr.make(fit=True)

qrcode_fill_color = '#%02x%02x%02x' % cfg.gettyped("QRCODE", 'code_foreground')
qrcode_background_color = '#%02x%02x%02x' % cfg.gettyped("QRCODE", 'code_background')
qrcode_fill_color = '#%02x%02x%02x' %cfg.gettyped("QRCODE", 'foreground')
qrcode_background_color = '#%02x%02x%02x' % cfg.gettyped("QRCODE", 'background')

image = qr.make_image(fill_color=qrcode_fill_color, back_color=qrcode_background_color)
app.previous_qr = pygame.image.fromstring(image.tobytes(), image.size, image.mode)
Expand Down

0 comments on commit 1393e4d

Please sign in to comment.