From a949935d6bff428d90afc9bb614f0fd2204ca2f3 Mon Sep 17 00:00:00 2001 From: Kayo Kallas Date: Tue, 6 Oct 2020 06:53:53 -0700 Subject: [PATCH] Issue #138 - make AITGUIPlugin to call HTMLRoot --- ait/gui/__init__.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ait/gui/__init__.py b/ait/gui/__init__.py index 3560d883..615dd8f3 100644 --- a/ait/gui/__init__.py +++ b/ait/gui/__init__.py @@ -239,15 +239,25 @@ def reset(self): _RUNNING_SEQ = None CMD_API = ait.core.api.CmdAPI() + class HTMLRoot: Static = pkg_resources.resource_filename('ait.gui', 'static/') User = None plugins = ait.config.get('server.plugins', Static) for plugin in plugins: if plugin['plugin']['name'] == 'ait.gui.AITGUIPlugin': - User = plugin['plugin']['html']['directory'] + User = plugin['plugin'] break + try: + with open(os.path.join(Static, 'package.json')) as infile: + package_data = json.loads(infile.read()) + VERSION = 'AIT GUI v{}'.format(package_data['version']) + log.info('Running {}'.format(VERSION)) + except: + VERSION = '' + log.warn('Unable to determine which AIT GUI Version is running') + SEQRoot = ait.config.get('sequence.directory', None) if SEQRoot and not os.path.isdir(SEQRoot): msg = 'sequence.directory does not exist. Sequence loads may fail.' @@ -266,17 +276,6 @@ class HTMLRoot: Greenlets = [] -try: - with open(os.path.join(HTMLRoot.Static, 'package.json')) as infile: - package_data = json.loads(infile.read()) - VERSION = 'AIT GUI v{}'.format(package_data['version']) - log.info('Running {}'.format(VERSION)) -except: - VERSION = '' - log.warn('Unable to determine which AIT GUI Version is running') - - - class AITGUIPlugin(Plugin): global playback