Skip to content

Commit

Permalink
Issue #138 - make AITGUIPlugin to call HTMLRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayo Kallas committed Nov 3, 2020
1 parent 3e63f04 commit a949935
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions ait/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -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

Expand Down

0 comments on commit a949935

Please sign in to comment.