mirror of
https://github.com/3dmol/3Dmol.js.git
synced 2026-06-04 08:39:49 +09:00
Fix py3Dmol
I thought I had checked it.. I thought wrong. No longer uses jquery.
This commit is contained in:
@@ -2,7 +2,7 @@ py3Dmol
|
||||
=======
|
||||
|
||||
A simple [IPython/Jupyter](http://jupyter.org/) widget to
|
||||
embed an interactive [3Dmol.js](http://3dmol.csb.pitt.edu) viewer in a notebook.
|
||||
embed an interactive [3Dmol.js](http://3dmol.org) viewer in a notebook.
|
||||
|
||||
The widget is completely static, which means the viewer doesn't need a running
|
||||
IPython kernel to be useful and web pages and presentations generated from
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -115,11 +115,11 @@ if(warn) {
|
||||
if len(viewergrid) != 2:
|
||||
raise ValueError("Incorrectly formated viewergrid arguments. Must specify rows x columns",viewergrid)
|
||||
self.startjs += "var viewergrid_UNIQUEID = null;\n";
|
||||
self.startjs += 'viewergrid_UNIQUEID = $3Dmol.createViewerGrid($("#%s"),{rows: %d, cols: %d, control_all: %s},{backgroundColor:"white"});\n' % (divid, viewergrid[0],viewergrid[1],'true' if linked else 'false')
|
||||
self.startjs += 'viewergrid_UNIQUEID = $3Dmol.createViewerGrid(document.getElementById("%s"),{rows: %d, cols: %d, control_all: %s},{backgroundColor:"white"});\n' % (divid, viewergrid[0],viewergrid[1],'true' if linked else 'false')
|
||||
self.startjs += "viewer_UNIQUEID = viewergrid_UNIQUEID[0][0];\n"
|
||||
self.viewergrid = viewergrid
|
||||
else:
|
||||
self.startjs += 'viewer_UNIQUEID = $3Dmol.createViewer($("#%s"),{backgroundColor:"white"});\n' % divid
|
||||
self.startjs += 'viewer_UNIQUEID = $3Dmol.createViewer(document.getElementById("%s"),{backgroundColor:"white"});\n' % divid
|
||||
if query:
|
||||
if viewergrid:
|
||||
for r in range(viewergrid[0]):
|
||||
@@ -170,7 +170,7 @@ if(warn) {
|
||||
'''Instead of inserting into notebook here, insert html
|
||||
into existing container'''
|
||||
html = self._make_html()
|
||||
html += '''<script>$("#%s").append($("#3dmolviewer_%s")); </script>'''%(containerid,self.uniqueid)
|
||||
html += '''<script>document.getElementById("%s").append(document.getElementById("3dmolviewer_%s")); </script>'''%(containerid,self.uniqueid)
|
||||
return IPython.display.publish_display_data({'application/3dmoljs_load.v0':html, 'text/html': html},metadata={})
|
||||
|
||||
def _make_html(self):
|
||||
@@ -207,7 +207,7 @@ if(warn) {
|
||||
script = '''<img id="img_{0}">
|
||||
<script>
|
||||
var png = viewer_{0}.pngURI()
|
||||
$('#img_{0}').attr('src', png)
|
||||
document.getElementById('img_{0}').attr('src', png)
|
||||
</script>'''.format(self.uniqueid)
|
||||
return IPython.display.publish_display_data({'application/3dmoljs_load.v0':script, 'text/html': script},metadata={})
|
||||
|
||||
@@ -219,7 +219,7 @@ if(warn) {
|
||||
script = '''<img id="img_{0}">
|
||||
<script>
|
||||
viewer_{0}.apngURI({1}).then(png => {{
|
||||
$('#img_{0}').attr('src', png); }});
|
||||
document.getElementById('img_{0}').attr('src', png); }});
|
||||
</script>'''.format(self.uniqueid,nframes)
|
||||
return IPython.display.publish_display_data({'application/3dmoljs_load.v0':script, 'text/html': script},metadata={})
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ setup(
|
||||
# Versions should comply with PEP440. For a discussion on single-sourcing
|
||||
# the version across setup.py and the project code, see
|
||||
# https://packaging.python.org/en/latest/single_source_version.html
|
||||
version='1.8.1',
|
||||
version='2.0.0-1',
|
||||
|
||||
description='An IPython interface for embedding 3Dmol.js views',
|
||||
description='An IPython interface for embedding 3Dmol.js views in Jupyter notebooks',
|
||||
long_description=long_description,
|
||||
|
||||
# The project's main homepage.
|
||||
url='https://3dmol.csb.pitt.edu',
|
||||
url='https://3dmol.org',
|
||||
|
||||
# Author details
|
||||
author='David Koes',
|
||||
@@ -44,7 +44,7 @@ setup(
|
||||
# 3 - Alpha
|
||||
# 4 - Beta
|
||||
# 5 - Production/Stable
|
||||
'Development Status :: 4 - Beta',
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
|
||||
# Indicate who your project is intended for
|
||||
'Intended Audience :: Developers',
|
||||
|
||||
Reference in New Issue
Block a user