Skip to content

Commit 1393e4d

Browse files
authored
Merge pull request #5 from pibooth/key
Rename some keys in configuration
2 parents 21a06ab + 315e038 commit 1393e4d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

pibooth_qrcode.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@
1414
@pibooth.hookimpl
1515
def pibooth_configure(cfg):
1616
"""Declare the new configuration options"""
17-
cfg.add_option('QRCODE', 'qrcode_prefix', "https://github.com/pibooth/pibooth",
17+
cfg.add_option('QRCODE', 'prefix_url', "https://github.com/pibooth/pibooth",
1818
"Prefix URL for the QR code")
1919
cfg.add_option('QRCODE', 'unique_url', True,
2020
"Use only one URL for all photos (one QR code linking to the album)",
2121
"Use only one URL", ["True", "False"])
22-
cfg.add_option('QRCODE', 'code_foreground', (255, 255, 255),
23-
"QR code foreground color", "QR code color", (255, 255, 255))
24-
cfg.add_option('QRCODE', 'code_background', (0, 0, 0),
25-
"QR code background color", "QR background color", (0, 0, 0))
26-
22+
cfg.add_option('QRCODE', 'foreground', (255, 255, 255),
23+
"QR code foreground color", "Color", (255, 255, 255))
24+
cfg.add_option('QRCODE', 'background', (0, 0, 0),
25+
"QR code background color", "Background color", (0 ,0 ,0))
2726

2827
@pibooth.hookimpl
2928
def pibooth_startup(cfg, app):
3029
"""Store the qrcode prefix as an attribute of the app
3130
"""
32-
app.qrcode_prefix = cfg.get('QRCODE', 'qrcode_prefix')
31+
app.qrcode_prefix = cfg.get('QRCODE', 'prefix_url')
3332

3433

3534
@pibooth.hookimpl
@@ -60,9 +59,8 @@ def state_processing_exit(app, cfg):
6059

6160
qr.add_data(os.path.join(app.qrcode_prefix, name))
6261
qr.make(fit=True)
63-
64-
qrcode_fill_color = '#%02x%02x%02x' % cfg.gettyped("QRCODE", 'code_foreground')
65-
qrcode_background_color = '#%02x%02x%02x' % cfg.gettyped("QRCODE", 'code_background')
62+
qrcode_fill_color = '#%02x%02x%02x' %cfg.gettyped("QRCODE", 'foreground')
63+
qrcode_background_color = '#%02x%02x%02x' % cfg.gettyped("QRCODE", 'background')
6664

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

0 commit comments

Comments
 (0)