Move is_available() logic to init(), to prevent camera wakeup every second.
This commit is contained in:
parent
b77d1eb081
commit
b9196260cf
|
@ -13,8 +13,9 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
def __init__(self, gui):
|
def __init__(self, gui):
|
||||||
BasePlugin.__init__(self, gui, 'qrscans', 'QR scans', "QR Scans.\nInstall the zbar package to enable this plugin")
|
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:
|
if not zbar:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
|
@ -23,8 +24,11 @@ class Plugin(BasePlugin):
|
||||||
except zbar.SystemError:
|
except zbar.SystemError:
|
||||||
# Cannot open video device
|
# Cannot open video device
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def is_available(self):
|
||||||
|
return self._is_available
|
||||||
|
|
||||||
def create_send_tab(self, grid):
|
def create_send_tab(self, grid):
|
||||||
b = QPushButton(_("Scan QR code"))
|
b = QPushButton(_("Scan QR code"))
|
||||||
|
|
Loading…
Reference in New Issue