From 378e5fdaa11274b14bc70edef29f416fbb215282 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Wed, 15 May 2024 19:40:20 -0400 Subject: [PATCH 1/4] Add tox file and add test extras to setup. --- setup.py | 5 +++++ tox.ini | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 tox.ini diff --git a/setup.py b/setup.py index d6aa2e3..eab97ee 100644 --- a/setup.py +++ b/setup.py @@ -57,6 +57,11 @@ def data_files(root_directory): "pyvista", "segno" ], + extras_require={ + "test": [ + "flake8" + ] + }, entry_points={ "glue.plugins": "glue_ar = glue_ar:setup" } diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..62c3a75 --- /dev/null +++ b/tox.ini @@ -0,0 +1,6 @@ +[testenv:codestyle] +deps = flake8 +skipsdist = true +skip_install = true +commands = + flake8 --max-line-length=120 --exclude=external glue_ar From 23cc71d928dab0c4e6c3982c3365345dc4572dbd Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Wed, 15 May 2024 19:48:23 -0400 Subject: [PATCH 2/4] Codestyle updates. --- glue_ar/__init__.py | 9 ++++----- glue_ar/common.py | 5 +++-- glue_ar/export.py | 11 +++++++---- glue_ar/export_dialog.py | 2 -- glue_ar/exporting_dialog.py | 3 ++- glue_ar/qr.py | 1 - glue_ar/qr_dialog.py | 2 +- glue_ar/scatter.py | 4 ++-- glue_ar/server.py | 6 ++---- glue_ar/tools.py | 9 +++------ glue_ar/utils.py | 6 +++--- glue_ar/volume.py | 10 +++++----- 12 files changed, 32 insertions(+), 36 deletions(-) diff --git a/glue_ar/__init__.py b/glue_ar/__init__.py index 992fba0..ea5f64e 100644 --- a/glue_ar/__init__.py +++ b/glue_ar/__init__.py @@ -1,11 +1,10 @@ -from glue_ar.export_scatter import * -from glue_ar.export_volume import * -from glue_ar.tools import * +from glue_ar.export_scatter import * # noqa +from glue_ar.export_volume import * # noqa +from glue_ar.tools import * # noqa def setup(): - from glue_qt.config import qt_client - + from glue_vispy_viewers.scatter.scatter_viewer import VispyScatterViewer VispyScatterViewer.tools += ["ar"] VispyScatterViewer.subtools = { diff --git a/glue_ar/common.py b/glue_ar/common.py index 8835201..8cc06f8 100644 --- a/glue_ar/common.py +++ b/glue_ar/common.py @@ -1,9 +1,10 @@ import pyvista as pv + def layers_info(info_creator, viewer_state, layer_states=None): info = {} if layer_states is None: - layer_states = list((l for l in viewer_state.layers if l.visible)) + layer_states = list((layer for layer in viewer_state.layers if layer.visible)) for layer_state in layer_states: info[layer_state.layer.uuid] = info_creator(viewer_state, layer_state) @@ -22,7 +23,7 @@ def create_plotter(adder, info_creator, viewer_state, layer_states=None): # The only error so far I've seen is a ValueError when using Plotter.add_mesh if # the mesh is empty (n_arrays = 0). We can be more explicit once our code is more definite - except: + except Exception: pass return plotter diff --git a/glue_ar/export.py b/glue_ar/export.py index 5804a78..ad5e8be 100644 --- a/glue_ar/export.py +++ b/glue_ar/export.py @@ -5,7 +5,9 @@ import pyvista as pv from gltflib.gltf import GLTF -GLTF_PIPELINE_FILEPATH = join(dirname(abspath(__file__)), "js", "node_modules", "gltf-pipeline", "bin", "gltf-pipeline.js") +GLTF_PIPELINE_FILEPATH = join(dirname(abspath(__file__)), "js", + "node_modules", "gltf-pipeline", + "bin", "gltf-pipeline.js") def export_meshes(meshes, output_path): @@ -63,16 +65,17 @@ def export_gl(plotter, filepath, with_alpha=True, compress=True): def export_modelviewer(output_path, gltf_path, alt_text): + mv_url = "https://ajax.googleapis.com/ajax/libs/model-viewer/3.3.0/model-viewer.min.js" html = f""" - +