patrickfuller / imolecule

An embeddable webGL molecule viewer and file format converter.
http://patrickfuller.github.io/imolecule/
MIT License
86 stars 18 forks source link

HTML-only molecule viewer #17

Closed sallai closed 9 years ago

sallai commented 9 years ago

viewer.visualize() is a function that turns the JSON string representation of a molecule into an HTML file, copies it, along with the requried css and js soruces to a temp folder, and opens it up in the browser. The JSON is embedded in the HTML so that we have no issues with the browsers' same-origin requirements.

patrickfuller commented 9 years ago

@sallai -Thanks for the pull request!

I'm curious to see if this could be wrapped into an existing function. Would you mind providing some information about your intended use case?

sallai commented 9 years ago

The tool we're building ( https://github.com/iModels/mbuild ) needs to visualize molecules not just from within ipython, but also from python programs running from the command line. So far, we've been using VMD, but popping up a browser window with imolecule in a static html allows me to ditch VMD from our project altogether.

Regarding wrapping this functionality into an existing function: yes, it actually does make sense to move it to notebook.draw(). I've updated the PR.

patrickfuller commented 9 years ago

Looks good to me! I'm going to make a couple of nitpicky comments, but I'm happy to merge after that.

sallai commented 9 years ago

Great! Comments have been addressed.

patrickfuller commented 9 years ago

I just realized that I was ambiguous on "I think the file_path variable works as a replacement here." comment. There's a file_path variable defined here that you could use without having to redefine it.

I want to take some code cleaning passes on this project anyway, so I'll update when I get around to that.