Fix bug with initial styling

Was happening after everything else instead of before.
This commit is contained in:
dkoes
2020-11-23 16:25:26 -05:00
parent 2bb0f64cc8
commit a3be0931aa
3 changed files with 213 additions and 140 deletions

File diff suppressed because one or more lines are too long

View File

@@ -118,21 +118,23 @@ if(warn) {
d = data[r][c]
except:
d = data
cmds = "viewergrid_UNIQUEID[%d][%d].addModel(%s);\n"%(r,c,json.dumps(d))
self.startjs += "viewergrid_UNIQUEID[%d][%d].addModel(%s);\n"%(r,c,json.dumps(d))
if style:
try:
s = style[r][c]
except:
s = style
cmds += "viewergrid_UNIQUEID[%d][%d].setStyle(%s);\n"%(r,c,json.dumps(s))
self.endjs = cmds+"viewergrid_UNIQUEID[%d][%d].zoomTo(); viewergrid_UNIQUEID[%d][%d].render();\n"%(r,c,r,c) + self.endjs;
self.startjs += cmds+"viewergrid_UNIQUEID[%d][%d].zoomTo();"%(r,c)
self.endjs = "viewergrid_UNIQUEID[%d][%d].render();\n"%(r,c)+self.endjs;
else:
cmds = ''
if data:
cmds = "viewer_UNIQUEID.addModel(%s);\n"%json.dumps(data)
if style:
cmds += "viewer_UNIQUEID.setStyle(%s);\n"%json.dumps(style)
self.endjs = cmds + "viewer_UNIQUEID.zoomTo();\nviewer_UNIQUEID.render();\n" + self.endjs;
self.startjs += cmds + "viewer_UNIQUEID.zoomTo();\n"
self.endjs = "viewer_UNIQUEID.render();\n" + self.endjs;
@using_ipython

View File

@@ -23,7 +23,7 @@ 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='0.9.0',
version='0.9.1',
description='An IPython interface for embedding 3Dmol.js views',
long_description=long_description,