1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
Description: adjust paths to use system-wide packages resources (.js etc)
Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
Origin: upstream
Forwarded: not-needed
Reviewed-By: Yaroslav O. Halchenko <debian@onerussian.com>
--- a/mne/report.py
+++ b/mne/report.py
@@ -1359,21 +1359,27 @@ class Report(object):
@verbose
def _init_render(self, verbose=None):
"""Initialize the renderer."""
- inc_fnames = ['jquery-1.10.2.min.js', 'jquery-ui.min.js',
+ inc_fnames = ['/usr/share/javascript/jquery/jquery.min.js',
+ '/usr/share/javascript/jquery-ui/jquery-ui.min.js',
'bootstrap.min.js', 'jquery-ui.min.css',
'bootstrap.min.css']
include = list()
for inc_fname in inc_fnames:
logger.info('Embedding : %s' % inc_fname)
- f = open(op.join(op.dirname(__file__), 'html', inc_fname),
- 'r')
+ if not os.path.isabs(inc_fname):
+ inc_fname = op.join(op.dirname(__file__), 'html', inc_fname)
+ f = open(inc_fname, 'r')
+ if PY3:
+ f_contents = f.read()
+ else:
+ f_contents = f.read().decode('UTF-8')
if inc_fname.endswith('.js'):
include.append(u'<script type="text/javascript">' +
- f.read() + u'</script>')
+ f_contents + u'</script>')
elif inc_fname.endswith('.css'):
include.append(u'<style type="text/css">' +
- f.read() + u'</style>')
+ f_contents + u'</style>')
f.close()
self.include = ''.join(include)
|