New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced the extension #1
Conversation
Looks good! However, the standalone experiment breaks for me with Python 2. Traceback (most recent call last):
File "/home/sebastiaan/git/opensesame-extension-osweb/opensesame_extensions/oswebext/oswebext_widget.py", line 78, in _test
export.standalone(osexp, html)
File "/home/sebastiaan/git/opensesame-extension-osweb/osweb/export.py", line 42, in standalone
_html(osexp, dst, mode, _js_files(mode), params, bundled=True)
File "/home/sebastiaan/git/opensesame-extension-osweb/osweb/export.py", line 136, in _html
fd.write(dom.prettify())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa9' in position 160526: ordinal not in range(128) |
Aaah the ever present unicode/ascii conversion horror. It's fixed now, and all appears to work again in Python2 and 3. Because I was in the middle of something, the current state of this PR is a WIP :). I'll let you know here when it is in a 'finished' state again, after which you can merge the PR if you want |
The PR is now in a 'ready' state, so if you could review it again, and merge it if everything is ok, that would be great. I also updated the included osweb js files (now 1.0.3.) and added a logo image to realise a prettier click screen in osweb. I just realised though that this image is not included yet in the standalone export, so I still need to do that, but that should be a minimal effort (hopefully). |
Standalone version now works perfectly as well. I also added some CSS to make the canvas responsive to the screen size, and center it nicely on the display. |
Excellent, thank you! |
I made some changes to the way that the exports for osweb are composed. I changed the usage of templates to a method of more directly manipulating the HTML DOM using BeautifulSoup, which I use to inject the parts that are dynamically generated by Python at the appropriate places in the HTML DOM.
The generation of a standalone bundle remains largely the same, but I reworked the JATOS zip generation such that all files remain separate entities in the zip file. This works perfectly, and I think it will make potential debugging of JATOS packages a lot easier.
Finally, I have improved the jatos.js file, such that data is saved after each call to the log function. I have however not succeeded in transferring the status of an experiment to JATOS: It always says
FINISHED
and does not convey when an experiment has been aborted whenjatos.endStudy(false, "Some message why it failed")
is called. According to the docs there is a functionjatos.abortStudy()
, but this will also erase all data collected up till that moment as well, which is not what we want (right?). A fresh attempt will be made tomorrow, but I thought you could already inspect what I did in the meantime.