Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with WEAS viewer. #559

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions aiidalab_widgets_base/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ def _structure_editors(self, editors):
)
if editor.has_trait("selection"):
tl.link((editor, "selection"), (self.viewer, "selection"))
if editor.has_trait("camera_orientation"):
tl.dlink(
(self.viewer._viewer, "_camera_orientation"),
(editor, "camera_orientation"),
)
# if editor.has_trait("camera_orientation"):
# tl.dlink(
# (self.viewer._viewer, "_camera_orientation"),
# (editor, "camera_orientation"),
# )
return editors_tab
return None

Expand Down Expand Up @@ -337,7 +337,6 @@ def _structure_changed(self, change=None):
This function enables/disables `btn_store` widget if structure is provided/set to None.
Also, the function sets `structure_node` trait to the selected node type.
"""

if not self.structure_set_by_undo:
self.history.append(change["new"])

Expand Down
31 changes: 30 additions & 1 deletion notebooks/structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,26 @@
"metadata": {},
"outputs": [],
"source": [
"import aiidalab_widgets_base as awb"
"import aiidalab_widgets_base as awb\n",
"import weas_widget"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"guiConfig={\"enabled\": True,\n",
" \"components\": {\"atomsControl\": True,\n",
" \"colorControl\": True,\n",
" \"buttons\": True,},\n",
" \"buttons\": {\"fullscreen\": True,\n",
" \"download\": True,\n",
" \"measurement\": True,\n",
" }\n",
" }\n",
"viewer = weas_widget.WeasWidget(guiConfig=guiConfig)"
]
},
{
Expand All @@ -63,6 +82,7 @@
" awb.BasicStructureEditor(title=\"Basic Editor\"),\n",
" awb.BasicCellEditor(title=\"Basic Cell Editor\"),\n",
" ],\n",
" viewer=viewer,\n",
")\n",
"# widget = StructureUploadWidget()\n",
"# Enforce node format to be CifData:\n",
Expand All @@ -72,6 +92,15 @@
"# widget = StructureManagerWidget(importers = [(\"From computer\", StructureUploadWidget())], storable=False)\n",
"display(widget)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"viewer"
]
}
],
"metadata": {
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ install_requires =
nglview~=3.0
spglib>=1.14,<3
vapory~=0.1.2
weas-widget
python_requires = >=3.9
include_package_data = True
zip_safe = False
Expand Down
Loading