Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm committed Dec 3, 2024
1 parent 557c0f5 commit a575cc8
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 52 deletions.
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch .",
"watch:install": "nodemon --watch src/widget_ngl.ts --exec 'npm install'",
"watch:install": "nodemon --watch src --watch package.json --exec 'npm install'",
"test": "mocha"
},
"dependencies": {
Expand Down
6 changes: 5 additions & 1 deletion js/src/molstarview/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { createPluginUI } from 'molstar/lib/mol-plugin-ui';
import * as molStructure from 'molstar/lib/mol-plugin-state/actions/structure';
import { BuiltInTrajectoryFormat } from 'molstar/lib/mol-plugin-state/formats/trajectory';
import { PluginCommands } from 'molstar/lib/mol-plugin/commands';
import './light.css'; // FIXME: loader issue for labextension building.
import { PLUGIN_VERSION } from 'molstar/lib/mol-plugin/version';
import './light.css'; // npx sass node_modules/molstar/lib/mol-plugin-ui/skin/light.scss > light.css
import * as representation from "./representation";


Expand Down Expand Up @@ -53,6 +54,9 @@ export class MolstarView extends widgets.DOMWidgetView {

// Defines how the widget gets rendered into the DOM
async render() {
this.model.set('_molstar_version', PLUGIN_VERSION);
this.touch(); // touch the model to trigger the first update
console.log('Molstar version: ', PLUGIN_VERSION);
this.handleMessage();
this.displayed.then(async () => {
await this.initializeDisplay();
Expand Down
1 change: 1 addition & 0 deletions nglview/widget_molstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class MolstarView(widgets.DOMWidget):
frame = Integer().tag(sync=True)
loaded = Bool(False).tag(sync=False)
molstate = Dict().tag(sync=True)
_molstar_version = Unicode().tag(sync=True)

def __init__(self):
super().__init__()
Expand Down
23 changes: 19 additions & 4 deletions notebooks/custom_color.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -23,9 +23,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dc83a8ad7bdd4324a39b84e5953d1a1f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"NGLWidget()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"v0 = nv.demo(default=False)\n",
"v0.center()\n",
Expand Down Expand Up @@ -129,7 +144,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.12.7"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
40 changes: 6 additions & 34 deletions notebooks/molstarview.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,10 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "3bef2996-dfbe-4ed7-9816-da54d4a57eb0",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "18c2f150cff1455eb7deaf789ab8122e",
"version_major": 2,
"version_minor": 0
},
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1bd271758c474551a6f66f5e5024671e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"MolstarView()"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"import nglview as nv\n",
"from nglview.widget_molstar import MolstarView\n",
Expand All @@ -44,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "b8df28e8-c84d-4bf8-910c-ce2483538a6e",
"metadata": {},
"outputs": [],
Expand All @@ -54,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "8dbe8e02-6ba0-4b17-b81a-4d14d801e30d",
"metadata": {},
"outputs": [],
Expand All @@ -65,11 +37,11 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d7848321-90c2-4d84-80e0-8b02635643f4",
"id": "74bbfaa4-52ee-4d18-be9a-2b002d959940",
"metadata": {},
"outputs": [],
"source": [
"view.get_state()"
"view._molstar_version"
]
}
],
Expand Down
36 changes: 24 additions & 12 deletions notebooks/render_image.ipynb

Large diffs are not rendered by default.

0 comments on commit a575cc8

Please sign in to comment.