Migrated scan plugin
This commit is contained in:
parent
480848b009
commit
dee77c295a
13 changed files with 442 additions and 290 deletions
|
|
@ -1,12 +1,17 @@
|
|||
import logging
|
||||
from flask import current_app
|
||||
|
||||
from . import EXTENSION_NAME
|
||||
|
||||
|
||||
def _current_labthing():
|
||||
app = current_app
|
||||
app = current_app._get_current_object()
|
||||
if not app:
|
||||
return None
|
||||
logging.debug("Active app extensions:")
|
||||
logging.debug(app.extensions)
|
||||
logging.debug("Active labthing:")
|
||||
logging.debug(app.extensions[EXTENSION_NAME])
|
||||
return app.extensions[EXTENSION_NAME]
|
||||
|
||||
|
||||
|
|
@ -30,3 +35,15 @@ def find_device(device_name, labthing_instance=None):
|
|||
return labthing_instance.devices[device_name]
|
||||
else:
|
||||
return None
|
||||
|
||||
def find_plugin(plugin_name, labthing_instance=None):
|
||||
if not labthing_instance:
|
||||
labthing_instance = _current_labthing()
|
||||
|
||||
logging.debug("Current labthing:")
|
||||
logging.debug(_current_labthing())
|
||||
|
||||
if plugin_name in labthing_instance.plugins:
|
||||
return labthing_instance.plugins[plugin_name]
|
||||
else:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue