Skip to content
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

Merged
merged 14 commits into from Sep 10, 2018
Merged

Enhanced the extension #1

merged 14 commits into from Sep 10, 2018

Conversation

dschreij
Copy link
Member

@dschreij dschreij commented Sep 4, 2018

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 when jatos.endStudy(false, "Some message why it failed") is called. According to the docs there is a function jatos.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.

@smathot
Copy link
Collaborator

smathot commented Sep 5, 2018

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)

@dschreij
Copy link
Member Author

dschreij commented Sep 6, 2018

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

@dschreij dschreij changed the title Slight restructuring of osexp exports for osweb Enhanced the extension Sep 7, 2018
@dschreij
Copy link
Member Author

dschreij commented Sep 7, 2018

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).

@dschreij
Copy link
Member Author

dschreij commented Sep 8, 2018

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.

@smathot smathot merged commit 82ee25c into open-cogsci:master Sep 10, 2018
@smathot
Copy link
Collaborator

smathot commented Sep 10, 2018

Excellent, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants