Skip to content

Commit

Permalink
FIX: displaying view multiple times with shape + UPGRADE NGL version (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm committed Jun 28, 2022
1 parent 22a19c5 commit e2f7fe5
Show file tree
Hide file tree
Showing 10 changed files with 107,465 additions and 101,234 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
"jquery": "^3.2.1",
"jquery-ui": "^1.12.1",
"lodash": "^4.17.4",
"ngl": "2.0.0-dev.36",
"ngl": "2.0.0-dev.39",
"underscore": "^1.8.3"
},
"devDependencies": {
"@jupyterlab/builder": "^3.0.0",
"@types/chai": "^4.1.4",
"@types/expect.js": "^0.3.29",
"@types/mocha": "^2.2.48",
"@types/node": "^12.0.2",
"@types/node": "^14.0.0",
"@types/requirejs": "^2.1.31",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
Expand All @@ -78,7 +78,7 @@
"file-loader": "^1.1.6",
"json-loader": "^0.5.4",
"mkdirp": "^1.0.3",
"ngl": "2.0.0-dev.36",
"ngl": "2.0.0-dev.39",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
Expand Down
6 changes: 5 additions & 1 deletion js/src/widget_ngl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ class NGLView extends widgets.DOMWidgetView{


var compList = await Promise.all(loadfile_list)
that._set_representation_from_repr_dict(that.model.get("_ngl_repr_dict"))
that.stage.setParameters(ngl_stage_params);
that.set_camera_orientation(that.model.get("_camera_orientation"));
that.touch();
Expand All @@ -441,6 +440,11 @@ class NGLView extends widgets.DOMWidgetView{
}
})

// Must call _set_representation_from_repr_dict after "fire_embed"
// User might add Shape (buffer component) to the view and the buffer component
// is not created yet via loadFile
// https://github.com/nglviewer/nglview/issues/1003
that._set_representation_from_repr_dict(that.model.get("_ngl_repr_dict"))
that.handleResize() // FIXME: really need this?
}

Expand Down
10 changes: 5 additions & 5 deletions nglview/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ def show_pytraj(pytraj_trajectory, **kwargs):
Examples
--------
>>> import nglview as nv
>>> import pytraj as pt
>>> t = pt.load(nv.datafiles.TRR, nv.datafiles.PDB)
>>> w = nv.show_pytraj(t)
>>> w # doctest: +SKIP
>>> import nglview as nv # doctest: +SKIP
... import pytraj as pt
... t = pt.load(nv.datafiles.TRR, nv.datafiles.PDB)
... w = nv.show_pytraj(t)
... w
'''
trajlist = pytraj_trajectory if isinstance(pytraj_trajectory,
(list, tuple)) else [
Expand Down
208,542 changes: 107,397 additions & 101,145 deletions nglview/static/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nglview/static/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions nglview/staticlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
"jquery": "^3.2.1",
"jquery-ui": "^1.12.1",
"lodash": "^4.17.4",
"ngl": "2.0.0-dev.36",
"ngl": "2.0.0-dev.39",
"underscore": "^1.8.3"
},
"devDependencies": {
"@jupyterlab/builder": "^3.0.0",
"@types/chai": "^4.1.4",
"@types/expect.js": "^0.3.29",
"@types/mocha": "^2.2.48",
"@types/node": "^12.0.2",
"@types/node": "^14.0.0",
"@types/requirejs": "^2.1.31",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
Expand All @@ -78,7 +78,7 @@
"file-loader": "^1.1.6",
"json-loader": "^0.5.4",
"mkdirp": "^1.0.3",
"ngl": "2.0.0-dev.36",
"ngl": "2.0.0-dev.39",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
Expand All @@ -95,7 +95,7 @@
"extension": "lib/jupyterlab-plugin",
"outputDir": "nglview-js-widgets/labextension",
"_build": {
"load": "static/remoteEntry.4560fdad4055be520b35.js",
"load": "static/remoteEntry.08554612fd96651a0411.js",
"extension": "./extension",
"style": "./style"
}
Expand Down
6 changes: 2 additions & 4 deletions nglview/tests/test_movie_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from mock import MagicMock, patch

import nglview
import pytraj
from make_dummy_comm import *
import PIL.Image

Expand All @@ -14,8 +13,8 @@ def test_movie_maker(mock_image, ImageSequenceClip):
from nglview.contrib.movie import MovieMaker
ImageSequenceClip.write_gif = MagicMock()
ImageSequenceClip.write_videofile = MagicMock()
traj = pytraj.datafiles.load_tz2()
view = nglview.show_pytraj(traj)
traj = nglview.SimpletrajTrajectory(nglview.datafiles.XTC, nglview.datafiles.PDB)
view = nglview.show_simpletraj(traj)

movie = MovieMaker(view,
in_memory=True,
Expand All @@ -24,4 +23,3 @@ def test_movie_maker(mock_image, ImageSequenceClip):
moviepy_params={},
stop=2)
movie.make()
# movie.make_old_impl()
Loading

0 comments on commit e2f7fe5

Please sign in to comment.