From b9196260cfd515363a026c3bfc7bc7aa757965a0 Mon Sep 17 00:00:00 2001 From: slush Date: Sun, 17 Mar 2013 13:51:29 +0100 Subject: [PATCH] Move is_available() logic to init(), to prevent camera wakeup every second. --- plugins/qrscanner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/qrscanner.py b/plugins/qrscanner.py index f66e60b00..6e327a27c 100644 --- a/plugins/qrscanner.py +++ b/plugins/qrscanner.py @@ -13,8 +13,9 @@ class Plugin(BasePlugin): def __init__(self, gui): BasePlugin.__init__(self, gui, 'qrscans', 'QR scans', "QR Scans.\nInstall the zbar package to enable this plugin") + self._is_available = self._init() - def is_available(self): + def _init(self): if not zbar: return False try: @@ -23,8 +24,11 @@ class Plugin(BasePlugin): except zbar.SystemError: # Cannot open video device return False + return True + def is_available(self): + return self._is_available def create_send_tab(self, grid): b = QPushButton(_("Scan QR code"))