From e3b3ea563dc9d730dbf3d688e09a48d0f2b12cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Cuevas?= Date: Wed, 11 Aug 2021 16:33:04 +0200 Subject: [PATCH] Adjust qr size and config loading --- config.py | 3 ++- smallprint.py | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/config.py b/config.py index c509eae..3e59ea0 100644 --- a/config.py +++ b/config.py @@ -31,5 +31,6 @@ def load_config(): else: with path.open("r") as cfg_file: config = yaml.load(cfg_file.read(), Loader=yaml.FullLoader) + print(config) - return True + return config diff --git a/smallprint.py b/smallprint.py index 179067a..5dc72c9 100644 --- a/smallprint.py +++ b/smallprint.py @@ -17,7 +17,7 @@ from PIL import Image import re import requests -from config import config, load_config, CONFIG_PATH +from config import load_config, CONFIG_PATH # Enable logging @@ -26,13 +26,17 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s logger = logging.getLogger(__name__) +config = {} + def initialize(): """ Initializes the printer and returns a printer object to generate the print """ - if not load_config(): + global config + config = load_config() + if not config: print(f"Config file created, check {CONFIG_PATH}") if os.path.exists(config.get("PRINTER_FILE")): @@ -173,7 +177,7 @@ def print_gemini(printer, link): reset_defaults(printer) lnk = _process_link(link, line[3:]) printer.text("\n") - printer.qr(lnk, size=4) + printer.qr(lnk, size=6) else: printer.set(align="left",