py3Dmol 2.1.0__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py3Dmol
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: An IPython interface for embedding 3Dmol.js views in Jupyter notebooks
5
5
  Home-page: https://3dmol.org
6
6
  Author: David Koes
@@ -54,13 +54,14 @@ class view(object):
54
54
  the exception that the functions all return None.
55
55
  http://3dmol.org/doc/GLViewer.html
56
56
  '''
57
- def __init__(self,query='',width=640,height=480,viewergrid=None,data=None,style=None,linked=True,options=dict(),js='https://cdnjs.cloudflare.com/ajax/libs/3Dmol/2.1.0/3Dmol-min.js'):
57
+ def __init__(self,query='',width=640,height=480,viewergrid=None,data=None,style=None,linked=True,options=dict(),format=None,js='https://cdnjs.cloudflare.com/ajax/libs/3Dmol/2.2.0/3Dmol-min.js'):
58
58
  '''Create a 3Dmol.js view.
59
59
  width -- width in pixels of container
60
60
  height -- height in pixels of container
61
61
  query -- optional argument to provide to $3Dmol.download
62
62
  viewergrid -- optional tuple (rows,columns) to define grid
63
- data -- molecular data to provide to addModel, wit viewer grid can be indexed (r,c)
63
+ data -- molecular data to provide to addModel, with viewer grid can be indexed (r,c)
64
+ format -- format of provided data
64
65
  style -- style to apply, with viewer grid can be indexed (r,c)
65
66
  options -- optional options to provide to $3Dmol.download
66
67
  js -- url for 3Dmol.js'''
@@ -145,10 +146,20 @@ if(warn) {
145
146
  cmds = ''
146
147
  if data:
147
148
  try:
148
- d = data[r][c]
149
+ if type(data) == str:
150
+ d = data
151
+ else:
152
+ d = data[r][c]
149
153
  except:
150
154
  d = data
151
- self.startjs += "viewergrid_UNIQUEID[%d][%d].addModel(%s);\n"%(r,c,json.dumps(d))
155
+ try:
156
+ if type(format) == str:
157
+ f = format
158
+ else:
159
+ f = format[r][c]
160
+ except:
161
+ f = format
162
+ self.startjs += f"viewergrid_UNIQUEID[{r}][{c}].addModel({json.dumps(d)}{','+json.dumps(f) if f else ''});\n"
152
163
  if style:
153
164
  try:
154
165
  s = style[r][c]
@@ -160,7 +171,7 @@ if(warn) {
160
171
  else:
161
172
  cmds = ''
162
173
  if data:
163
- cmds = "viewer_UNIQUEID.addModel(%s);\n"%json.dumps(data)
174
+ cmds = f"viewer_UNIQUEID.addModel({json.dumps(data)}{','+json.dumps(format) if format else ''});\n"
164
175
  if style:
165
176
  cmds += "viewer_UNIQUEID.setStyle(%s);\n"%json.dumps(style)
166
177
  self.startjs += cmds + "viewer_UNIQUEID.zoomTo();\n"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: py3Dmol
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: An IPython interface for embedding 3Dmol.js views in Jupyter notebooks
5
5
  Home-page: https://3dmol.org
6
6
  Author: David Koes
@@ -24,7 +24,7 @@ setup(
24
24
  # the version across setup.py and the project code, see
25
25
  # https://packaging.python.org/en/latest/single_source_version.html
26
26
  # Keep version in synce with 3Dmol.js version. Use "postX" suffix if needed
27
- version='2.1.0',
27
+ version='2.2.0',
28
28
 
29
29
  description='An IPython interface for embedding 3Dmol.js views in Jupyter notebooks',
30
30
  long_description=long_description,
File without changes
File without changes
File without changes
File without changes