diff --git a/main.py b/main.py index cb6e471..460be4a 100644 --- a/main.py +++ b/main.py @@ -14,8 +14,13 @@ from qrcode.image.styles.moduledrawers.pil import RoundedModuleDrawer default="./qrcode.png", help='Output file path (defaults to "./qrcode.png")', ) +@click.option( + "--logo_path", + default=None, + help='Path to the logo to to embed (defaults to the Canonical one)', +) @click.argument("url") -def create(output_file, url): +def create(output_file,logo_path, url): qr = qrcode.QRCode( version=1, error_correction=qrcode.constants.ERROR_CORRECT_H, @@ -24,14 +29,14 @@ def create(output_file, url): ) qr.add_data(url) qr.make(fit=True) - + logo=logo_path if logo_path else f"{os.environ.get("SNAP")}/assets/canonical.png" qri = qr.make_image( image_factory=StyledPilImage, color_mask=SolidFillColorMask( back_color=(255, 255, 255), front_color=(233, 84, 32) ), module_drawer=RoundedModuleDrawer(), - embeded_image_path=f"{os.environ.get("SNAP")}/assets/canonical.png", + embeded_image_path=logo, ) qri.save(output_file) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7890dad..d0f1b6a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: cqrcode # you probably want to 'snapcraft register ' base: core24 # the base snap is the execution environment for this snap -version: '1.0' # just for humans, typically '1.2+git' or '1.3.2' +version: '1.1' # just for humans, typically '1.2+git' or '1.3.2' summary: Create QR codes flying Canonical colors. # 79 char long summary description: | TODO