From 803fee3e99d67827a73b3a02e5611f7d0d4a8262 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Fri, 23 Feb 2024 16:13:58 +0000 Subject: [PATCH 1/3] Integrate with WEAS viewer. --- aiidalab_widgets_base/structures.py | 11 +++++------ notebooks/structures.ipynb | 21 ++++++++++++++++++++- setup.cfg | 1 + 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/aiidalab_widgets_base/structures.py b/aiidalab_widgets_base/structures.py index c3f4ecea8..ff3fc42c8 100644 --- a/aiidalab_widgets_base/structures.py +++ b/aiidalab_widgets_base/structures.py @@ -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 @@ -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"]) diff --git a/notebooks/structures.ipynb b/notebooks/structures.ipynb index 1b172b0c1..710e6b4b7 100644 --- a/notebooks/structures.ipynb +++ b/notebooks/structures.ipynb @@ -37,7 +37,17 @@ "metadata": {}, "outputs": [], "source": [ - "import aiidalab_widgets_base as awb" + "import aiidalab_widgets_base as awb\n", + "import weas_widget\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "viewer = weas_widget.WeasWidget()" ] }, { @@ -72,6 +82,15 @@ "# widget = StructureManagerWidget(importers = [(\"From computer\", StructureUploadWidget())], storable=False)\n", "display(widget)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "viewer" + ] } ], "metadata": { diff --git a/setup.cfg b/setup.cfg index fb72f8d5e..adfa928c8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 From ef657ca62037f485425eee84d83f0aa3be6a9b38 Mon Sep 17 00:00:00 2001 From: Aliaksandr Yakutovich Date: Fri, 23 Feb 2024 16:19:44 +0000 Subject: [PATCH 2/3] Small fix. --- notebooks/structures.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notebooks/structures.ipynb b/notebooks/structures.ipynb index 710e6b4b7..a2239e971 100644 --- a/notebooks/structures.ipynb +++ b/notebooks/structures.ipynb @@ -38,7 +38,7 @@ "outputs": [], "source": [ "import aiidalab_widgets_base as awb\n", - "import weas_widget\n" + "import weas_widget" ] }, { @@ -73,6 +73,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", From 1340e408367ab7298bed27f77d992c6b291de1ea Mon Sep 17 00:00:00 2001 From: superstar54 Date: Mon, 4 Mar 2024 20:21:02 +0000 Subject: [PATCH 3/3] use guiConfig to hide undo and redo buttons --- notebooks/structures.ipynb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/notebooks/structures.ipynb b/notebooks/structures.ipynb index a2239e971..e74899b8c 100644 --- a/notebooks/structures.ipynb +++ b/notebooks/structures.ipynb @@ -47,7 +47,16 @@ "metadata": {}, "outputs": [], "source": [ - "viewer = weas_widget.WeasWidget()" + "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)" ] }, {