From e0995761822da001d0f28d5f656e1fdf66540208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20B=C4=99dkowski?= Date: Sun, 26 Nov 2023 14:09:40 +0100 Subject: [PATCH] fix: qrcode: make sure that imported qrcode package with QRCode There are other packages with the same name... --- kupfer/plugin/show_qrcode.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kupfer/plugin/show_qrcode.py b/kupfer/plugin/show_qrcode.py index 1c90c94f..362cc52a 100644 --- a/kupfer/plugin/show_qrcode.py +++ b/kupfer/plugin/show_qrcode.py @@ -11,17 +11,20 @@ import io import tempfile from contextlib import closing -import typing as ty +from gettext import gettext as _ import qrcode + from gi.repository import GdkPixbuf, Gtk from kupfer import plugin_support from kupfer.obj import Action, FileLeaf, Leaf, TextLeaf from kupfer.ui import uiutils -if ty.TYPE_CHECKING: - from gettext import gettext as _ + +if not hasattr(qrcode, "QRCode"): + raise ImportError("missing (right) qrcode package") + __kupfer_settings__ = plugin_support.PluginSettings( {