diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..cf27b83 --- /dev/null +++ b/NOTES.md @@ -0,0 +1,22 @@ +Libraries: + +- https://github.com/widgetti/ipyvolume/tree/master/ipyvolume +- https://github.com/nglviewer/nglview +- https://github.com/nglviewer/ngl +- https://github.com/cxhernandez/ipymol +- https://github.com/3dmol/3Dmol.js +- https://github.com/3dmol/3Dmol.js/tree/master/py3Dmol + +WebGL: + +- https://github.com/mrdoob/three.js/ + +Typescript: + +- https://github.com/rmorshea/spectate + +Widgets: + +- https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Custom.html +- https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Low%20Level.html + diff --git a/ipymolsysview/widget.py b/ipymolsysview/widget.py index 0d31555..75addac 100644 --- a/ipymolsysview/widget.py +++ b/ipymolsysview/widget.py @@ -8,14 +8,13 @@ TODO: Add module docstring """ +from ipymolsysview import pyunitwizard as puw from ipywidgets import DOMWidget -from traitlets import Unicode +from traitlets import Unicode, Int from ._frontend import module_name, module_version - class Widget(DOMWidget): - """TODO: Add docstring here - """ + _model_name = Unicode('MolSysModel').tag(sync=True) _model_module = Unicode(module_name).tag(sync=True) _model_module_version = Unicode(module_version).tag(sync=True) @@ -23,4 +22,21 @@ class Widget(DOMWidget): _view_module = Unicode(module_name).tag(sync=True) _view_module_version = Unicode(module_version).tag(sync=True) - value = Unicode('Hello IPyMolSysView!').tag(sync=True) + n_atoms = Int(0).tag(sync=True) + + def __init__(self, molecular_system, selection='all', structure_indices='all', syntax='MolSysMT'): + + .self.molecular_system = molecular_system + .self.selection = selection + .self.syntax = syntax + .self.structure_indices = structure_indices + + from molsysmt import get + + coordinates = get(self.molecular_system, selection=self.selection, + structure_indices=self.structure_indices, syntax=self.syntax) + + coordinates_value = puw.get_value(coordinates, standard=True) + coordinates_value = coordinates_value[0] + +